Download the PHP package edalzell/dead-code-detector-laravel without Composer
On this page you can find all versions of the php package edalzell/dead-code-detector-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download edalzell/dead-code-detector-laravel
More information about edalzell/dead-code-detector-laravel
Files in edalzell/dead-code-detector-laravel
Package dead-code-detector-laravel
Short Description PHPStan extensions teaching shipmonk/dead-code-detector about Eloquent trait hooks and #[Scope] attributes
License MIT
Homepage https://github.com/edalzell/dead-code-detector-laravel
Informations about the package dead-code-detector-laravel
Two usage providers for shipmonk/dead-code-detector, covering Laravel conventions its own providers do not: Eloquent trait hooks and #[Scope] attributes.
This is a PHPStan extension, not a Laravel package. There is no service provider and nothing to publish.
For lorisleiva/laravel-actions, see edalzell/dead-code-detector-laravel-actions.
Installation
With phpstan/extension-installer the extension registers itself. Without it, add one line:
What each extension does
EloquentTraitHooksUsageProvider — Eloquent invokes a trait's boot{Trait} and initialize{Trait} hooks reflectively. Shipmonk's Eloquent provider knows only Model::boot and Model::booted, so every hook a trait declares reads as dead.
EloquentScopeAttributeUsageProvider — a #[Scope] method is reached through the query builder, never called by name. Shipmonk's Eloquent provider recognises the older scopeName() convention only, so an attribute-declared scope reads as dead however many callers it has.
Testing
The suite runs PHPStan over tests/Fixtures three times: once with the shipped extension.neon, and once per extension with that one service left out. Each run asserts the exact set of members reported dead, so removing any extension turns a test red with a named fixture rather than quietly changing nothing.
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.