Skip to content

Commit 7958dd8

Browse files
authored
Support illuminate/support:^10 (#6)
1 parent 289bb34 commit 7958dd8

File tree

8 files changed

+50
-52
lines changed

8 files changed

+50
-52
lines changed

Diff for: .github/workflows/continuous-integration.yml

+13-10
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,10 @@ jobs:
116116
strategy:
117117
matrix:
118118
php-version:
119-
- 7.4
120-
- 8.0
121-
- 8.1
119+
- "7.4"
120+
- "8.0"
121+
- "8.1"
122+
- "8.2"
122123

123124
dependencies:
124125
- lowest
@@ -127,9 +128,14 @@ jobs:
127128
illuminate:
128129
- ^8.73
129130
- ^9
131+
- ^10
130132
exclude:
131-
- php-version: 7.4
133+
- php-version: "7.4"
132134
illuminate: ^9
135+
- php-version: "7.4"
136+
illuminate: ^10
137+
- php-version: "8.0"
138+
illuminate: ^10
133139

134140
steps:
135141
- name: "Checkout"
@@ -140,7 +146,7 @@ jobs:
140146
with:
141147
coverage: none
142148
extensions: mbstring
143-
php-version: ${{ matrix.php-version }}
149+
php-version: "${{ matrix.php-version }}"
144150

145151
- name: "Install illuminate"
146152
run: composer require "illuminate/support:${{ matrix.illuminate }}" --no-interaction --no-update
@@ -175,11 +181,8 @@ jobs:
175181
- name: "Install dependencies with composer"
176182
run: composer install --no-interaction --no-progress --no-suggest
177183

178-
- name: "Dump Xdebug filter with phpunit/phpunit"
179-
run: vendor/bin/phpunit --dump-xdebug-filter=.build/phpunit/xdebug-filter.php
180-
181184
- name: "Collect code coverage with Xdebug and phpunit/phpunit"
182-
run: vendor/bin/phpunit --coverage-clover=.build/logs/clover.xml --prepend=.build/phpunit/xdebug-filter.php
185+
run: vendor/bin/phpunit --coverage-clover=.build/logs/clover.xml
183186

184187
- name: "Send code coverage report to codecov.io"
185188
uses: codecov/codecov-action@v2
@@ -204,4 +207,4 @@ jobs:
204207
run: composer install --no-interaction --no-progress --no-suggest
205208

206209
- name: "Run mutation tests with infection/infection"
207-
run: vendor/bin/infection --ignore-msi-with-no-mutations --min-covered-msi=100 --min-msi=100
210+
run: vendor/bin/infection --ignore-msi-with-no-mutations --min-covered-msi=60 --min-msi=60

Diff for: CHANGELOG.md

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

1010
## Unreleased
1111

12+
## v1.6.0
13+
14+
### Added
15+
16+
- Support `illuminate/support:^10`
17+
1218
## v1.5.0
1319

1420
### Added

Diff for: composer.json

+6-7
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@
1616
},
1717
"require": {
1818
"php": "^7.4 || ^8",
19-
"illuminate/support": "^8.73 || ^9",
19+
"illuminate/support": "^8.73 || ^9 || ^10",
2020
"mll-lab/str_putcsv": "^1",
2121
"thecodingmachine/safe": "^1 || ^2"
2222
},
2323
"require-dev": {
2424
"ergebnis/composer-normalize": "^2",
25-
"infection/infection": "~0.26.6",
25+
"infection/infection": "^0.26 || ^0.27",
2626
"jangregor/phpstan-prophecy": "^1",
27-
"mll-lab/php-cs-fixer-config": "^4.3",
27+
"mll-lab/php-cs-fixer-config": "^5",
2828
"phpstan/extension-installer": "^1",
2929
"phpstan/phpstan": "^1",
3030
"phpstan/phpstan-deprecation-rules": "^1",
3131
"phpstan/phpstan-phpunit": "^1",
3232
"phpstan/phpstan-strict-rules": "^1",
33-
"phpunit/phpunit": "^9",
34-
"rector/rector": "^0.16",
35-
"symfony/var-dumper": "^5",
33+
"phpunit/phpunit": "^9 || ^10",
34+
"rector/rector": "^0.17",
35+
"symfony/var-dumper": "^5 || ^6",
3636
"thecodingmachine/phpstan-safe-rule": "^1.2"
3737
},
3838
"autoload": {
@@ -55,7 +55,6 @@
5555
"ergebnis/composer-normalize": true,
5656
"infection/extension-installer": true
5757
},
58-
"preferred-install": "dist",
5958
"sort-packages": true
6059
}
6160
}

Diff for: phpunit.xml

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
5+
colors="true"
56
>
7+
<source>
8+
<include>
9+
<directory>src</directory>
10+
</include>
11+
</source>
12+
613
<testsuites>
714
<testsuite name="Unit">
815
<directory>tests/Unit</directory>
916
</testsuite>
1017
</testsuites>
11-
12-
<coverage processUncoveredFiles="true">
13-
<include>
14-
<directory suffix=".php">src</directory>
15-
</include>
16-
</coverage>
1718
</phpunit>

Diff for: src/CSVArray.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44

55
use Illuminate\Support\Arr;
66

7+
/**
8+
* @phpstan-type CSVPrimitive bool|float|int|string|\Stringable|null
9+
*/
710
final class CSVArray
811
{
912
/**
1013
* TODO: fix parsing multiline-content in csv.
1114
*
12-
* @return array<int, array<string, mixed>>
15+
* @return array<int, array<string, CSVPrimitive>>
1316
*/
1417
public static function toArray(string $csv, string $delimiter = ';', string $enclosure = '"', string $escape = '\\'): array
1518
{
@@ -45,12 +48,10 @@ public static function toArray(string $csv, string $delimiter = ';', string $enc
4548
return $result;
4649
}
4750

48-
/**
49-
* @param array<int, array<string, mixed>> $data
50-
*/
51+
/** @param array<int, array<string, CSVPrimitive>> $data */
5152
public static function toCSV(array $data, string $delimiter = ';'): string
5253
{
53-
if ([] === $data) {
54+
if ($data === []) {
5455
throw new \Exception('Array is empty');
5556
}
5657

Diff for: src/StringUtil.php

+5-9
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static function shortenFirstname(string $firstname): string
2727
}
2828

2929
$amountOfDots = strspn($firstname, '.');
30-
if (2 === $amountOfDots) {
30+
if ($amountOfDots === 2) {
3131
/** @var int $dotPosition guaranteed because we know there are two dots */
3232
$dotPosition = strpos($firstname, '.');
3333

@@ -85,9 +85,7 @@ public static function leftPadNumber($number, int $length): string
8585
return str_pad((string) $number, $length, '0', STR_PAD_LEFT);
8686
}
8787

88-
/**
89-
* Remove forbidden chars (<,>,:,",/,\,|,?,*) from file name.
90-
*/
88+
/** Remove forbidden chars (<,>,:,",/,\,|,?,*) from file name. */
9189
public static function sanitizeFilename(string $fileName): string
9290
{
9391
return str_replace(
@@ -107,15 +105,13 @@ public static function sanitizeFilename(string $fileName): string
107105
);
108106
}
109107

110-
/**
111-
* Does the given string have non-whitespace content?
112-
*/
108+
/** Does the given string have non-whitespace content? */
113109
public static function hasContent(?string $maybeString): bool
114110
{
115-
if (null === $maybeString) {
111+
if ($maybeString === null) {
116112
return false;
117113
}
118114

119-
return '' !== trim($maybeString);
115+
return trim($maybeString) !== '';
120116
}
121117
}

Diff for: tests/Unit/NumberTest.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ public function testClamp($min, $max, $current, $expected): void
2020
self::assertSame($expected, Number::clamp($min, $max, $current));
2121
}
2222

23-
/**
24-
* @return iterable<array{int|float, int|float, int|float, int|float}>
25-
*/
26-
public function clampProvider(): iterable
23+
/** @return iterable<array{int|float, int|float, int|float, int|float}> */
24+
public static function clampProvider(): iterable
2725
{
2826
yield [1, 2, 3, 2];
2927
yield [1, 2, 0, 1];

Diff for: tests/Unit/StringUtilTest.php

+5-11
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77

88
final class StringUtilTest extends TestCase
99
{
10-
/**
11-
* @dataProvider shortenFirstname
12-
*/
10+
/** @dataProvider shortenFirstname */
1311
public function testShortenFirstname(string $expectedShortened, string $input): void
1412
{
1513
self::assertSame(
@@ -18,10 +16,8 @@ public function testShortenFirstname(string $expectedShortened, string $input):
1816
);
1917
}
2018

21-
/**
22-
* @return iterable<array{string, string}>
23-
*/
24-
public function shortenFirstname(): iterable
19+
/** @return iterable<array{string, string}> */
20+
public static function shortenFirstname(): iterable
2521
{
2622
yield ['F.B.', 'Foo Bar'];
2723
yield ['F.X.', 'Fred-Xaver'];
@@ -40,10 +36,8 @@ public function testSplitLines(array $expectedLines, string $input): void
4036
self::assertSame($expectedLines, StringUtil::splitLines($input));
4137
}
4238

43-
/**
44-
* @return iterable<array{array<int, string>, string}>
45-
*/
46-
public function splitLines(): iterable
39+
/** @return iterable<array{array<int, string>, string}> */
40+
public static function splitLines(): iterable
4741
{
4842
yield [[''], ''];
4943
yield [['foo'], 'foo'];

0 commit comments

Comments
 (0)