Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lookyman/phpstan-symfony
*DEPRECATED* Symfony extension for PHPStan
https://github.com/lookyman/phpstan-symfony
controller dependency-injection php php7 phpstan static-analysis symfony
Last synced: 3 months ago
JSON representation
*DEPRECATED* Symfony extension for PHPStan
- Host: GitHub
- URL: https://github.com/lookyman/phpstan-symfony
- Owner: lookyman
- License: mit
- Archived: true
- Created: 2017-05-05T11:23:15.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-25T19:09:09.000Z (over 6 years ago)
- Last Synced: 2024-04-24T03:14:18.767Z (8 months ago)
- Topics: controller, dependency-injection, php, php7, phpstan, static-analysis, symfony
- Language: PHP
- Homepage:
- Size: 55.7 KB
- Stars: 42
- Watchers: 5
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DEPRECATED
Use [phpstan/phpstan-symfony](https://github.com/phpstan/phpstan-symfony) instead.
# Symfony extension for PHPStan
## What does it do?
* Provides correct return type for `ContainerInterface::get()` method,
* provides correct return type for `Controller::get()` method,
* notifies you when you try to get an unregistered service from the container,
* notifies you when you try to get a private service from the container.## Installation
```sh
composer require --dev lookyman/phpstan-symfony
```## Configuration
Put this into your `phpstan.neon` config:
```neon
includes:
- vendor/lookyman/phpstan-symfony/extension.neon
parameters:
symfony:
container_xml_path: %rootDir%/../../../var/cache/dev/appDevDebugProjectContainer.xml # or srcDevDebugProjectContainer.xml for Symfony 4+
```## Limitations
It can only recognize pure strings or `::class` constants passed into `get()` method. This follows from the nature of static code analysis.
You have to provide a path to `appDevDebugProjectContainer.xml` or similar xml file describing your container.
## Need something?
I don't use Symfony that often. So it might be entirely possible that something doesn't work here or that it lacks some functionality. If that's the case, **PLEASE DO NOT HESITATE** to open an issue or send a pull request. I will have a look at it and together we'll get you what you need. Thanks.