Skip to content

Commit

Permalink
Fixed some psalm errors and updated baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoboss committed Apr 26, 2022
1 parent 77c6957 commit 9d535bb
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 18 deletions.
36 changes: 20 additions & 16 deletions baselines/psalm.baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="dev-master@916fddb51dce52b2267ec8a56502b234f6bc174d">
<files psalm-version="dev-master@b5b5c20f325712fc8f6775d67c678e76060a9724">
<file src="development/Commands/ReleaseCommand.php">
<PossiblyInvalidArgument occurrences="3">
<code>$args</code>
Expand All @@ -11,9 +11,12 @@
</RedundantCastGivenDocblockType>
</file>
<file src="modules/Collection/src/Enumerable.php">
<UnusedPsalmSuppress occurrences="1">
<code>RedundantConditionGivenDocblockType</code>
</UnusedPsalmSuppress>
<MixedReturnTypeCoercion occurrences="4">
<code>GenericEnumerable&lt;int&gt;</code>
<code>GenericEnumerable&lt;never&gt;</code>
<code>new self(new EmptyIterator())</code>
<code>new self(new RangeIterator($start, $end, $step))</code>
</MixedReturnTypeCoercion>
</file>
<file src="modules/Collection/src/Iterator/KeySelectIterator.php">
<PossiblyNullArgument occurrences="2">
Expand Down Expand Up @@ -65,10 +68,19 @@
<code>$this-&gt;iterator-&gt;key()</code>
</PossiblyNullArgument>
</file>
<file src="modules/Collection/src/IteratorProvider.php">
<ImplementedReturnTypeMismatch occurrences="2">
<code>Iterator&lt;TIteratorKey, TSource&gt;</code>
<code>Iterator&lt;TIteratorKey, TSource&gt;</code>
</ImplementedReturnTypeMismatch>
</file>
<file src="modules/Collection/src/KeyedEnumerable.php">
<UnusedPsalmSuppress occurrences="1">
<code>RedundantConditionGivenDocblockType</code>
</UnusedPsalmSuppress>
<MixedReturnTypeCoercion occurrences="4">
<code>GenericKeyedEnumerable&lt;int, int&gt;</code>
<code>GenericKeyedEnumerable&lt;never, never&gt;</code>
<code>new self(new EmptyIterator())</code>
<code>new self(new RangeIterator($start, $end, $step))</code>
</MixedReturnTypeCoercion>
</file>
<file src="modules/Collection/src/ObjectMap.php">
<UnusedPsalmSuppress occurrences="3">
Expand All @@ -92,8 +104,6 @@
<file src="modules/Configuration/src/ConfigurationSection.php">
<DocblockTypeContradiction occurrences="1">
<code>is_string($offset)</code>
<code>is_string($offset)</code>
<code>is_string($offset)</code>
</DocblockTypeContradiction>
</file>
<file src="modules/Configuration/src/Json/JsonConfigurationProvider.php">
Expand All @@ -115,14 +125,8 @@
<code>$this</code>
</InvalidArgument>
</file>
<file src="modules/Console/src/Command/HelpCommand.php">
<DocblockTypeContradiction occurrences="1">
<code>empty($commandTemplate-&gt;argumentTemplates)</code>
</DocblockTypeContradiction>
</file>
<file src="modules/DI/src/ServiceResolver.php">
<DocblockTypeContradiction occurrences="2">
<code>$possibleArgument !== null</code>
<DocblockTypeContradiction occurrences="1">
<code>$possibleArgument !== null</code>
</DocblockTypeContradiction>
</file>
Expand Down
1 change: 1 addition & 0 deletions modules/Collection/src/Iterator/EagerCachingIterator.php
Expand Up @@ -103,6 +103,7 @@ public function offsetGet(mixed $offset): mixed
$this->rewind();
}

/** @var TValue */
return $this->values[$offset];
}

Expand Down
1 change: 1 addition & 0 deletions modules/Configuration/src/HasArrayData.php
Expand Up @@ -24,6 +24,7 @@ trait HasArrayData
*/
public function getChildKeys(string|Str|null $path = null): GenericEnumerable
{
/** @var Enumerable<string> */
return new Enumerable(function () use ($path): Generator {
if (empty($path)) {
foreach (array_keys($this->data) as $key) {
Expand Down
4 changes: 2 additions & 2 deletions modules/Http/src/Contract/ParameterMap.php
Expand Up @@ -30,9 +30,9 @@ public function remove(string $key, ?ParameterSource $source = null): void;
public function all(string $key): GenericKeyedEnumerable;

/**
* @return GenericKeyedEnumerable<string, mixed>
*
* @param ?ParameterSource $source
*
* @return GenericKeyedEnumerable<array-key, mixed>
*/
public function allFrom(?ParameterSource $source = null): GenericKeyedEnumerable;
}
1 change: 1 addition & 0 deletions modules/Http/src/ParameterMap.php
Expand Up @@ -122,6 +122,7 @@ public function allFrom(?ParameterSource $source = null): GenericKeyedEnumerable
}
}

/** @var KeyedEnumerable<array-key, mixed> */
return new KeyedEnumerable($iterator);
}

Expand Down
1 change: 1 addition & 0 deletions modules/Web/src/Routing/RequestRouter.php
Expand Up @@ -98,6 +98,7 @@ public function getRouteHandler(Request $request): RouteHandlerContract
throw new RouteNotFoundException($request);
}

/** @var list<RouteHandlerContract> $orderedHandlers */
$orderedHandlers = $matchedHandlersGroup
->orderByDescending(static fn (RouteHandlerContract $handler): int => $handler->getSourceAttribute()->getWeight())
->toList()
Expand Down

0 comments on commit 9d535bb

Please sign in to comment.