Skip to content

Commit 104e8d3

Browse files
authored
Update dependencies (#50)
1 parent 7a80530 commit 104e8d3

21 files changed

+138
-88
lines changed

.github/workflows/format.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
extensions: mbstring
2222
php-version: 8.3
2323

24-
- run: composer install --no-interaction --no-progress --no-suggest
24+
- uses: ramsey/composer-install@v3
2525

2626
- run: composer normalize
2727

@@ -43,7 +43,7 @@ jobs:
4343
extensions: mbstring
4444
php-version: 8.3
4545

46-
- run: composer install --no-interaction --no-progress --no-suggest
46+
- uses: ramsey/composer-install@v3
4747

4848
- run: vendor/bin/php-cs-fixer fix --using-cache=no
4949

.github/workflows/validate.yml

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,37 @@ jobs:
2424
static-code-analysis:
2525
runs-on: ubuntu-latest
2626

27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
php-version:
31+
# Not including 7.4, as PHPStan is hard to get working there
32+
- "8.0"
33+
- "8.1"
34+
- "8.2"
35+
- "8.3"
36+
- "8.4"
37+
dependencies:
38+
- lowest
39+
- highest
40+
2741
steps:
2842
- uses: actions/checkout@v4
2943

3044
- uses: shivammathur/setup-php@v2
3145
with:
3246
coverage: none
3347
extensions: mbstring
34-
php-version: 8.3
48+
php-version: "${{ matrix.php-version }}"
3549

36-
- run: composer install --no-interaction --no-progress --no-suggest
50+
- uses: ramsey/composer-install@v3
51+
with:
52+
dependency-versions: "${{ matrix.dependencies }}"
3753

38-
- run: vendor/bin/phpstan analyse
54+
- run: vendor/bin/phpstan analyse --configuration=phpstan.neon
3955

4056
tests:
41-
name: "Tests - PHP ${{ matrix.php-version }}, Illuminate ${{ matrix.illuminate }}, ${{ matrix.dependencies }}"
57+
name: "Tests - PHP ${{ matrix.php-version }}, ${{ matrix.dependencies }}"
4258

4359
runs-on: ubuntu-latest
4460

@@ -51,27 +67,10 @@ jobs:
5167
- "8.1"
5268
- "8.2"
5369
- "8.3"
70+
- "8.4"
5471
dependencies:
5572
- lowest
5673
- highest
57-
illuminate:
58-
- ^8.73
59-
- ^9
60-
- ^10
61-
- ^11
62-
exclude:
63-
- php-version: "7.4"
64-
illuminate: ^9
65-
- php-version: "7.4"
66-
illuminate: ^10
67-
- php-version: "7.4"
68-
illuminate: ^11
69-
- php-version: "8.0"
70-
illuminate: ^10
71-
- php-version: "8.0"
72-
illuminate: ^11
73-
- php-version: "8.1"
74-
illuminate: ^11
7574

7675
steps:
7776
- uses: actions/checkout@v4
@@ -83,15 +82,11 @@ jobs:
8382
php-version: "${{ matrix.php-version }}"
8483

8584
- if: "! startsWith(matrix.php-version, 8)"
86-
run: composer remove --dev --no-update mll-lab/graphql-php-scalars
87-
88-
- run: composer require "illuminate/support:${{ matrix.illuminate }}" --no-interaction --no-update
85+
run: composer remove --dev --no-update rector/rector mll-lab/graphql-php-scalars
8986

90-
- if: matrix.dependencies == 'lowest'
91-
run: composer update --prefer-lowest --no-interaction --no-progress --no-suggest
92-
93-
- if: matrix.dependencies == 'highest'
94-
run: composer update --no-interaction --no-progress --no-suggest
87+
- uses: ramsey/composer-install@v3
88+
with:
89+
dependency-versions: "${{ matrix.dependencies }}"
9590

9691
- run: vendor/bin/phpunit
9792

@@ -107,7 +102,7 @@ jobs:
107102
extensions: mbstring
108103
php-version: 8.3
109104

110-
- run: composer install --no-interaction --no-progress --no-suggest
105+
- uses: ramsey/composer-install@v3
111106

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

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ See [GitHub releases](https://github.com/mll-lab/php-utils/releases).
99

1010
## Unreleased
1111

12+
## v5.13.0
13+
14+
### Added
15+
16+
- Support `illuminate/support` version 12
17+
- Support `thecodingmachine/safe` version 3
18+
- Add error identifiers to custom PHPStan rules
19+
20+
### Changed
21+
22+
- Refine PHPDoc types
23+
1224
## v5.12.1
1325

1426
### Fixed

composer.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,27 @@
1717
"require": {
1818
"php": "^7.4 || ^8",
1919
"ext-calendar": "*",
20-
"illuminate/support": "^8.73 || ^9 || ^10 || ^11",
20+
"illuminate/support": "^8.73 || ^9 || ^10 || ^11 || ^12",
2121
"mll-lab/str_putcsv": "^1",
2222
"nesbot/carbon": "^2.62.1 || ^3",
2323
"ramsey/uuid": "^3 || ^4",
24-
"thecodingmachine/safe": "^1 || ^2"
24+
"thecodingmachine/safe": "^1 || ^2 || ^3"
2525
},
2626
"require-dev": {
27-
"ergebnis/composer-normalize": "^2",
28-
"jangregor/phpstan-prophecy": "^1",
29-
"larastan/larastan": "^1 || ^2",
30-
"mll-lab/graphql-php-scalars": "^6.3",
31-
"mll-lab/php-cs-fixer-config": "^5",
32-
"orchestra/testbench": "^6 || ^7 || ^8 || ^9",
27+
"ergebnis/composer-normalize": "^2.45",
28+
"jangregor/phpstan-prophecy": "^1.0.2 || ^2.1.1",
29+
"larastan/larastan": "^1.0.4 || ^2.9.14 || ^3.1",
30+
"mll-lab/graphql-php-scalars": "^6.4",
31+
"mll-lab/php-cs-fixer-config": "^5.10",
32+
"orchestra/testbench": "^6.47.1 || ^7.52 || ^8.33 || ^9.11 || ^10",
3333
"phpstan/extension-installer": "^1",
34-
"phpstan/phpstan": "^1",
35-
"phpstan/phpstan-deprecation-rules": "^1",
36-
"phpstan/phpstan-phpunit": "^1",
37-
"phpstan/phpstan-strict-rules": "^1",
38-
"phpunit/phpunit": "^9 || ^10 || ^11",
39-
"rector/rector": "^1",
40-
"thecodingmachine/phpstan-safe-rule": "^1.2"
34+
"phpstan/phpstan": "^1.8.11 || ^2.1.6",
35+
"phpstan/phpstan-deprecation-rules": "^1 || ^2.0.1",
36+
"phpstan/phpstan-phpunit": "^1 || ^2.0.4",
37+
"phpstan/phpstan-strict-rules": "^1 || ^2.0.3",
38+
"phpunit/phpunit": "^9.6.22 || ^10.5.45 || ^11.5.10 || ^12.0.5",
39+
"rector/rector": "^1.2.10 || ^2.0.9",
40+
"thecodingmachine/phpstan-safe-rule": "^1.2.0"
4141
},
4242
"suggest": {
4343
"mll-lab/graphql-php-scalars": "To use the provided scalar types for GraphQL servers, requires version ^6.3"

phpstan.neon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ parameters:
77
- tests
88
tmpDir: .build/phpstan
99
# Install https://plugins.jetbrains.com/plugin/7677-awesome-console to make those links clickable
10+
# TODO restore when we can require a newer PHPStan version
1011
editorUrl: '%%relFile%%:%%line%%'
1112
editorUrlTitle: '%%relFile%%:%%line%%'
13+
# As long as we support multiple PHP versions, there will be some dead spots
14+
reportUnmatchedIgnoredErrors: false
1215
ignoreErrors:
1316
# This is a library, so it should be extendable
1417
- '#Unsafe usage of new static.*#'
18+
# Not in older PHPUnit versions
19+
- '#Attribute class PHPUnit\\Framework\\Attributes\\DataProvider does not exist\.#'

rector.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
<?php declare(strict_types=1);
22

3-
use Rector\CodeQuality\Rector\Concat\JoinStringConcatRector;
43
use Rector\Config\RectorConfig;
5-
use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitSelfCallRector;
6-
use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector;
74
use Rector\PHPUnit\Set\PHPUnitSetList;
85
use Rector\Set\ValueObject\SetList;
96

@@ -23,12 +20,15 @@
2320
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
2421
])
2522
->withPhpSets()
26-
->withRules([PreferPHPUnitSelfCallRector::class])
23+
->withRules([
24+
Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitSelfCallRector::class,
25+
])
2726
->withSkip([
28-
PreferPHPUnitThisCallRector::class, // breaks tests
29-
JoinStringConcatRector::class => [
27+
Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector::class, // breaks tests
28+
Rector\CodeQuality\Rector\Concat\JoinStringConcatRector::class => [
3029
__DIR__ . '/tests/CSVArrayTest.php', // keep `\r\n` for readability
3130
],
31+
Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertCountWithZeroToAssertEmptyRector::class, // sloppy
3232
])
3333
->withPaths([__DIR__ . '/src', __DIR__ . '/tests'])
3434
->withBootstrapFiles([

src/DnaSequence.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ public function __construct(string $sequence)
1616

1717
public function reverse(): string
1818
{
19-
return implode(array_reverse(mb_str_split($this->sequence)));
19+
$parts = mb_str_split($this->sequence); // @phpstan-ignore-line theCodingMachineSafe.function (safe from PHP 8.0)
20+
$reversedParts = array_reverse($parts);
21+
22+
return implode($reversedParts);
2023
}
2124

2225
public function complement(): string

src/FluidXPlate/FluidXPlate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct(string $rackID)
2424
throw new InvalidRackIDException($rackID);
2525
}
2626
$this->rackID = $rackID;
27-
$this->microplate = new Microplate(self::coordinateSystem());
27+
$this->microplate = new Microplate(self::coordinateSystem()); // @phpstan-ignore assign.propertyType (generic not inferred)
2828
}
2929

3030
public static function coordinateSystem(): CoordinateSystem12x8

src/IlluminaSampleSheet/V1/DataSection.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ public function convertSectionToString(): string
3737
{
3838
$this->validate();
3939

40-
if ($this->rows->isEmpty()) {
40+
$firstRow = $this->rows->first();
41+
if ($firstRow === null) {
4142
throw new IlluminaSampleSheetException('Data section must contain at least one row.');
4243
}
43-
/** @var Row $firstRow */
44-
$firstRow = $this->rows->first();
4544

4645
$rowsData = $this->rows
4746
->map(fn (Row $row): string => $row->toString())

src/IlluminaSampleSheet/V2/BclConvert/BclSample.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(
4040
/** @return array<int|string> */
4141
public function toArray(): array
4242
{
43-
return array_filter([
43+
return array_filter([ // @phpstan-ignore arrayFilter.strict (we want truthy comparison)
4444
$this->lane,
4545
$this->sample_ID,
4646
$this->index,

0 commit comments

Comments
 (0)