From 24ccdee1cfba4df64046d9f7678cdd004a5630dc Mon Sep 17 00:00:00 2001 From: David Young Date: Tue, 28 Nov 2023 19:39:28 -0600 Subject: [PATCH] Required PHP 8.3 (#42) * Required PHP 8.3 * Typed constants * Fixed CHANGELOG --- .github/workflows/ci.yml | 4 +--- .php-cs-fixer.dist.php | 4 ++-- CHANGELOG.md | 2 +- composer.json | 4 ++-- src/Auth/Schemes/CookieAuthenticationHandler.php | 2 +- src/Auth/SqlTokenService.php | 2 +- .../Console/DefaultCredentialGeneratorCommandHandler.php | 2 +- src/Users/SqlUserService.php | 2 +- 8 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index caefaca..57c9353 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,8 +15,6 @@ jobs: fail-fast: true matrix: include: - - php: '8.2' - stability: prefer-stable - php: '8.3' stability: prefer-stable name: PHP ${{ matrix.php }} - ${{ matrix.stability }} @@ -35,7 +33,7 @@ jobs: - name: Run Tests run: composer phpunit - name: Run Linter - run: PHP_CS_FIXER_IGNORE_ENV=1 composer phpcs-test + run: composer phpcs-test - name: Run Psalm Static Analysis run: composer psalm -- --shepherd - name: Upload Coverage Results To Coveralls diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 1b2885c..4108310 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -5,14 +5,14 @@ '@PSR12' => true, 'array_syntax' => ['syntax' => 'short'], 'blank_line_after_opening_tag' => true, - 'compact_nullable_typehint' => true, + 'compact_nullable_type_declaration' => true, 'concat_space' => ['spacing' => 'one'], 'declare_equal_normalize' => ['space' => 'none'], 'declare_strict_types' => true, 'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'], // A very tiny micro-optimization to reduce the number of opcodes for native function calls 'native_function_invocation' => ['include' => ['@all']], - 'new_with_braces' => true, + 'new_with_parentheses' => true, 'no_empty_comment' => true, 'no_empty_statement' => true, 'no_leading_import_slash' => true, diff --git a/CHANGELOG.md b/CHANGELOG.md index 897388c..0d660ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ ### Changed -- Nothing +- Required PHP 8.3 ([#42](https://github.com/aphiria/app/pull/42)) ## [v1.0.0-alpha5](https://github.com/aphiria/app/compare/v1.0.0-alpha4...v1.0.0-alpha5) (2023-09-24) diff --git a/composer.json b/composer.json index 0f66382..62c4d22 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "ext-mbstring": "*", "ext-pdo": "*", "ext-sqlite3": "*", - "php": ">=8.2", + "php": ">=8.3", "robmorgan/phinx": "0.x-dev", "symfony/dotenv": "^6.1" }, @@ -40,7 +40,7 @@ }, "scripts": { "phpcs-test": "@phpcs-fix --dry-run", - "phpcs-fix": "php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --diff", + "phpcs-fix": "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --diff", "phpunit": "XDEBUG_MODE=coverage php vendor/phpunit/phpunit/phpunit --coverage-clover=./.coverage/clover.xml", "post-root-package-install": [ "php -r \"file_exists('.env') || copy('.env.dist', '.env');\"" diff --git a/src/Auth/Schemes/CookieAuthenticationHandler.php b/src/Auth/Schemes/CookieAuthenticationHandler.php index ef97588..e1bfa5e 100644 --- a/src/Auth/Schemes/CookieAuthenticationHandler.php +++ b/src/Auth/Schemes/CookieAuthenticationHandler.php @@ -24,7 +24,7 @@ final class CookieAuthenticationHandler extends BaseCookieAuthenticationHandler { /** @var int The default cookie TTL in case one is not set in the cookie options */ - private const DEFAULT_COOKIE_TTL_SECONDS = 3600; + private const int DEFAULT_COOKIE_TTL_SECONDS = 3600; /** * @param ITokenService $tokens The token service to create/retrieve tokens from diff --git a/src/Auth/SqlTokenService.php b/src/Auth/SqlTokenService.php index f708301..3897440 100644 --- a/src/Auth/SqlTokenService.php +++ b/src/Auth/SqlTokenService.php @@ -12,7 +12,7 @@ final class SqlTokenService implements ITokenService { /** @var int The length of generated tokens */ - private const TOKEN_LENGTH = 32; + private const int TOKEN_LENGTH = 32; /** * @param PDO $pdo The PDO instance to use to connect to the database diff --git a/src/Users/Console/DefaultCredentialGeneratorCommandHandler.php b/src/Users/Console/DefaultCredentialGeneratorCommandHandler.php index 7aacf08..ff6b22c 100644 --- a/src/Users/Console/DefaultCredentialGeneratorCommandHandler.php +++ b/src/Users/Console/DefaultCredentialGeneratorCommandHandler.php @@ -22,7 +22,7 @@ final class DefaultCredentialGeneratorCommandHandler implements ICommandHandler { /** @const The length of the default user password */ - private const DEFAULT_USER_PASSWORD_LENGTH = 32; + private const int DEFAULT_USER_PASSWORD_LENGTH = 32; /** * @inheritdoc diff --git a/src/Users/SqlUserService.php b/src/Users/SqlUserService.php index 073a96a..2aef194 100644 --- a/src/Users/SqlUserService.php +++ b/src/Users/SqlUserService.php @@ -12,7 +12,7 @@ final class SqlUserService implements IUserService { /** @var int The max allowed page size when paging through users */ - private const MAX_PAGE_SIZE = 100; + private const int MAX_PAGE_SIZE = 100; /** * @param PDO $pdo The PDO instance to use to connect to the database