From 5c1a27f7be2b98f46c2dd0ce062d0096021d76e2 Mon Sep 17 00:00:00 2001 From: Anthony Moutte Date: Sat, 16 Dec 2023 08:37:26 +0100 Subject: [PATCH] disable cs risky --- .github/workflows/php.yml | 3 +++ .php-cs-fixer.dist.php | 2 +- Makefile | 2 +- src/Lexer.php | 16 ++++++++-------- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index ff48294..e9f73d1 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -31,6 +31,9 @@ jobs: - name: Install dependencies run: composer install --prefer-dist --no-progress + - name: Run CS fixer + run: make cs + - name: Run php static analyse run: make analyse diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 1e91a46..f25b27f 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -15,7 +15,7 @@ '@PHP74Migration:risky' => true, '@PHPUnit100Migration:risky' => true, '@PhpCsFixer' => true, - '@PhpCsFixer:risky' => true, + '@PhpCsFixer:risky' => false, 'yoda_style' => true, 'general_phpdoc_annotation_remove' => ['annotations' => ['expectedDeprecation']], // one should use PHPUnit built-in method instead 'modernize_strpos' => true, // needs PHP 8+ or polyfill diff --git a/Makefile b/Makefile index d1057ee..a78f2d7 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ test: vendor/bin/phpunit cs: - vendor/bin/php-cs-fixer fix + vendor/bin/php-cs-fixer fix -vvv analyse: vendor/bin/phpstan diff --git a/src/Lexer.php b/src/Lexer.php index 629e58c..beab54e 100644 --- a/src/Lexer.php +++ b/src/Lexer.php @@ -184,21 +184,21 @@ protected function getType(&$value) break; - // Recognize numeric values + // Recognize numeric values case is_numeric($value): if (str_contains($value, '.') || false !== stripos($value, 'e')) { - $value = (float)$value; + $value = (float) $value; $type = self::T_FLOAT; break; } - $value = (int)$value; + $value = (int) $value; $type = self::T_INTEGER; break; - // Recognize quoted strings + // Recognize quoted strings case '"' === $value[0]: $value = str_replace('""', '"', substr($value, 1, \strlen($value) - 2)); @@ -218,7 +218,7 @@ protected function getType(&$value) break; - // Comparison operator + // Comparison operator case '=' === $value: $type = self::T_EQUALS; @@ -255,7 +255,7 @@ protected function getType(&$value) break; - // Composite operator + // Composite operator case '&' === $value: $type = self::T_AND; @@ -283,7 +283,7 @@ protected function getType(&$value) break; - // Brace + // Brace case '(' === $value: $type = self::T_OPEN_PARENTHESIS; @@ -324,7 +324,7 @@ protected function getType(&$value) break; - // Default + // Default default: throw new UnknownTokenTypeException($value); }