Skip to content

Commit

Permalink
Remove return types from the stub, favouring annotations which fits e…
Browse files Browse the repository at this point in the history
…xisting implementors such as those found in service manager - this silences unusual errors from psalm.

Signed-off-by: George Steel <george@net-glue.co.uk>
  • Loading branch information
gsteel committed Jul 8, 2022
1 parent 7028b2a commit 0133bae
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
9 changes: 6 additions & 3 deletions .psr-container.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ namespace Psr\Container {
*/
interface ContainerInterface
{
/** @param string|class-string $id */
public function has(string $id): bool;
/**
* @param string|class-string $id
* @return bool
*/
public function has(string $id);

/**
* @template T
* @psalm-param string|class-string<T> $id
* @psalm-return ($id is class-string ? T : mixed)
*/
public function get(string $id): object;
public function get(string $id);
}
}
26 changes: 13 additions & 13 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
<code>$closingBracket</code>
<code>$closingBracket</code>
<code>$closingBracket</code>
<code>$closingBracket</code>
</MissingConstructor>
<MixedArgument occurrences="1">
<code>$val</code>
Expand Down Expand Up @@ -235,6 +234,9 @@
<InvalidReturnType occurrences="1">
<code>HeadLink</code>
</InvalidReturnType>
<LessSpecificReturnStatement occurrences="1">
<code>(object) $attributes</code>
</LessSpecificReturnStatement>
<MixedArgument occurrences="13">
<code>$args</code>
<code>$args</code>
Expand Down Expand Up @@ -291,6 +293,9 @@
<MoreSpecificImplementedParamType occurrences="1">
<code>$value</code>
</MoreSpecificImplementedParamType>
<MoreSpecificReturnType occurrences="1">
<code>stdClass</code>
</MoreSpecificReturnType>
<ParamNameMismatch occurrences="1">
<code>$index</code>
</ParamNameMismatch>
Expand Down Expand Up @@ -566,7 +571,9 @@
<code>$item</code>
<code>$item</code>
</MissingClosureParamType>
<MissingClosureReturnType occurrences="1"/>
<MissingClosureReturnType occurrences="1">
<code>static fn($item) =&gt; $item</code>
</MissingClosureReturnType>
<MixedArgument occurrences="2">
<code>$item</code>
<code>$separator</code>
Expand Down Expand Up @@ -773,7 +780,6 @@
<code>$page-&gt;getTextDomain()</code>
</MixedArgument>
<MixedAssignment occurrences="4">
<code>$container</code>
<code>$container</code>
<code>$container</code>
<code>$label</code>
Expand Down Expand Up @@ -1537,8 +1543,6 @@
</MixedAssignment>
<MixedMethodCall occurrences="1">
<code>get</code>
<code>get</code>
<code>get</code>
</MixedMethodCall>
<ParamNameMismatch occurrences="1">
<code>$container</code>
Expand Down Expand Up @@ -2582,9 +2586,6 @@
<code>$values[2]</code>
</MixedArrayAccess>
<MixedAssignment occurrences="8">
<code>$item</code>
<code>$item</code>
<code>$item</code>
<code>$item</code>
<code>$item</code>
<code>$value</code>
Expand All @@ -2595,9 +2596,6 @@
<code>$values</code>
</MixedAssignment>
<MixedPropertyFetch occurrences="6">
<code>$item-&gt;content</code>
<code>$item-&gt;content</code>
<code>$item-&gt;content</code>
<code>$item-&gt;content</code>
<code>$item-&gt;content</code>
<code>$value-&gt;attributes</code>
Expand Down Expand Up @@ -2889,6 +2887,9 @@
<code>$this-&gt;errorHandlerMessage</code>
</PossiblyNullArgument>
<TooManyArguments occurrences="1"/>
<UndefinedClass occurrences="1">
<code>PsrContainerDecorator</code>
</UndefinedClass>
<UnusedClosureParam occurrences="1">
<code>$code</code>
</UnusedClosureParam>
Expand Down Expand Up @@ -2918,6 +2919,7 @@
<UnevaluatedCode occurrences="4">
<code>$nav = clone $this-&gt;nav2;</code>
<code>$nav-&gt;addPage(['label' =&gt; 'Invalid', 'uri' =&gt; 'http://w.']);</code>
<code>static::fail('A Laminas\View\Exception\InvalidArgumentException was not thrown on invalid &lt;loc /&gt;');</code>
</UnevaluatedCode>
</file>
<file src="test/Helper/PaginationControlTest.php">
Expand Down Expand Up @@ -3422,7 +3424,6 @@
<code>$e</code>
<code>$e</code>
<code>$e</code>
<code>$e</code>
</MissingClosureParamType>
<MixedArgument occurrences="2">
<code>$result-&gt;content</code>
Expand All @@ -3448,7 +3449,6 @@
<code>$e</code>
<code>$e</code>
<code>$e</code>
<code>$e</code>
</UnusedClosureParam>
</file>
</files>

0 comments on commit 0133bae

Please sign in to comment.