-
Notifications
You must be signed in to change notification settings - Fork 0
43 enable php 81 features with backward compatibility #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
53a7646
36a4b1a
2e999f7
1c3dbc7
8fc50d7
c5e60ce
08a3bff
b07e67f
9b0b79e
29af9de
ba55f22
907a84f
023fd9b
9daba43
998dc5f
4c2ccde
b07e881
9277b3a
7676ae7
dbddd01
de4665d
7726a41
3fedad0
c16a9ee
0925c4a
27cd35b
d305ed3
8c1af1a
f2d04b6
50cf03e
0415272
a143a9a
e7f820e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: Downgraded Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - '*' | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| downgrade_release: | ||
| # Skip if this is already a downgraded tag | ||
| if: ${{ !endsWith(github.ref_name, '.74') }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: 8.3 | ||
| coverage: none | ||
|
|
||
| - uses: ramsey/composer-install@v3 | ||
|
|
||
| # Downgrade /src to PHP 7.4 | ||
| - run: vendor/bin/rector process src --config build/rector-downgrade-php-74.php --ansi | ||
|
|
||
| # Copy PHP 7.4 composer.json | ||
| - run: cp build/composer-php-74.json composer.json | ||
|
|
||
| # Remove dev files | ||
| - run: rm -rf build .github tests stubs ecs.php phpstan.neon phpunit.xml rector.php .php-cs-fixer.php | ||
|
|
||
| # Tag and push downgraded code | ||
| - name: Tag Downgraded Code | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add --all | ||
| git commit -m "release PHP 7.4 downgraded version" || echo "No changes to commit" | ||
| git tag "${GITHUB_REF#refs/tags/}.74" | ||
| git push origin "${GITHUB_REF#refs/tags/}.74" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,16 +27,8 @@ jobs: | |
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| php-version: | ||
| - "7.4" | ||
| - "8.0" | ||
| - "8.1" | ||
| - "8.2" | ||
| - "8.3" | ||
| - "8.4" | ||
| dependencies: | ||
| - lowest | ||
| - highest | ||
| php-version: ["8.1", "8.2", "8.3", "8.4"] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Warum nicht mehr auf PHP 8.0 testen? |
||
| dependencies: [lowest, highest] | ||
|
Comment on lines
+30
to
+31
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Die bisherige Syntax ist schon ok, bitte generell so lassen und Diff minimieren. |
||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
@@ -47,19 +39,6 @@ jobs: | |
| extensions: mbstring | ||
| php-version: "${{ matrix.php-version }}" | ||
|
|
||
| - if: matrix.php-version == '7.4' | ||
| run: > | ||
| composer remove --dev --no-update | ||
| rector/rector | ||
| mll-lab/graphql-php-scalars | ||
| spaze/phpstan-disallowed-calls | ||
|
|
||
| - if: matrix.php-version == '8.0' | ||
| run: composer remove --dev --no-update rector/rector | ||
|
|
||
| - if: matrix.php-version == '7.4' || matrix.php-version == '8.0' | ||
| run: rm -rf src/Enum tests/Enum src/FluidXPlate/Scalars src/Microplate/Scalars tests/FluidXPlate/Scalars tests/Microplate/Scalars | ||
|
|
||
| - uses: ramsey/composer-install@v3 | ||
| with: | ||
| dependency-versions: "${{ matrix.dependencies }}" | ||
|
|
@@ -74,16 +53,8 @@ jobs: | |
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| php-version: | ||
| - "7.4" | ||
| - "8.0" | ||
| - "8.1" | ||
| - "8.2" | ||
| - "8.3" | ||
| - "8.4" | ||
| dependencies: | ||
| - lowest | ||
| - highest | ||
| php-version: ["8.1", "8.2", "8.3", "8.4"] | ||
| dependencies: [lowest, highest] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
@@ -94,19 +65,6 @@ jobs: | |
| extensions: mbstring | ||
| php-version: "${{ matrix.php-version }}" | ||
|
|
||
| - if: matrix.php-version == '7.4' | ||
| run: > | ||
| composer remove --dev --no-update | ||
| rector/rector | ||
| mll-lab/graphql-php-scalars | ||
| spaze/phpstan-disallowed-calls | ||
|
|
||
| - if: matrix.php-version == '8.0' | ||
| run: composer remove --dev --no-update rector/rector | ||
|
|
||
| - if: matrix.php-version == '7.4' || matrix.php-version == '8.0' | ||
| run: rm -rf src/Enum tests/Enum src/FluidXPlate/Scalars src/Microplate/Scalars tests/FluidXPlate/Scalars tests/Microplate/Scalars | ||
|
|
||
| - uses: ramsey/composer-install@v3 | ||
| with: | ||
| dependency-versions: "${{ matrix.dependencies }}" | ||
|
|
@@ -131,3 +89,56 @@ jobs: | |
|
|
||
| # Not using v4 due to the breaking changes described in https://github.com/codecov/codecov-action/releases/tag/v4.0.0 | ||
| - uses: codecov/codecov-action@v3 | ||
|
|
||
| downgraded-build-validate: | ||
| name: "Downgraded Build Validate (PHP 7.4, ${{ matrix.dependencies }})" | ||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| dependencies: [lowest, highest] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: "Setup PHP 8.3 (Rector)" | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: 8.3 | ||
| coverage: none | ||
|
|
||
| - uses: ramsey/composer-install@v3 | ||
|
|
||
| - name: "Downgrade src and tests" | ||
| run: | | ||
| vendor/bin/rector process src tests --config build/rector-downgrade-php-74.php --ansi | ||
|
|
||
| - name: "Prepare downgraded composer.json" | ||
| run: | | ||
| cp build/composer-php-74.json composer.json | ||
| rm -f composer.lock | ||
|
|
||
| - name: "Remove tests incompatible with PHP 7.4" | ||
| run: | | ||
| rm -rf tests/PHPStan # Requires PHPStan testing framework | ||
| rm -rf tests/Enum # PHP 8.1+ enums cannot be downgraded | ||
| rm -rf tests/FluidXPlate # Requires graphql-php-scalars (optional) | ||
| rm -rf tests/Qiaxcel # Requires phpspreadsheet (optional) | ||
| rm -rf tests/LightcyclerExportSheet # Uses Collection::firstOrFail (Laravel 9+) | ||
|
Comment on lines
+124
to
+128
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Entweder alle alignen oder keine. Bin für keine, also nur ein Leerzeichen vor dem |
||
|
|
||
| - name: "Setup PHP 7.4" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ist für mich sowas wie ein redundanter Kommentar, weg damit |
||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: 7.4 | ||
| coverage: none | ||
|
|
||
| - name: "Install downgraded dependencies" | ||
| run: | | ||
| composer update --no-interaction --prefer-dist ${{ matrix.dependencies == 'lowest' && '--prefer-lowest --prefer-stable' || '' }} | ||
|
|
||
| - name: "Validate downgraded composer.json" | ||
| run: composer validate --no-check-publish | ||
|
|
||
| - name: "Run PHPUnit on downgraded src" | ||
| run: vendor/bin/phpunit | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wir schreiben den Changelog inzwischen nicht mehr von Hand, sondern lassen diesen per Semantic Release erstellen. Daher muss die Commit-Nachricht so vorbereitet werden dass sie die Breaking Changes erfasst. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,22 @@ | ||
| ## v6.0.0 | ||
|
|
||
| ### Changed | ||
|
|
||
| - Require PHP ^8.1 for the main package | ||
| - Use PHP 8.1 features: `readonly` properties, union type syntax | ||
|
|
||
| ### Added | ||
|
|
||
| - Automatic PHP 7.4 downgraded releases via `.74` tag suffix (e.g., `v6.0.0.74`) | ||
| - GitHub Actions workflow for automated downgrade releases | ||
|
|
||
| ### Migration | ||
|
|
||
| Users on PHP 7.4 or 8.0 should use the `.74` tagged releases: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aha! Also sollte wohl auch PHP 8 darauf getestet werden. Sehe ich auch in der Zukunft als für uns relevant, wegen diesem einen Legacy-Projekt das nicht genannt werden darf und wohl schrittweise updated würde. |
||
| ```sh | ||
| composer require mll-lab/php-utils:v6.0.0.74 | ||
| ``` | ||
|
|
||
| # [5.23.0](https://github.com/mll-lab/php-utils/compare/v5.22.0...v5.23.0) (2025-12-08) | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,16 @@ Install through composer | |
| composer require mll-lab/php-utils | ||
| ``` | ||
|
|
||
| ### PHP 7.4 / 8.0 Support | ||
|
|
||
| The main package requires PHP ^8.1. For PHP 7.4 or 8.0, use the automatically generated `.74` releases: | ||
|
|
||
| ```sh | ||
| composer require mll-lab/php-utils:v6.0.0.74 | ||
| ``` | ||
|
|
||
| These releases are automatically downgraded using [Rector](https://getrector.org) and published alongside each main release. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gibt es dafür von Rector Docs? |
||
|
|
||
| ## Usage | ||
|
|
||
| See [tests](tests). | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| { | ||
| "name": "mll-lab/php-utils", | ||
| "description": "Shared PHP utility functions of MLL", | ||
| "license": "MIT", | ||
| "type": "library", | ||
| "authors": [ | ||
| { | ||
| "name": "Benedikt Franke", | ||
| "email": "benedikt@franke.tech" | ||
| } | ||
| ], | ||
| "homepage": "https://github.com/mll-lab/php-utils", | ||
| "support": { | ||
| "issues": "https://github.com/mll-lab/php-utils/issues", | ||
| "source": "https://github.com/mll-lab/php-utils" | ||
| }, | ||
| "require": { | ||
| "php": "^7.4 || ^8.0", | ||
| "ext-calendar": "*", | ||
| "ext-simplexml": "*", | ||
| "illuminate/support": "^8.77 || ^9 || ^10", | ||
| "mll-lab/str_putcsv": "^1", | ||
| "nesbot/carbon": "^2.62.1", | ||
| "ramsey/uuid": "^3 || ^4", | ||
| "thecodingmachine/safe": "^1 || ^2" | ||
| }, | ||
| "require-dev": { | ||
| "phpunit/phpunit": "^9.6" | ||
| }, | ||
| "suggest": { | ||
| "mll-lab/graphql-php-scalars": "To use the provided scalar types for GraphQL servers, requires version ^6.3", | ||
| "phpoffice/phpspreadsheet": "Required if using QiaxcelImport", | ||
| "spaze/phpstan-disallowed-calls": "Required when using the PHPStan configuration from rules.neon directly or through the extension installer" | ||
| }, | ||
| "autoload": { | ||
| "psr-4": { | ||
| "MLL\\Utils\\": "src/" | ||
| } | ||
| }, | ||
| "autoload-dev": { | ||
| "psr-4": { | ||
| "MLL\\Utils\\Tests\\": "tests/" | ||
| } | ||
| }, | ||
| "config": { | ||
| "audit": { | ||
| "ignore": [ | ||
| "PKSA-8qx3-n5y5-vvnd" | ||
| ], | ||
| "abandoned": "ignore" | ||
| }, | ||
| "block-insecure": false, | ||
| "sort-packages": true | ||
| }, | ||
| "extra": { | ||
| "phpstan": { | ||
| "includes": [ | ||
| "extension.neon", | ||
| "rules.neon" | ||
| ] | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <?php declare(strict_types=1); | ||
|
|
||
| use Rector\Config\RectorConfig; | ||
| use Rector\DowngradePhp80\Rector\Class_\DowngradeAttributeToAnnotationRector; | ||
| use Rector\DowngradePhp80\ValueObject\DowngradeAttributeToAnnotation; | ||
|
|
||
| return RectorConfig::configure() | ||
| ->withDowngradeSets(php74: true) | ||
| ->withConfiguredRule(DowngradeAttributeToAnnotationRector::class, [ | ||
| new DowngradeAttributeToAnnotation( | ||
| 'PHPUnit\Framework\Attributes\DataProvider', | ||
| 'dataProvider' | ||
| ), | ||
| ]); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ public function reverse(): string | |
| $parts = mb_str_split($this->sequence); // @phpstan-ignore-line theCodingMachineSafe.function (safe from PHP 8.0) | ||
| $reversedParts = array_reverse($parts); | ||
|
|
||
| return implode($reversedParts); | ||
| return implode('', $reversedParts); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Diese Änderung können wir gleich machen, oder? |
||
| } | ||
|
|
||
| public function complement(): string | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bitte Lärm-Kommentare wegräumen.