Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from gsteel/psalm-hack
Refine types, reduce psalm baseline
- Loading branch information
Showing
32 changed files
with
225 additions
and
494 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
/.coveralls.yml export-ignore | ||
/.docheader export-ignore | ||
/.gitattributes export-ignore | ||
/.github/ export-ignore | ||
/.gitignore export-ignore | ||
/docs/ export-ignore | ||
/phpcs.xml export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/psalm.xml export-ignore | ||
/psalm-baseline.xml export-ignore | ||
/test/ export-ignore | ||
.psr-container.php.stub export-ignore | ||
composer.lock export-ignore | ||
renovate.json export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Psr\Container { | ||
/** | ||
* Provides automatic type inference for Psalm when retrieving a service from a container using a FQCN | ||
*/ | ||
interface ContainerInterface | ||
{ | ||
/** | ||
* @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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,220 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<files psalm-version="4.28.0@52e96bea381e6cb07a672aefec791a5817694a26"> | ||
<file src="src/ConfigProvider.php"> | ||
<MixedArrayOffset occurrences="1"/> | ||
<UndefinedClass occurrences="6"> | ||
<code>\Zend\Expressive\Router\Middleware\DispatchMiddleware</code> | ||
<code>\Zend\Expressive\Router\Middleware\ImplicitHeadMiddleware</code> | ||
<code>\Zend\Expressive\Router\Middleware\ImplicitOptionsMiddleware</code> | ||
<code>\Zend\Expressive\Router\Middleware\MethodNotAllowedMiddleware</code> | ||
<code>\Zend\Expressive\Router\Middleware\RouteMiddleware</code> | ||
<code>\Zend\Expressive\Router\RouteCollector</code> | ||
</UndefinedClass> | ||
</file> | ||
<file src="src/Middleware/DispatchMiddleware.php"> | ||
<MixedAssignment occurrences="1"> | ||
<code>$routeResult</code> | ||
</MixedAssignment> | ||
<MixedInferredReturnType occurrences="1"> | ||
<code>ResponseInterface</code> | ||
</MixedInferredReturnType> | ||
<MixedMethodCall occurrences="1"> | ||
<code>process</code> | ||
</MixedMethodCall> | ||
<MixedReturnStatement occurrences="1"> | ||
<code>$routeResult->process($request, $handler)</code> | ||
</MixedReturnStatement> | ||
</file> | ||
<file src="src/Middleware/ImplicitHeadMiddleware.php"> | ||
<MixedArgument occurrences="1"> | ||
<code>ZendExpressiveRouteResult::class</code> | ||
</MixedArgument> | ||
<MixedArgumentTypeCoercion occurrences="1"> | ||
<code>$param</code> | ||
</MixedArgumentTypeCoercion> | ||
<MixedAssignment occurrences="2"> | ||
<code>$result</code> | ||
<code>$value</code> | ||
</MixedAssignment> | ||
<MixedInferredReturnType occurrences="1"> | ||
<code>StreamInterface</code> | ||
</MixedInferredReturnType> | ||
<MixedMethodCall occurrences="1"> | ||
<code>getMatchedRoute</code> | ||
</MixedMethodCall> | ||
<MixedReturnStatement occurrences="1"> | ||
<code>$streamFactory()</code> | ||
</MixedReturnStatement> | ||
<UndefinedClass occurrences="1"> | ||
<code>ZendExpressiveRouteResult</code> | ||
</UndefinedClass> | ||
</file> | ||
<files psalm-version="5.4.0@62db5d4f6a7ae0a20f7cc5a4952d730272fc0863"> | ||
<file src="src/Middleware/ImplicitHeadMiddlewareFactory.php"> | ||
<MixedArgument occurrences="4"> | ||
<InvalidArgument occurrences="1"> | ||
<code>$container->get(StreamInterface::class)</code> | ||
<code>ZendExpressiveRouterInterface::class</code> | ||
<code>ZendExpressiveRouterInterface::class</code> | ||
</MixedArgument> | ||
<UndefinedClass occurrences="2"> | ||
<code>ZendExpressiveRouterInterface</code> | ||
<code>ZendExpressiveRouterInterface</code> | ||
</UndefinedClass> | ||
</file> | ||
<file src="src/Middleware/ImplicitOptionsMiddleware.php"> | ||
<MixedArgument occurrences="1"> | ||
<code>$allowedMethods</code> | ||
</MixedArgument> | ||
<MixedAssignment occurrences="2"> | ||
<code>$allowedMethods</code> | ||
<code>$result</code> | ||
</MixedAssignment> | ||
<MixedMethodCall occurrences="4"> | ||
<code>getAllowedMethods</code> | ||
<code>getMatchedRoute</code> | ||
<code>isFailure</code> | ||
<code>isMethodFailure</code> | ||
</MixedMethodCall> | ||
</file> | ||
<file src="src/Middleware/MethodNotAllowedMiddleware.php"> | ||
<MixedArgument occurrences="1"> | ||
<code>$routeResult->getAllowedMethods()</code> | ||
</MixedArgument> | ||
<MixedAssignment occurrences="1"> | ||
<code>$routeResult</code> | ||
</MixedAssignment> | ||
<MixedMethodCall occurrences="2"> | ||
<code>getAllowedMethods</code> | ||
<code>isMethodFailure</code> | ||
</MixedMethodCall> | ||
</file> | ||
<file src="src/Middleware/RouteMiddleware.php"> | ||
<MixedArgument occurrences="1"> | ||
<code>ZendExpressiveRouteResult::class</code> | ||
</MixedArgument> | ||
<MixedArgumentTypeCoercion occurrences="1"> | ||
<code>$param</code> | ||
</MixedArgumentTypeCoercion> | ||
<MixedAssignment occurrences="1"> | ||
<code>$value</code> | ||
</MixedAssignment> | ||
<UndefinedClass occurrences="1"> | ||
<code>ZendExpressiveRouteResult</code> | ||
</UndefinedClass> | ||
</file> | ||
<file src="src/Middleware/RouteMiddlewareFactory.php"> | ||
<MixedArgument occurrences="2"> | ||
<code>$container->get($this->routerServiceName)</code> | ||
<code>$data['routerServiceName'] ?? RouterInterface::class</code> | ||
</MixedArgument> | ||
</file> | ||
<file src="src/Route.php"> | ||
<PossiblyNullArgument occurrences="1"> | ||
<code>$this->methods</code> | ||
</PossiblyNullArgument> | ||
</file> | ||
<file src="src/RouteCollector.php"> | ||
<MixedArgumentTypeCoercion occurrences="1"> | ||
<code>$methods</code> | ||
</MixedArgumentTypeCoercion> | ||
</InvalidArgument> | ||
</file> | ||
<file src="src/RouteCollectorFactory.php"> | ||
<MixedArgument occurrences="3"> | ||
<code>ZendExpressiveRouterInterface::class</code> | ||
<code>ZendExpressiveRouterInterface::class</code> | ||
</MixedArgument> | ||
<MixedAssignment occurrences="1"> | ||
<code>$config</code> | ||
</MixedAssignment> | ||
<UndefinedClass occurrences="2"> | ||
<code>ZendExpressiveRouterInterface</code> | ||
<code>ZendExpressiveRouterInterface</code> | ||
</UndefinedClass> | ||
</file> | ||
<file src="src/RouteResult.php"> | ||
<MixedPropertyTypeCoercion occurrences="1"> | ||
<code>$methods</code> | ||
</MixedPropertyTypeCoercion> | ||
<PossiblyFalseReference occurrences="1"> | ||
<code>process</code> | ||
</PossiblyFalseReference> | ||
<PossiblyNullReference occurrences="1"> | ||
<code>process</code> | ||
</PossiblyNullReference> | ||
<PropertyNotSetInConstructor occurrences="2"> | ||
<code>$matchedRouteName</code> | ||
<code>$success</code> | ||
</PropertyNotSetInConstructor> | ||
</file> | ||
<file src="src/Test/AbstractImplicitMethodsIntegrationTest.php"> | ||
<MixedAssignment occurrences="1"> | ||
<code>$value</code> | ||
</MixedAssignment> | ||
</file> | ||
<file src="test/ConfigProviderTest.php"> | ||
<MixedArrayOffset occurrences="1"/> | ||
<UndefinedClass occurrences="6"> | ||
<code>\Zend\Expressive\Router\Middleware\DispatchMiddleware</code> | ||
<code>\Zend\Expressive\Router\Middleware\ImplicitHeadMiddleware</code> | ||
<code>\Zend\Expressive\Router\Middleware\ImplicitOptionsMiddleware</code> | ||
<code>\Zend\Expressive\Router\Middleware\MethodNotAllowedMiddleware</code> | ||
<code>\Zend\Expressive\Router\Middleware\RouteMiddleware</code> | ||
<code>\Zend\Expressive\Router\RouteCollector</code> | ||
</UndefinedClass> | ||
</file> | ||
<file src="test/Middleware/ImplicitHeadMiddlewareFactoryTest.php"> | ||
<UndefinedClass occurrences="1"> | ||
<code>ZendExpressiveRouterInterface</code> | ||
</UndefinedClass> | ||
</file> | ||
<file src="test/Middleware/ImplicitHeadMiddlewareTest.php"> | ||
<UndefinedClass occurrences="2"> | ||
<code>ZendExpressiveRouteResult</code> | ||
<code>ZendExpressiveRouteResult</code> | ||
</UndefinedClass> | ||
</file> | ||
<file src="test/Middleware/RouteMiddlewareFactoryTest.php"> | ||
<MixedArgument occurrences="1"> | ||
<code>Router::class</code> | ||
</MixedArgument> | ||
<UndefinedClass occurrences="5"> | ||
<code>Router</code> | ||
<code>Router</code> | ||
<code>Router</code> | ||
<code>Router</code> | ||
<code>Router</code> | ||
</UndefinedClass> | ||
</file> | ||
<file src="test/Middleware/RouteMiddlewareTest.php"> | ||
<UndefinedClass occurrences="3"> | ||
<code>ZendExpressiveRouteResult</code> | ||
<code>ZendExpressiveRouteResult</code> | ||
<code>ZendExpressiveRouteResult</code> | ||
</UndefinedClass> | ||
<file src="test/InMemoryContainer.php"> | ||
<MixedReturnStatement occurrences="1"> | ||
<code>$this->services[$id]</code> | ||
</MixedReturnStatement> | ||
</file> | ||
<file src="test/Response/CallableResponseFactoryDecoratorTest.php"> | ||
<InternalMethod occurrences="1"> | ||
<code>new CallableResponseFactoryDecorator(fn (): ResponseInterface => $this->response)</code> | ||
</InternalMethod> | ||
</file> | ||
<file src="test/RouteCollectorFactoryTest.php"> | ||
<UndefinedClass occurrences="1"> | ||
<code>ZendExpressiveRouterInterface</code> | ||
</UndefinedClass> | ||
</file> | ||
<file src="test/RouteCollectorTest.php"> | ||
<MixedArgument occurrences="1"> | ||
<code>$path</code> | ||
</MixedArgument> | ||
<MixedInferredReturnType occurrences="1"> | ||
<code>mixed[]</code> | ||
</MixedInferredReturnType> | ||
</file> | ||
<file src="test/RouteTest.php"> | ||
<MixedArgumentTypeCoercion occurrences="1"> | ||
<code>$invalidHttpMethods</code> | ||
</MixedArgumentTypeCoercion> | ||
<PossiblyInvalidArgument occurrences="1"> | ||
<code>testThrowsExceptionIfInvalidHttpMethodsAreProvided</code> | ||
</PossiblyInvalidArgument> | ||
</file> | ||
</files> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.