Skip to content

Commit 9512cf7

Browse files
committed
Expand PHP version support to include 7.4 with adjusted constraints and updates
- Updated `composer.json` to support PHP 7.4 alongside 8.2. - Refactored Rector configuration for improved compatibility with PHP 7.4 downgrade. - Introduced a `--dry-run` Rector script for safer code testing in `composer.json`. - Updated `README.md` to reflect new PHP version compatibility.
1 parent ab069cf commit 9512cf7

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PHP Typed Values
22

3-
A PHP 8.2 library of typed value objects for common PHP data types.
3+
A PHP 7.4 || 8.2 library of typed value objects for common PHP data types.
44

55
Building blocks for a DTO's, ValueObjects, Entities, etc.
66

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "library",
55
"license": "MIT",
66
"require": {
7-
"php": ">=8.2"
7+
"php": ">=7.4,<8.0 || >=8.2"
88
},
99
"require-dev": {
1010
"friendsofphp/php-cs-fixer": "^v3.89",
@@ -52,8 +52,8 @@
5252
"@mutate",
5353
"echo '\\n\\n\\033[1;32mPre-commit checks passed!\\033[0m\\n'"
5454
],
55-
"rector": [
56-
"./vendor/bin/rector process --config rector/toPhp7.4.php"
55+
"rector-dry-run": [
56+
"./vendor/bin/rector process --config rector/toPhp7.4.php --dry-run"
5757
],
5858
"test": [
5959
"./vendor/bin/pest"

rector/toPhp7.4.php

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,10 @@
33
declare(strict_types=1);
44

55
use Rector\Config\RectorConfig;
6-
use Rector\Set\ValueObject\DowngradeLevelSetList;
76

8-
return static function (RectorConfig $rectorConfig): void {
9-
// We will process code in this specific directory during CI
10-
$rectorConfig->paths([
11-
__DIR__ . '/../',
12-
]);
13-
14-
// Downgrade rules to make code compatible with PHP 7.2
15-
// This handles readonly classes, typed properties, union types, etc.
16-
$rectorConfig->sets([
17-
DowngradeLevelSetList::DOWN_TO_PHP_74,
18-
]);
19-
};
7+
return RectorConfig::configure()
8+
->withPaths([
9+
__DIR__ . '/../src',
10+
// __DIR__ . '/../tests',
11+
])
12+
->withDowngradeSets(php74: true);

0 commit comments

Comments
 (0)