Skip to content

ArnoCB/architecture-standards

Repository files navigation

Architecture Standards

An extension with some additional PhpStan rules to help guard code standards.

While this package is in development, it can be installed as follows:

composer.json

"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
}

phpstan.neon

includes:
    - vendor/arnocb/architecture-standards/extension.neon

Rules

  • 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

Flag settings

parameters:
    architectureRules:
        allRules: true|false
        forbidEmpty:  true|false
        forbidIsNull: true|false
        forbidElvis: true|false
        architectureRules:  true|false

Extra development information

setup

  • 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

todo

  • no switch statements, but always match
  • not more than one elseif -> refactor to match

About

An extension with some additional phpstan rules

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages