jumptwentyfour / php-coding-standards
Coding standards for our PHP applications.
Installs: 97 625
Dependents: 1
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 1
Open Issues: 2
Requires
- php: ^8.0
- nikic/php-parser: ^5.0
- slevomat/coding-standard: ^8.0
- symplify/easy-coding-standard: ^12.3.0
- dev-main
- V3.0.0
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.1
- V2.1.0
- v2.0.0
- 1.0.5
- v1.0.4
- v1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- v0.0.1
- dev-feature/ecs-12-upgrade
- dev-rossjump24-patch-1
- dev-feature/rector
- dev-feature/add-test-annotation-fixer
- dev-feature/update-readme
- dev-feature/add-helper-class
- dev-feature/add-final-controller-sniff
- dev-feature/add-camel-case-variable-sniff
- dev-feature/update-slevomat
- dev-feature/codeowners
- dev-feature/stricter-standards
- dev-feature/MB-27-upgrade-docserver
- dev-LeeJump24-patch-1
- dev-feature/updating-easy-coding-standard
- dev-make-camel-caps-not-strict
- dev-feature/add-ray-to-forbidden-functions
- dev-feature/convert-to-base-package
- dev-feature/upgrade-slevomat
- dev-feature/support-php7
- dev-feature/ecs-docblock-set
- dev-feature/additional-ecs-rules
- dev-feature/php-ecs
- dev-feature/request-validation-rule
This package is auto-updated.
Last update: 2024-10-05 10:42:39 UTC
README
At Jump24 we pride ourselves on keeping our coding standards under tight control, this is why we built this package.
Installation
To install this package, simply use composer:
composer require jumptwentyfour/php-coding-standards
Setup
Once installed you will have access to our PHPStan configuration file, which you can easily add to your phpstan.neon
:
includes: - ./vendor/jumptwentyfour/php-coding-standards/phpstan.neon
Running
To run the code standard checks, simply run the following command:
./vendor/bin/ecs check
This will run the configured code standard checks for you, giving you feedback on where your code is and what improvements you need to implement
Extending
These code standards are extendable, all you need to do is create your own ecs.php
in the root directory of your project:
<?php declare(strict_types=1); use JumpTwentyFour\PhpCodingStandards\Support\ConfigHelper; use Symplify\EasyCodingStandard\Config\ECSConfig; use Symplify\EasyCodingStandard\ValueObject\Option; return static function (ECSConfig $ecsConfig): void { $ecsConfig->import(__DIR__ . '/vendor/jumptwentyfour/php-coding-standards/ecs.php'); $parameters = $ecsConfig->parameters(); $parameters->set(Option::PATHS, [ __DIR__ . '/app', __DIR__ . '/tests', ]); $ecsConfig->skip(array_merge(ConfigHelper::make($ecsConfig)->getParameter(Option::SKIP), [ UnusedParameterSniff::class => [ __DIR__ . '/app/Console/Kernel.php', __DIR__ . '/app/Exceptions/Handler.php', ], 'Unused parameter $attributes.' => [ __DIR__ . '/database/*.php', ], CamelCapsFunctionNameSniff::class => [ '/tests/**', ], ])); };