Download the PHP package edhrendal-sf-tools/phpstan-edhrendal without Composer
On this page you can find all versions of the php package edhrendal-sf-tools/phpstan-edhrendal. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download edhrendal-sf-tools/phpstan-edhrendal
More information about edhrendal-sf-tools/phpstan-edhrendal
Files in edhrendal-sf-tools/phpstan-edhrendal
Package phpstan-edhrendal
Short Description PHPStan custom rules for Edhrendal projects
License MIT
Informations about the package phpstan-edhrendal
phpstan-edhrendal
PHPStan extension providing custom static analysis rules for Edhrendal projects.
Rules are opt-in — none are active by default. Include only the ones you need.
Requirements
| Version | |
|---|---|
| PHP | >= 8.5 |
phpstan/phpstan |
~2.1.0 |
Installation
Important — use a dedicated quality tools project
This package should not be installed as a dev dependency of your application. QA tools (PHPStan, PHP CS Fixer, etc.) belong in a separate Composer project, isolated from your application's dependency tree. This avoids version conflicts, keeps your application's
composer.lockclean, and makes tool upgrades independent from application releases.A common convention is a
tools/directory at the root of your repository with its owncomposer.json, or a dedicated repository shared across multiple projects.
Usage
extension.neon defines the full configuration schema and default values for all rules. How it gets loaded depends on your setup.
Standard setup (PHPStan in the same vendor as the project)
PHPStan auto-loads extension.neon via extra.phpstan.includes in composer.json. You do not need to include it manually — just include the rules you want:
Separate tools directory
When PHPStan is installed in a dedicated directory (e.g. tools/), its auto-discovery does not cover that vendor tree. You must include extension.neon explicitly, the same way you would for phpstan-symfony or phpstan-doctrine:
All parameters have sensible defaults. Override only what differs from the defaults:
Available Rules
NoRepositoryMagicMethodRule — Doctrine
Forbids the use of generic and magic Doctrine repository methods in favor of explicit, named methods declared directly in the repository class.
Always reported:
| Call | Reason |
|---|---|
$repo->findBy(['field' => $value]) |
Generic criteria array — create a named method |
$repo->findOneBy(['field' => $value]) |
Generic criteria array — create a named method |
$repo->findByFoo(…) |
Magic method via __call, not declared in the class |
$repo->findOneByFoo(…) |
Magic method via __call, not declared in the class |
Also reported in strict mode:
| Call |
|---|
$repo->find($id) |
$repo->findAll() |
Include:
Strict mode (optional):
Example — before / after:
ControllerInvokableRule — Symfony
Enforces structural and naming conventions on Symfony controllers.
Always reported:
| Violation | Description |
|---|---|
| Bad naming | Class name does not follow {Domain}{HttpMethod}Controller (e.g. PeriodeCalculGetController) |
Missing __invoke() |
Controller does not declare a __invoke() method |
| Public non-magic method | Controller declares a public method other than magic ones (those starting with __) |
| Root placement | Controller sits directly under the Controller namespace segment without a sub-namespace |
Recognised HTTP methods: Get, Post, Put, Patch, Delete, Head, Options, Connect, Trace, Any.
Include:
Parameters (optional):
The excludedClassesFile is a PHP file that returns an array of fully-qualified class names to skip entirely. Changes (additions, removals) are picked up on the next PHPStan run without recompilation:
Example — before / after:
NamedArgumentsRule — PHP
Enforces named argument conventions on all function, method, static-method, and constructor calls.
Always reported:
| Violation | Description |
|---|---|
| Wrong order | Named arguments are not in the same order as declared in the signature |
| Missing name | An argument is passed positionally when named syntax is required |
The order error includes both the expected and actual orderings:
The missing-name error is reported at the argument's line and names the corresponding parameter:
Calls to functions or methods that do not support named arguments (some C-extension functions) are silently skipped.
Include:
Parameters (optional):
| Parameter | Default | Description |
|---|---|---|
forceNamed |
true |
Require named arguments on all calls. When false, only the order check is active. |
forceSingleRequired |
false |
When true, removes the exemption for callables that have only one required parameter (e.g. setTitle('foo') must become setTitle(title: 'foo')). |
Example — before / after: