konradmichalik / phpstan-typo3-dead-code
TYPO3 entry points for shipmonk/dead-code-detector: DI constructors, route targets and TypoScript userFunc
Package info
github.com/konradmichalik/phpstan-typo3-dead-code
Type:phpstan-extension
pkg:composer/konradmichalik/phpstan-typo3-dead-code
Requires
- php: ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0
- phpstan/phpstan: ^2.1.41
- shipmonk/dead-code-detector: ^1.4
- symfony/yaml: ^6.4 || ^7.0 || ^8.0
Requires (Dev)
- armin/editorconfig-cli: ^2.0
- ergebnis/composer-normalize: ^2.44
- konradmichalik/php-cs-fixer-preset: ^0.4.0
- phpstan/phpstan-phpunit: ^2.1
- phpunit/phpunit: ^11.5 || ^12.0
- rector/rector: ^2.9
Suggests
None
Provides
None
Conflicts
- typo3/class-alias-loader: <1.2.1
Replaces
None
README
PHPStan TYPO3 dead code
TYPO3 entry points for shipmonk/dead-code-detector. The detector has no TYPO3 support, so it reports everything TYPO3 calls from configuration instead of PHP code. A route target such as FacetsModalController::configuration is only named in Configuration/Backend/AjaxRoutes.php, and the detector reports it as unused.
Warning
The 0.x versions are still in development. Options and behaviour may change between minor versions.
✨ Features
- Configuration entry points: route targets, TCA callbacks, TypoScript
userFunc,Services.yamllistener methods and factories, and DataHandler hooks count as used - Container and Extbase conventions: Extbase actions are not reported, and by default neither are constructors,
inject*methods andinitializeObject - Optional event and Fluid support: keep the public API of dispatched events and the members read in Fluid templates
- Fully qualified matching: class names are resolved, so two classes with the same short name do not cover each other
🔥 Installation
Requirements
- PHP 8.2, 8.3, 8.4, 8.5 or 8.6
- PHPStan 2.1.41 or newer
shipmonk/dead-code-detector1.4 (installed automatically as a dependency)typo3/class-alias-loader1.2.1 or newer, if installed. Older versions hidevendor/from the detector, which then reports every override of a TYPO3 method as unused
Composer
composer require --dev konradmichalik/phpstan-typo3-dead-code
🚀 Quick start
With phpstan/extension-installer the detector and the provider are included automatically. Point PHPStan at the extension's code and configuration:
# phpstan.neon parameters: paths: - Classes - Configuration - ext_localconf.php
// Configuration/Backend/AjaxRoutes.php 'target' => FacetsModalController::class . '::configuration', // FacetsModalController::configuration counts as used
See Usage for the manual setup and for running PHPStan from a subdirectory such as Tests/CGL.
📚 Documentation
| Topic | What's inside |
|---|---|
| Usage | Extension installer, manual setup, PHPStan started from a subdirectory, result cache |
| Entry points | Everything the provider marks as used, and what it does not cover |
| Configuration | Every option with its default and effect |
🧑💻 Contributing
Please have a look at CONTRIBUTING.md.
⭐ License
This project is licensed under GNU General Public License 3.0 (or later).