From 02a36fb718e7a248888d820c9f8b3ed9f108776e Mon Sep 17 00:00:00 2001 From: Dennis Fridrich Date: Tue, 3 Jan 2023 15:44:04 +0100 Subject: [PATCH 1/3] Use PHP 8.0+ --- .github/workflows/ci.yml | 14 +++++++------- composer.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0999cb3..9e0b5bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: - 'master' env: - CONSISTENCE_PHP_VERSION: '7.3' + CONSISTENCE_PHP_VERSION: '8.0' jobs: composer-validate: @@ -45,9 +45,9 @@ jobs: fail-fast: false matrix: php-version: - - '7.2' - - '7.3' - - '7.4' + - '8.0' + - '8.1' + - '8.2' steps: - @@ -108,9 +108,9 @@ jobs: fail-fast: false matrix: php-version: - - '7.2' - - '7.3' - - '7.4' + - '8.0' + - '8.1' + - '8.2' composer-dependencies: - 'highest' - 'lowest' diff --git a/composer.json b/composer.json index f2a6cfd..8ad29b6 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ } ], "require": { - "php": "~7.2", + "php": "~8.0", "squizlabs/php_codesniffer": "~3.5.5", "slevomat/coding-standard": "~6.0" }, From 0079c151d9fdd71ec3d538c7f2d19319796ce683 Mon Sep 17 00:00:00 2001 From: Dennis Fridrich Date: Tue, 3 Jan 2023 15:55:08 +0100 Subject: [PATCH 2/3] Update squizlabs/php_codesniffer --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8ad29b6..4f275a1 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ ], "require": { "php": "~8.0", - "squizlabs/php_codesniffer": "~3.5.5", + "squizlabs/php_codesniffer": "~3.7", "slevomat/coding-standard": "~6.0" }, "require-dev": { From cf71ec146bfd3ea574bb5d1567ef9464c62b787b Mon Sep 17 00:00:00 2001 From: Dennis Fridrich Date: Tue, 3 Jan 2023 15:55:14 +0100 Subject: [PATCH 3/3] Fix tests --- Consistence/Sniffs/Exceptions/ExceptionDeclarationSniff.php | 3 +-- .../Sniffs/NamingConventions/ValidVariableNameSniff.php | 2 +- tests/Sniffs/Exceptions/ExceptionDeclarationSniffTest.php | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Consistence/Sniffs/Exceptions/ExceptionDeclarationSniff.php b/Consistence/Sniffs/Exceptions/ExceptionDeclarationSniff.php index befffd6..9e1079f 100644 --- a/Consistence/Sniffs/Exceptions/ExceptionDeclarationSniff.php +++ b/Consistence/Sniffs/Exceptions/ExceptionDeclarationSniff.php @@ -17,8 +17,7 @@ class ExceptionDeclarationSniff implements \PHP_CodeSniffer\Sniffs\Sniff public const CODE_NOT_CHAINABLE = 'NotChainable'; public const CODE_INCORRECT_EXCEPTION_DIRECTORY = 'IncorrectExceptionDirectory'; - /** @var string */ - public $exceptionsDirectoryName = 'exceptions'; + public string $exceptionsDirectoryName = 'exceptions'; /** * @return int[] diff --git a/Consistence/Sniffs/NamingConventions/ValidVariableNameSniff.php b/Consistence/Sniffs/NamingConventions/ValidVariableNameSniff.php index 6fd7863..b61ca8c 100644 --- a/Consistence/Sniffs/NamingConventions/ValidVariableNameSniff.php +++ b/Consistence/Sniffs/NamingConventions/ValidVariableNameSniff.php @@ -13,7 +13,7 @@ class ValidVariableNameSniff extends \PHP_CodeSniffer\Sniffs\AbstractVariableSni public const CODE_CAMEL_CAPS = 'NotCamelCaps'; /** @var string[] */ - private static $phpReservedVariables = [ + private static array $phpReservedVariables = [ '_SERVER', '_GET', '_POST', diff --git a/tests/Sniffs/Exceptions/ExceptionDeclarationSniffTest.php b/tests/Sniffs/Exceptions/ExceptionDeclarationSniffTest.php index fbfb2ce..be41f88 100644 --- a/tests/Sniffs/Exceptions/ExceptionDeclarationSniffTest.php +++ b/tests/Sniffs/Exceptions/ExceptionDeclarationSniffTest.php @@ -205,7 +205,7 @@ public function testExceptionIsPlacedInCorrectDirectory(): void public function testExceptionIsPlacedInCorrectDirectoryOnWindows(): void { // PHP_CodeSniffer detects the path with backslashes on Windows - $resultFile = $this->checkFile(__DIR__ . '\data\ValidNameException.php', [ + $resultFile = $this->checkFile(__DIR__ . '/data/ValidNameException.php', [ 'exceptionsDirectoryName' => 'data', ]);