phpstan-symfony icon indicating copy to clipboard operation
phpstan-symfony copied to clipboard

Symfony extension for PHPStan

Results 95 phpstan-symfony issues
Sort by recently updated
recently updated
newest added

Fixes: https://github.com/phpstan/phpstan-symfony/issues/439

In the [`ParameterBag` stub](https://github.com/phpstan/phpstan-symfony/blob/2.0.x/stubs/Symfony/Component/HttpFoundation/ParameterBag.stub#L13) the return type is improperly narrowed to `list`. The implementation use a simple [`array_keys` call](https://github.com/symfony/http-foundation/blob/7.2/ParameterBag.php#L54). Therefore the return type MUST be `list`. With the current type...

Once generic types are added upstream in Symfony itself, the stubs should not be loaded again to override them, so that the official type definitions are used. phpstan-doctrine already has...

This PR goal is to determine correct result typing for QueryBus kind of classes which uses SF messenger HandleTrait internally and simply return its results.

Hi! I'm in the process of upgrading to phpstan 2. One error that I couldn't find any solution yet is the following. It was working on the latest 1.x versions...

When we inject a ServiceLocator, the extension does not understand that. It thinks it's the full container, but it's not. It's a specialed container. I made a full reproducer: https://github.com/lyrixx/test/commit/e172840d514a00c3ed8667e828a4197a3028c782#r154945352...

Generic types for `FormTypeInterface` and the various `createForm` methods have been rejected in Symfony because they are lying about the actual behavior of the form component. Those generic types allow...

When the route name is a string literal, it should be possible to analyze calls to `UrlGeneratorInterface::generate` to report missing parameters in the array shape of the second argument. Routes...

When this extension learn to operate with [twig](https://github.com/phpstan/phpstan-symfony/pull/405) it would be nice to add rule where we can check generated routes agains paths in twig. ```twig ``` That would help...

When implementing the EventSubscriberInterface of Symfony, the structure of the array being returned from `getSubscribedEvents` is already validated by phpstan thanks to the phpdoc return type, (see https://github.com/symfony/symfony/blob/7.3/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php) except for...