Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
php: ['8.2', '8.3', '8.4', '8.5']
dependencies: [highest]
include:
- php: '8.1'
- php: '8.2'
dependencies: lowest

steps:
Expand Down Expand Up @@ -97,10 +97,10 @@ jobs:
php-version: '8.3'
extensions: openssl, sodium
coverage: none
tools: composer:v2, php-cs-fixer
tools: composer:v2

- name: Install dependencies
run: composer update --no-interaction --no-progress --prefer-dist

- name: Check style
run: composer cs-check
run: vendor/bin/php-cs-fixer fix --dry-run --diff
56 changes: 31 additions & 25 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,44 @@

declare(strict_types=1);

$finder = (new PhpCsFixer\Finder())
/*
* Shared php-cs-fixer configuration for every InitPHP package (ADR-005).
*
* This file is identical in all repositories as `.php-cs-fixer.dist.php`.
* The only package-specific part is the two lines below; scripts/check-cs-config.sh
* ignores exactly those two lines when it compares a package with this template.
* Keep each of them on a single line.
*/
$excludeDirs = [];
$excludePaths = [];

$finder = PhpCsFixer\Finder::create()
->in([__DIR__ . '/src', __DIR__ . '/tests'])
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
->name('*.php');

foreach ($excludeDirs as $excludeDir) {
$finder->exclude($excludeDir);
}

foreach ($excludePaths as $excludePath) {
$finder->notPath($excludePath);
}

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setFinder($finder)
->setCacheFile(__DIR__ . '/.php-cs-fixer.cache')
->setRiskyAllowed(false)
->setRules([
'@PSR12' => true,
'@PSR12:risky' => true,
'declare_strict_types' => true,
'@PER-CS' => true,
'@PHP8x2Migration' => true,
'array_syntax' => ['syntax' => 'short'],
'no_unused_imports' => true,
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => ['class', 'function', 'const'],
'sort_algorithm' => 'alpha',
],
'no_unused_imports' => true,
'single_quote' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'arguments', 'parameters']],
'no_trailing_whitespace' => true,
'no_whitespace_in_blank_line' => true,
'no_extra_blank_lines' => ['tokens' => ['extra', 'throw', 'use']],
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => ['statements' => ['return', 'throw', 'try']],
'cast_spaces' => ['space' => 'single'],
'concat_space' => ['spacing' => 'one'],
'native_function_invocation' => [
'include' => ['@compiler_optimized'],
'scope' => 'namespaced',
'strict' => true,
'trailing_comma_in_multiline' => [
'elements' => ['arguments', 'array_destructuring', 'arrays', 'match', 'parameters'],
],
]);
])
->setFinder($finder)
->setCacheFile(__DIR__ . '/build/php-cs-fixer.cache');
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- **BREAKING:** Raised the minimum PHP version to 8.2 (`"php": "^8.2"`). The
CI matrix now covers PHP 8.2, 8.3, 8.4 and 8.5.
- **BREAKING:** The code style moved to PER-CS, enforced by the shared
PHP-CS-Fixer configuration (`.php-cs-fixer.dist.php`). The source was
reformatted accordingly; there are no behaviour changes.

### Planned for 2.0.0

This is the first development entry of the upcoming 2.0 release. The 2.x line is
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ API:

## Requirements

- PHP **8.1** or higher
- PHP **8.2** or higher
- `ext-openssl` for the OpenSSL handler
- `ext-sodium` for the Sodium handler

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
"security": "https://github.com/InitPHP/Encryption/security/policy"
},
"require": {
"php": "^8.1"
"php": "^8.2"
},
"require-dev": {
"phpunit/phpunit": "^10.5",
"phpstan/phpstan": "^1.11",
"friendsofphp/php-cs-fixer": "^3.59"
"friendsofphp/php-cs-fixer": "^3.95"
},
"suggest": {
"ext-openssl": "Required by the OpenSSL handler.",
Expand Down Expand Up @@ -65,7 +65,7 @@
"test": "Run the PHPUnit test suite.",
"test-coverage": "Run PHPUnit with HTML + text coverage reports.",
"phpstan": "Run PHPStan static analysis.",
"cs-check": "Check coding style (PSR-12) without changing files.",
"cs-check": "Check coding style (PER-CS) without changing files.",
"cs-fix": "Apply coding style fixes in place.",
"qa": "Run cs-check, phpstan and tests in sequence."
},
Expand Down
4 changes: 1 addition & 3 deletions src/Exceptions/EncryptionException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@
* Catching this exception is sufficient to handle every error path the
* library can produce.
*/
class EncryptionException extends RuntimeException
{
}
class EncryptionException extends RuntimeException {}
4 changes: 1 addition & 3 deletions tests/Fixtures/NotAHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,5 @@ final class NotAHandler
/**
* @param array<string, mixed> $options
*/
public function __construct(public readonly array $options = [])
{
}
public function __construct(public readonly array $options = []) {}
}
Loading