Skip to content

Commit a16aea3

Browse files
committed
Update CI
1 parent f1949bc commit a16aea3

File tree

8 files changed

+48
-71
lines changed

8 files changed

+48
-71
lines changed

.github/workflows/continuous-integration.yml

+7-20
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ on:
66
pull_request:
77
paths-ignore: ["**.md"]
88

9-
env:
10-
COMPOSER_FLAGS: --ansi --no-interaction --no-progress --prefer-dist
9+
permissions:
10+
contents: read
1111

1212
jobs:
1313
tests:
@@ -40,29 +40,16 @@ jobs:
4040
experimental: true
4141

4242
steps:
43-
- name: Checkout
44-
uses: actions/checkout@v4
43+
- uses: actions/checkout@v4
4544

46-
- name: Install PHP
47-
uses: shivammathur/setup-php@v2
45+
- uses: shivammathur/setup-php@v2
4846
with:
47+
php-version: "${{ matrix.php-version }}"
4948
coverage: none
50-
php-version: ${{ matrix.php-version }}
5149

52-
- name: Get composer cache directory
53-
id: composercache
54-
shell: bash
55-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
56-
57-
- name: Restore cached dependencies
58-
uses: actions/cache@v4
50+
- uses: ramsey/composer-install@v3
5951
with:
60-
path: ${{ steps.composercache.outputs.dir }}
61-
key: php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
62-
restore-keys: php-${{ matrix.php-version }}-composer-
63-
64-
- name: Install latest dependencies
65-
run: composer update ${{ env.COMPOSER_FLAGS }}
52+
dependency-versions: highest
6653

6754
- name: Run tests
6855
if: ${{ !matrix.experimental }}

.github/workflows/functional.yml

+7-20
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ on:
66
pull_request:
77
paths-ignore: ["**.md"]
88

9-
env:
10-
COMPOSER_FLAGS: --ansi --no-interaction --no-progress --prefer-dist
9+
permissions:
10+
contents: read
1111

1212
jobs:
1313
tests:
@@ -35,29 +35,16 @@ jobs:
3535
experimental: true
3636

3737
steps:
38-
- name: Checkout
39-
uses: actions/checkout@v4
38+
- uses: actions/checkout@v4
4039

41-
- name: Install PHP
42-
uses: shivammathur/setup-php@v2
40+
- uses: shivammathur/setup-php@v2
4341
with:
42+
php-version: "${{ matrix.php-version }}"
4443
coverage: xdebug
45-
php-version: ${{ matrix.php-version }}
4644

47-
- name: Get composer cache directory
48-
id: composercache
49-
shell: bash
50-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
51-
52-
- name: Restore cached dependencies
53-
uses: actions/cache@v4
45+
- uses: ramsey/composer-install@v3
5446
with:
55-
path: ${{ steps.composercache.outputs.dir }}
56-
key: php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
57-
restore-keys: php-${{ matrix.php-version }}-composer-
58-
59-
- name: Install latest dependencies
60-
run: composer update ${{ env.COMPOSER_FLAGS }}
47+
dependency-versions: highest
6148

6249
- name: Run tests
6350
if: ${{ !matrix.experimental }}

.github/workflows/lint.yml

+22-9
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,40 @@ on:
66
pull_request:
77
paths-ignore: ["**.md"]
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
tests:
11-
name: Lint
14+
name: "Lint"
1215

1316
runs-on: ubuntu-latest
1417

1518
strategy:
1619
matrix:
1720
php-version:
1821
- "7.2"
19-
- "latest"
22+
- "nightly"
2023

2124
steps:
22-
- name: Checkout
23-
uses: actions/checkout@v4
25+
- uses: actions/checkout@v4
2426

25-
- name: Install PHP
26-
uses: shivammathur/setup-php@v2
27+
- uses: shivammathur/setup-php@v2
2728
with:
29+
php-version: "${{ matrix.php-version }}"
2830
coverage: none
29-
php-version: ${{ matrix.php-version }}
3031

31-
- name: Lint PHP files
32-
run: "find src/ -type f -name '*.php' -print0 | xargs -0 -L1 -P4 -- php -l -f"
32+
- name: "Lint PHP files"
33+
run: |
34+
hasErrors=0
35+
for f in $(find src/ tests/ -type f -name '*.php' ! -path '*/vendor/*' ! -path '*/Fixtures/*')
36+
do
37+
{ error="$(php -derror_reporting=-1 -ddisplay_errors=1 -l -f $f 2>&1 1>&3 3>&-)"; } 3>&1;
38+
if [ "$error" != "" ]; then
39+
while IFS= read -r line; do echo "::error file=$f::$line"; done <<< "$error"
40+
hasErrors=1
41+
fi
42+
done
43+
if [ $hasErrors -eq 1 ]; then
44+
exit 1
45+
fi

.github/workflows/phpstan.yml

+7-20
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ on:
66
pull_request:
77
paths-ignore: ["**.md"]
88

9-
env:
10-
COMPOSER_FLAGS: --ansi --no-interaction --no-progress --prefer-dist
9+
permissions:
10+
contents: read
1111

1212
jobs:
1313
tests:
@@ -21,29 +21,16 @@ jobs:
2121
- "8.1"
2222

2323
steps:
24-
- name: Checkout
25-
uses: actions/checkout@v4
24+
- uses: actions/checkout@v4
2625

27-
- name: Install PHP
28-
uses: shivammathur/setup-php@v2
26+
- uses: shivammathur/setup-php@v2
2927
with:
28+
php-version: "${{ matrix.php-version }}"
3029
coverage: none
31-
php-version: ${{ matrix.php-version }}
3230

33-
- name: Get composer cache directory
34-
id: composercache
35-
shell: bash
36-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
37-
38-
- name: Restore cached dependencies
39-
uses: actions/cache@v4
31+
- uses: ramsey/composer-install@v3
4032
with:
41-
path: ${{ steps.composercache.outputs.dir }}
42-
key: php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
43-
restore-keys: php-${{ matrix.php-version }}-composer
44-
45-
- name: Install latest dependencies
46-
run: composer update ${{ env.COMPOSER_FLAGS }}
33+
dependency-versions: highest
4734

4835
- name: Run PHPStan
4936
run: vendor/bin/phpstan analyse

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"composer/pcre": "^1 || ^2 || ^3"
2424
},
2525
"require-dev": {
26-
"phpstan/phpstan": "^1.0",
26+
"phpstan/phpstan": "^1.11",
2727
"phpstan/phpstan-strict-rules": "^1.1",
2828
"phpunit/phpunit": "^8.5 || ^9.6 || ^10.5"
2929
},

tests/App/Framework/Logger.php

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public function __construct(Output $output)
2828
/**
2929
* @inheritdoc
3030
* @phpstan-param mixed[] $context
31+
* @param string|\Stringable $message
3132
*/
3233
public function log($level, $message, array $context = array()): void
3334
{

tests/App/Framework/Logs.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ public function __construct(array $outputLines)
3131
foreach ($outputLines as $line) {
3232
$line = trim($line);
3333

34-
if (!(bool) preg_match('/^(.+)\\[(\\d+)\\](.+)$/', $line, $matches)) {
34+
// @phpstan-ignore booleanNot.exprNotBoolean
35+
if (!preg_match('/^(.+)\\[(\\d+)\\](.+)$/', $line, $matches)) {
3536
continue;
3637
}
3738

tests/Helpers/Logger.php

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class Logger extends AbstractLogger
2424
/**
2525
* @inheritdoc
2626
* @phpstan-param mixed[] $context
27+
* @param string|\Stringable $message
2728
*/
2829
public function log($level, $message, array $context = []): void
2930
{

0 commit comments

Comments
 (0)