jumptwentyfour / cakephp-coding-standards
Coding standards for our CakePHP applications.
Installs: 4 917
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^8.0
- cakedc/cakephp-phpstan: ^2.0
- nikic/php-parser: ^4.0
- slevomat/coding-standard: ^8.9.1
- symplify/easy-coding-standard: ^11.3.2
This package is auto-updated.
Last update: 2024-12-05 11:24:49 UTC
README
Our coding standards for CakePHP applications.
Setup
composer require jumptwentyfour/cakephp-coding-standards --dev
You will also need to add the following to your local phpstan.neon file includes:
- ./vendor/jumptwentyfour/cakephp-coding-standards/phpstan.neon
Running PHP Easy Coding Standard
vendor/bin/ecs check
Extending the Base ecs.php file
Create a new ecs.php
file like the following example:-
<?php
declare(strict_types=1);
use JumpTwentyFour\CakePHPCodingStandards\Support\ConfigHelper;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Option;
return static function (ECSConfig $ecsConfig): void {
$ecsConfig->import(__DIR__ . '/vendor/jumptwentyfour/cakephp-coding-standards/ecs.php');
$parameters = $ecsConfig->parameters();
$parameters->set(Option::PATHS, [
__DIR__ . '/app',
__DIR__ . '/tests',
]);
$ecsConfig->skip(array_merge(ConfigHelper::make()->getParameter(Option::SKIP), [
UnusedParameterSniff::class => [
__DIR__ . '/app/Console/Kernel.php',
__DIR__ . '/app/Exceptions/Handler.php',
],
'Unused parameter $attributes.' => [
__DIR__ . '/database/*.php',
],
CamelCapsFunctionNameSniff::class => [
'/tests/**',
],
]));
};