Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
53a7646
feat: update PHP version requirements and add downgrade workflow
simbig Aug 22, 2025
36a4b1a
feat: enable PHP 8.1 features with backward compatibility by adding r…
Aug 22, 2025
2e999f7
feat: update composer dependencies for PHP 7.4 compatibility and remo…
Aug 22, 2025
1c3dbc7
feat: update validate.yml to improve downgrade workflow and dependenc…
Aug 22, 2025
8fc50d7
feat: add development dependencies for PHP 7.4 compatibility and test…
Aug 22, 2025
c5e60ce
feat: add configuration for plugins and package sorting in composer-p…
Aug 22, 2025
08a3bff
feat: update validate.yml to remove composer.lock during downgrade ar…
Aug 22, 2025
b07e67f
feat: enhance validate.yml for PHP 7.4 compatibility and improved dow…
Aug 22, 2025
9b0b79e
feat: refine development dependencies in composer-php-74.json for PHP…
Aug 22, 2025
29af9de
feat: update ramsey/uuid version constraint for PHP 8.1 compatibility
Aug 22, 2025
ba55f22
feat: update larastan and rector version constraints for PHP 8.1 comp…
Aug 22, 2025
907a84f
feat: add artifact upload and download steps for PHP 7.4 downgrade va…
Aug 22, 2025
023fd9b
feat: upgrade artifact actions to v4 for improved functionality
Aug 22, 2025
9daba43
feat: enhance downgraded build validation for PHP 7.4 compatibility
Aug 22, 2025
998dc5f
feat: update PHPStan configuration for PHP 7.4 compatibility
Aug 22, 2025
4c2ccde
feat: reintroduce PHPStan analysis for downgraded source with updated…
Aug 22, 2025
b07e881
feat: add PSR-4 autoloading for test classes in development environment
Aug 22, 2025
9277b3a
feat: simplify validation process and remove unused PHPStan dependenc…
Aug 22, 2025
7676ae7
feat: remove deprecated exclusions from PHPStan configuration for imp…
Aug 22, 2025
dbddd01
feat: update PHP version in validation configuration to 8.3 for impro…
Aug 22, 2025
de4665d
feat: remove Composer caching steps from validation workflow for stre…
Aug 22, 2025
7726a41
improve PHP 8.1 downgrade implementation
Dec 12, 2025
3fedad0
Merge branch 'master' into 43-enable-php-81-features-with-backward-co…
Dec 12, 2025
c16a9ee
add lowest/highest dependency matrix for PHP 7.4 tests
Dec 12, 2025
0925c4a
fix(ci): correct composer update command for dependency matrix
Dec 12, 2025
27cd35b
fix(ci): add phpunit to PHP 7.4 downgraded composer.json
Dec 12, 2025
d305ed3
fix(ci): fix PHP 7.4 composer dependencies
Dec 12, 2025
8c1af1a
fix(ci): exclude PHPStan tests from PHP 7.4 downgrade validation
Dec 12, 2025
f2d04b6
fix(ci): exclude more PHP 7.4 incompatible tests
Dec 12, 2025
50cf03e
chore(deps): bump illuminate/support minimum to ^8.77
Dec 12, 2025
0415272
fix(ci): exclude LightcyclerExportSheet tests from PHP 7.4
Dec 12, 2025
a143a9a
refactor: apply constructor property promotion for multiple classes
Dec 15, 2025
e7f820e
fix(ci): restore @dataProvider annotations for PHPUnit 9.x compatibility
Dec 15, 2025
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
43 changes: 43 additions & 0 deletions .github/workflows/downgraded_release.yaml
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
Copy link
Member

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.

- 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"
103 changes: 57 additions & 46 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Copy link
Member

Choose a reason for hiding this comment

The 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
Copy link
Member

Choose a reason for hiding this comment

The 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
Expand All @@ -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 }}"
Expand All @@ -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
Expand All @@ -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 }}"
Expand All @@ -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
Copy link
Member

Choose a reason for hiding this comment

The 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"
Copy link
Member

Choose a reason for hiding this comment

The 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
19 changes: 19 additions & 0 deletions CHANGELOG.md
Copy link
Member

Choose a reason for hiding this comment

The 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:
Copy link
Member

Choose a reason for hiding this comment

The 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)


Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gibt es dafür von Rector Docs?


## Usage

See [tests](tests).
Expand Down
63 changes: 63 additions & 0 deletions build/composer-php-74.json
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"
]
}
}
}
14 changes: 14 additions & 0 deletions build/rector-downgrade-php-74.php
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'
),
]);
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"source": "https://github.com/mll-lab/php-utils"
},
"require": {
"php": "^7.4 || ^8",
"php": "^8.1",
"ext-calendar": "*",
"ext-simplexml": "*",
"illuminate/support": "^8.73 || ^9 || ^10 || ^11 || ^12",
"illuminate/support": "^8.77 || ^9 || ^10 || ^11 || ^12",
"mll-lab/str_putcsv": "^1",
"nesbot/carbon": "^2.62.1 || ^3",
"ramsey/uuid": "^3 || ^4",
Expand Down
6 changes: 5 additions & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
SetList::CODE_QUALITY,
SetList::TYPE_DECLARATION,
SetList::RECTOR_PRESET,
SetList::PHP_80,
SetList::PHP_81,
PHPUnitSetList::PHPUNIT_40,
PHPUnitSetList::PHPUNIT_50,
PHPUnitSetList::PHPUNIT_60,
Expand All @@ -19,7 +21,6 @@
PHPUnitSetList::PHPUNIT_110,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
])
->withPhpSets()
->withRules([
Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitSelfCallRector::class,
])
Expand All @@ -28,6 +29,9 @@
Rector\CodeQuality\Rector\Concat\JoinStringConcatRector::class => [
__DIR__ . '/tests/CSVArrayTest.php', // keep `\r\n` for readability
],
Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector::class => [
__DIR__ . '/src/IlluminaSampleSheet/V2/BclConvert/BclSample.php', // currently relies on `get_object_vars()` and breaks behaviour.
],
])
->withPaths([__DIR__ . '/src', __DIR__ . '/tests'])
->withBootstrapFiles([
Expand Down
2 changes: 1 addition & 1 deletion src/DnaSequence.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diese Änderung können wir gleich machen, oder?

}

public function complement(): string
Expand Down
6 changes: 3 additions & 3 deletions src/FluidXPlate/FluidXPlate.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class FluidXPlate
public string $rackID;

/** @var Microplate<string, CoordinateSystem12x8> */
private Microplate $microplate;
private readonly Microplate $microplate;

public function __construct(string $rackID)
{
Expand Down Expand Up @@ -51,7 +51,7 @@ public function addToNextFreeWell(string $content, FlowDirection $flowDirection)
/** @return Collection<string, string|null> */
public function wells(): Collection
{
return $this->microplate->wells();
return $this->microplate->wells(); // @phpstan-ignore return.type (generic not inferred)
}

/** @return Collection<string, null> */
Expand All @@ -63,6 +63,6 @@ public function freeWells(): Collection
/** @return Collection<string, string> */
public function filledWells(): Collection
{
return $this->microplate->filledWells();
return $this->microplate->filledWells(); // @phpstan-ignore return.type (generic not inferred)
}
}
Loading