An extension with some additional PhpStan rules to help guard code standards.
While this package is in development, it can be installed as follows:
"repositories": [{
"type": "vcs",
"url": "https://github.com/arnocb/architecture-standards.git"
}],
"require-dev": {
"arnocb/architecture-standards": "dev-main"
}
Allow the plugin to be installed with composer:
"allow-plugins": {
"arnocb/architecture-standards": true,
"phpstan/extension-installer": true
}
includes:
- vendor/arnocb/architecture-standards/extension.neon
- ForbidEmptyRule - Forbid empty statements
- ForbidIsNullRule - Forbid is_null() checks
- ForbidElvisRule - Forbid elvis operators
- ArchitectureRules - Forbid methods in the Controller that don't give a response
- Forbid responses in non-Controller / non-Middleware classes
parameters:
architectureRules:
allRules: true|false
forbidEmpty: true|false
forbidIsNull: true|false
forbidElvis: true|false
architectureRules: true|false
- The PHP parser used by PhpStan is nikic/php-parser
- The api description of PHPDoc: https://docs.phpdoc.org/3.0/
- The PHPDoc standard (PSR-19) is a work in progress, but can be found at: https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc-tags.md
- Since this is a PHPStan extension, PHPStan is a normal requirement
- Since we want to create rules for Laravel, but the package doesn't necessarily require Laravel, this is a dev requirement
- no switch statements, but always match
- not more than one elseif -> refactor to match