Skip to content

Commit

Permalink
build: Use shared PHP CS Fixer config
Browse files Browse the repository at this point in the history
Signed-off-by: Sacha Telgenhof <[email protected]>
  • Loading branch information
stelgenhof committed Jan 30, 2024
1 parent 47acfc3 commit 97534fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 25 deletions.
25 changes: 2 additions & 23 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,8 @@
*
* @author Sacha Telgenhof <me at sachatelgenhof dot com>
*/
$finder = PhpCsFixer\Finder::create()->in(__DIR__);

$config = new PhpCsFixer\Config();
$config->setRiskyAllowed(true)->setRules([
'@PER' => true,
'@Symfony' => true,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'explicit_string_variable' => true,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => ['remove_inheritdoc' => true],
'not_operator_with_successor_space' => true,
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true ],
'ordered_class_elements' => 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,
'self_accessor' => true,
])->setFinder($finder);
$config = new AzuyaLabs\PhpCsFixerConfig\Config();
$config->getFinder()->in(__DIR__)->notPath('var');

return $config;
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azuyalabs/yasumi",
"description": "The easy PHP Library for calculating holidays.",
"description": "The easy PHP Library for calculating holidays",
"license": "MIT",
"type": "library",
"keywords": [
Expand Down Expand Up @@ -40,6 +40,7 @@
},
"require-dev": {
"ext-intl": "*",
"azuyalabs/php-cs-fixer-config": "^0.1",
"friendsofphp/php-cs-fixer": "^2.19 || 3.48",
"mikey179/vfsstream": "^1.6",
"phan/phan": "^5.4",
Expand Down Expand Up @@ -72,7 +73,8 @@
"@phpstan",
"@psalm"
],
"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",
"phan": "vendor/bin/phan -C",
"phpstan": "vendor/bin/phpstan analyse",
"psalm": "vendor/bin/psalm --threads=2",
Expand Down

0 comments on commit 97534fb

Please sign in to comment.