Skip to content

Commit

Permalink
Update PHP CS Fixer configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegamez committed Nov 30, 2023
1 parent f7f89f4 commit 4ff726e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 26 deletions.
54 changes: 31 additions & 23 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,35 @@

declare(strict_types=1);

use Beste\PhpCsFixer\Config\RuleSet\Php81;
use Ergebnis\PhpCsFixer\Config;
$finder = PhpCsFixer\Finder::create()->in(__DIR__);

$config = Config\Factory::fromRuleSet(new Php81(), [
'phpdoc_line_span' => false,
'concat_space' => [
'spacing' => 'none',
],
'final_class' => false,
'final_internal_class' => false,
'final_public_method_for_abstract_class' => false,
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => true,
'import_functions' => true,
],
'php_unit_test_case_static_method_calls' => [
'call_type' => 'this',
],
]);

$config->getFinder()->in(__DIR__);

return $config;
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PER-CS2.0' => true,
'class_definition' => [
'single_line' => true,
],
'concat_space' => [
'spacing' => 'none',
],
'no_unused_imports' => true,
'ordered_imports' => [
'imports_order' => [
'class',
'function',
'const',
],
'sort_algorithm' => 'alpha',
],
'php_unit_method_casing' => [
'case' => 'camel_case',
],
'php_unit_test_case_static_method_calls' => [
'call_type' => 'this',
'methods' => [],
],
'single_line_empty_body' => false,
'yoda_style' => false,
])
->setFinder($finder);
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"psr/cache-implementation": "to cache fetched remote public keys"
},
"require-dev": {
"beste/php-cs-fixer-config": "^2.4.1",
"friendsofphp/php-cs-fixer": "^3.40",
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan": "^1.9.2",
Expand Down
2 changes: 1 addition & 1 deletion src/JWT/Action/VerifyIdToken/WithLcobucciJWT.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function handle(VerifyIdToken $action): Token
}
} catch (RequiredConstraintsViolated $e) {
$errors = array_map(
static fn (ConstraintViolation $violation): string => '- '.$violation->getMessage(),
static fn(ConstraintViolation $violation): string => '- '.$violation->getMessage(),
$e->violations(),
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/JWT/Action/VerifySessionCookie/WithLcobucciJWT.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function handle(VerifySessionCookie $action): Token
}
} catch (RequiredConstraintsViolated $e) {
$errors = array_map(
static fn (ConstraintViolation $violation): string => '- '.$violation->getMessage(),
static fn(ConstraintViolation $violation): string => '- '.$violation->getMessage(),
$e->violations(),
);
}
Expand Down

0 comments on commit 4ff726e

Please sign in to comment.