Skip to content

Commit

Permalink
build: Shorten the PHP CS fix script and add a script to perform a dr…
Browse files Browse the repository at this point in the history
…y-run. Use common PHP CS fixer config package

Signed-off-by: Sacha Telgenhof <[email protected]>
  • Loading branch information
stelgenhof committed Jan 29, 2024
1 parent b73ff68 commit 993b4bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 24 deletions.
25 changes: 2 additions & 23 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,7 @@
* @author Sacha Telgenhof <me at sachatelgenhof dot com>
*/

$finder = PhpCsFixer\Finder::create()->in(__DIR__)->notPath('var');

$config = new PhpCsFixer\Config();
$config->setRiskyAllowed(true)->setRules([
'@Symfony' => true,
'@PER' => true,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'ordered_class_elements' => true,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => ['remove_inheritdoc' => true],
'not_operator_with_successor_space' => true,

// Risky
'declare_strict_types' => true,
'dir_constant' => true,
'get_class_to_class_keyword' => true,
'is_null' => true,
'modernize_strpos' => true,
'modernize_types_casting' => true,
'native_constant_invocation' => ['strict' => false],
'self_accessor' => true,
])->setFinder($finder);
$config = new AzuyaLabs\PhpCsFixerConfig\Config('2017');
$config->getFinder()->in(__DIR__)->notPath('var');

return $config;
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"guzzlehttp/guzzle": "^7.8"
},
"require-dev": {
"azuyalabs/php-cs-fixer-config": "dev-dev",
"fakerphp/faker": "^1.23",
"friendsofphp/php-cs-fixer": "^v3.15",
"infection/infection": "^0.26",
Expand Down Expand Up @@ -72,7 +73,8 @@
"@psalm",
"@infection"
],
"format": "vendor/bin/php-cs-fixer fix",
"cs": "vendor/bin/php-cs-fixer fix -v --diff --dry-run",
"cs-fix": "vendor/bin/php-cs-fixer fix -v",
"infection": "vendor/bin/infection run -j 2",
"phpstan": "vendor/bin/phpstan analyse",
"psalm": "vendor/bin/psalm --threads=2",
Expand Down

0 comments on commit 993b4bf

Please sign in to comment.