Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 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
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
35 changes: 35 additions & 0 deletions .github/workflows/downgraded_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Downgraded Release

on:
push:
tags:
- '*'

jobs:
downgrade_release:
if: ${{ !endsWith(github.ref_name, '.74') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none
- uses: ramsey/composer-install@v2
# Downgrade /src to PHP 7.4
- run: vendor/bin/rector process src --config build/rector-downgrade-php-74.php --ansi
# Optional: Fix coding style (falls ECS genutzt wird)
# - run: vendor/bin/ecs check src --fix --ansi
# Kopiere PHP 7.4 composer.json
- run: cp build/composer-php-74.json composer.json
# Entferne Dev-Dateien
- run: rm -rf build .github tests stubs ecs.php phpstan.neon phpunit.xml
# Tagge und pushe downgradeten 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"
60 changes: 34 additions & 26 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:
# Not including 7.4, as PHPStan is hard to get working there
- "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 @@ -50,7 +42,6 @@ jobs:
- uses: ramsey/composer-install@v3
with:
dependency-versions: "${{ matrix.dependencies }}"

- run: vendor/bin/phpstan analyse --configuration=phpstan.neon

tests:
Expand All @@ -61,16 +52,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 @@ -81,13 +64,9 @@ jobs:
extensions: mbstring
php-version: "${{ matrix.php-version }}"

- if: "! startsWith(matrix.php-version, 8)"
run: composer remove --dev --no-update rector/rector mll-lab/graphql-php-scalars spaze/phpstan-disallowed-calls

- uses: ramsey/composer-install@v3
with:
dependency-versions: "${{ matrix.dependencies }}"

- run: vendor/bin/phpunit

code-coverage:
Expand All @@ -103,8 +82,37 @@ jobs:
php-version: 8.3

- uses: ramsey/composer-install@v3

- run: vendor/bin/phpunit --coverage-clover=.build/logs/clover.xml

# 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)"
runs-on: ubuntu-latest
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: "Setup PHP 7.4"
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
coverage: none
- name: "Install downgraded dependencies"
run: composer install --no-interaction --prefer-dist
- name: "Validate downgraded composer.json"
run: composer validate --no-check-publish
- name: "Run PHPUnit on downgraded src"
run: vendor/bin/phpunit
43 changes: 43 additions & 0 deletions build/composer-php-74.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "mll-lab/php-utils",
"description": "Shared PHP utility functions of MLL (downgraded build)",
"license": "MIT",
"type": "library",
"require": {
"php": "^7.4",
"ext-calendar": "*",
"ext-simplexml": "*",
"illuminate/support": "^8.73",
"mll-lab/str_putcsv": "^1",
"nesbot/carbon": "^2.62.1",
"ramsey/uuid": "^3 || ^4.2.2",
"thecodingmachine/safe": "^1"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.45",
"larastan/larastan": "^1",
"mll-lab/php-cs-fixer-config": "^5.10",
"orchestra/testbench": "^6.47.1",
"phpunit/phpunit": "^9.6.22",
"rector/rector": "^1.2",
"thecodingmachine/phpstan-safe-rule": "^1.2.0"
},
"autoload": {
"psr-4": {
"MLL\\Utils\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"MLL\\Utils\\Tests\\": "tests/"
}
},
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true,
"infection/extension-installer": true,
"ocramius/package-versions": true
},
"sort-packages": true
}
}
6 changes: 6 additions & 0 deletions build/rector-downgrade-php-74.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php declare(strict_types=1);

use Rector\Config\RectorConfig;

return RectorConfig::configure()
->withDowngradeSets(php74: true);
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"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",
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
SetList::CODE_QUALITY,
SetList::TYPE_DECLARATION,
SetList::RECTOR_PRESET,
SetList::PHP_81,
PHPUnitSetList::PHPUNIT_40,
PHPUnitSetList::PHPUNIT_50,
PHPUnitSetList::PHPUNIT_60,
Expand All @@ -19,7 +20,6 @@
PHPUnitSetList::PHPUNIT_110,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
])
->withPhpSets()
->withRules([
Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitSelfCallRector::class,
])
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)
}
}
4 changes: 2 additions & 2 deletions src/IlluminaSampleSheet/V1/ReadsSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

class ReadsSection implements Section
{
private int $read1Cycles;
private readonly int $read1Cycles;

private int $read2Cycles;
private readonly int $read2Cycles;

public function __construct(int $read1Cycles, int $read2Cycles)
{
Expand Down
4 changes: 2 additions & 2 deletions src/IlluminaSampleSheet/V1/SettingsSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

class SettingsSection implements Section
{
private ?string $adapter;
private readonly ?string $adapter;

private ?string $adapterRead2;
private readonly ?string $adapterRead2;

public function __construct(?string $adapter = null, ?string $adapterRead2 = null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/IlluminaSampleSheet/V2/BclConvert/OverrideCycles.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class OverrideCycles

public ?OverrideCycle $read2;

private DataSection $dataSection;
private readonly DataSection $dataSection;

public function __construct(DataSection $dataSection, string $read1, string $index1, ?string $index2, ?string $read2)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Microplate/FullColumnSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ private function growSection(): void
}
}

/** @return false|int */
private function nextReservedWell()
private function nextReservedWell(): int|false
{
$search = $this->sectionItems->search(AbstractMicroplate::EMPTY_WELL);
assert($search === false || is_int($search)); // @phpstan-ignore-line function.alreadyNarrowedType (not yet supported by PHPStan of older versions)
Expand Down
4 changes: 1 addition & 3 deletions src/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ class Number
* @param float|int $min
* @param float|int $max
* @param float|int $current
*
* @return float|int
*/
public static function clamp($min, $max, $current)
public static function clamp($min, $max, $current): float|int
{
return max($min, min($max, $current));
}
Expand Down
2 changes: 1 addition & 1 deletion src/PHPStan/Rules/NoAssignmentInIfRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
class NoAssignmentInIfRule implements Rule
{
private NodeFinder $nodeFinder;
private readonly NodeFinder $nodeFinder;

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/PHPStan/Rules/ThrowableClassNameRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/** @implements Rule<Class_> */
class ThrowableClassNameRule implements Rule
{
private ReflectionProvider $reflectionProvider;
private readonly ReflectionProvider $reflectionProvider;

public function __construct(
ReflectionProvider $reflectionProvider
Expand Down
32 changes: 16 additions & 16 deletions src/QxManager/FilledRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,37 @@

class FilledRow
{
private string $experimentType;
private readonly string $experimentType;

private string $supermixName;
private readonly string $supermixName;

private string $assayType;
private readonly string $assayType;

private string $targetType;
private readonly string $targetType;

private string $plot;
private readonly string $plot;

private string $targetName;
private readonly string $targetName;

private string $signalCh1;
private readonly string $signalCh1;

private string $signalCh2;
private readonly string $signalCh2;

private string $sampleDescription1;
private readonly string $sampleDescription1;

private ?string $sampleDescription2;
private readonly ?string $sampleDescription2;

private ?string $sampleDescription3;
private readonly ?string $sampleDescription3;

private ?string $sampleDescription4;
private readonly ?string $sampleDescription4;

private string $sampleType;
private readonly string $sampleType;

private ?int $referenceCopies;
private readonly ?int $referenceCopies;

private ?string $wellNotes;
private readonly ?string $wellNotes;

private ?string $rdqConversionFactor;
private readonly ?string $rdqConversionFactor;

public function __construct(
string $sampleDescription1,
Expand Down
4 changes: 2 additions & 2 deletions src/QxManager/FilledWell.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

class FilledWell
{
private FilledRow $famRow;
private readonly FilledRow $famRow;

private FilledRow $hexRow;
private readonly FilledRow $hexRow;

public function __construct(FilledRow $famRow, FilledRow $hexRow)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Tecan/BasicCommands/AspirateAndDispenseParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

class AspirateAndDispenseParameters
{
private Rack $rack;
private readonly Rack $rack;

private int $startPosition;
private readonly int $startPosition;

private int $endPosition;
private readonly int $endPosition;

public function __construct(Rack $rack, int $startPosition, int $endPosition)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Tecan/BasicCommands/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class Comment extends Command
{
private string $comment;
private readonly string $comment;

public function __construct(string $comment)
{
Expand Down
Loading