Skip to content

Commit ab4759c

Browse files
authored
Add new PHP versions to build workflow (#1)
1 parent ae67a1b commit ab4759c

File tree

9 files changed

+82
-39
lines changed

9 files changed

+82
-39
lines changed

.github/workflows/build.yml

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
on:
2-
- pull_request
3-
- push
2+
pull_request:
3+
paths-ignore:
4+
- 'docs/**'
5+
- 'README.md'
6+
- 'CHANGELOG.md'
7+
- '.gitignore'
8+
- '.gitattributes'
9+
- 'psalm.xml.dist'
10+
11+
push:
12+
paths-ignore:
13+
- 'docs/**'
14+
- 'README.md'
15+
- 'CHANGELOG.md'
16+
- '.gitignore'
17+
- '.gitattributes'
18+
- 'psalm.xml.dist'
419

520
name: build
621

@@ -22,40 +37,42 @@ jobs:
2237
php:
2338
- "7.4"
2439
- "8.0"
40+
- "8.1"
41+
- "8.2"
2542

2643
steps:
27-
- name: Checkout
28-
uses: actions/checkout@v2
44+
- name: Checkout.
45+
uses: actions/checkout@v3
2946

30-
- name: Install PHP
47+
- name: Install PHP with extensions.
3148
uses: shivammathur/setup-php@v2
3249
with:
3350
php-version: ${{ matrix.php }}
3451
ini-values: date.timezone='UTC'
3552
tools: composer:v2
3653
coverage: pcov
3754

38-
- name: Determine composer cache directory on Linux
55+
- name: Determine composer cache directory on Linux.
3956
if: matrix.os == 'ubuntu-latest'
4057
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
4158

42-
- name: Determine composer cache directory on Windows
59+
- name: Determine composer cache directory on Windows.
4360
if: matrix.os == 'windows-latest'
4461
run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
4562

46-
- name: Cache dependencies installed with composer
47-
uses: actions/cache@v2
63+
- name: Cache dependencies installed with composer.
64+
uses: actions/cache@v3
4865
with:
4966
path: ${{ env.COMPOSER_CACHE_DIR }}
5067
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
5168
restore-keys: |
5269
php${{ matrix.php }}-composer-
5370
54-
- name: Update composer
71+
- name: Update composer.
5572
run: composer self-update
5673

57-
- name: Install dependencies with composer
74+
- name: Install dependencies with composer.
5875
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
5976

60-
- name: Run tests with phpunit
77+
- name: Run tests with phpunit.
6178
run: vendor/bin/phpunit --colors=always

.github/workflows/static.yml

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
on:
2-
- pull_request
3-
- push
2+
pull_request:
3+
paths-ignore:
4+
- 'docs/**'
5+
- 'README.md'
6+
- 'CHANGELOG.md'
7+
- '.gitignore'
8+
- '.gitattributes'
9+
- 'phpunit.xml.dist'
10+
11+
push:
12+
paths-ignore:
13+
- 'docs/**'
14+
- 'README.md'
15+
- 'CHANGELOG.md'
16+
- '.gitignore'
17+
- '.gitattributes'
18+
- 'phpunit.xml.dist'
419

520
name: static
621

@@ -18,37 +33,39 @@ jobs:
1833
php:
1934
- "7.4"
2035
- "8.0"
36+
- "8.1"
37+
- "8.2"
2138

2239
steps:
23-
- name: Checkout
24-
uses: actions/checkout@v2
40+
- name: Checkout.
41+
uses: actions/checkout@v3
2542

26-
- name: Install PHP
43+
- name: Install PHP with extensions.
2744
uses: shivammathur/setup-php@v2
2845
with:
2946
php-version: ${{ matrix.php }}
3047
ini-values: memory_limit=-1
3148
tools: composer:v2
3249

33-
- name: Determine composer cache directory
50+
- name: Determine composer cache directory.
3451
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
3552

36-
- name: Cache dependencies installed with composer
37-
uses: actions/cache@v2
53+
- name: Cache dependencies installed with composer.
54+
uses: actions/cache@v3
3855
with:
3956
path: ${{ env.COMPOSER_CACHE_DIR }}
4057
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
4158
restore-keys: |
4259
php${{ matrix.php }}-composer-
4360
44-
- name: Update composer
61+
- name: Update composer.
4562
run: composer self-update
4663

47-
- name: Install dependencies with composer
64+
- name: Install dependencies with composer.
4865
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
4966

50-
- name: PHPCS check
67+
- name: PHPCS check.
5168
run: vendor/bin/phpcs
5269

53-
- name: Psalm static analysis
70+
- name: Psalm static analysis.
5471
run: vendor/bin/psalm --no-progress

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.phpunit.result.cache
22
composer.lock
33
phpunit.xml
4+
psalm.xml
45
vendor

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"require-dev": {
2828
"httpsoft/http-message": "^1.0",
2929
"phpunit/phpunit": "^9.5",
30-
"squizlabs/php_codesniffer": "^3.6",
31-
"vimeo/psalm": "^4.9"
30+
"squizlabs/php_codesniffer": "^3.7",
31+
"vimeo/psalm": "^4.9|^5.2"
3232
},
3333
"provide": {
3434
"psr/http-message-implementation": "1.0",

phpunit.xml.dist

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd"
5-
bootstrap="./vendor/autoload.php"
6-
executionOrder="depends,defects"
3+
bootstrap="vendor/autoload.php"
4+
executionOrder="random"
75
beStrictAboutCoversAnnotation="true"
86
beStrictAboutOutputDuringTests="true"
97
beStrictAboutTodoAnnotatedTests="true"
108
convertWarningsToExceptions="true"
119
convertNoticesToExceptions="true"
1210
convertErrorsToExceptions="true"
11+
resolveDependencies="true"
1312
stopOnFailure="false"
13+
failOnWarning="true"
14+
failOnRisky="true"
1415
verbose="true"
1516
colors="true"
1617
>
@@ -24,9 +25,9 @@
2425
</testsuite>
2526
</testsuites>
2627

27-
<filter>
28-
<whitelist>
29-
<directory suffix=".php">./src/</directory>
30-
</whitelist>
31-
</filter>
28+
<coverage processUncoveredFiles="true">
29+
<include>
30+
<directory suffix=".php">./src</directory>
31+
</include>
32+
</coverage>
3233
</phpunit>
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
<?xml version="1.0"?>
22
<psalm
33
errorLevel="1"
4+
findUnusedPsalmSuppress="true"
45
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
56
xmlns="https://getpsalm.org/schema/config"
67
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
78
>
89
<projectFiles>
9-
<directory name="src" />
10+
<directory name="src"/>
11+
<ignoreFiles>
12+
<directory name="vendor"/>
13+
</ignoreFiles>
1014
</projectFiles>
1115
</psalm>

src/Cookie.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ private function setSameSite(?string $sameSite): void
448448
throw new InvalidArgumentException(sprintf(
449449
'The sameSite attribute `%s` is not valid; must be one of (%s).',
450450
$sameSite,
451-
implode(', ', array_map(fn($item) => "\"{$item}\"", $sameSiteValues))
451+
implode(', ', array_map(static fn($item) => "\"$item\"", $sameSiteValues)),
452452
));
453453
}
454454

src/CookieCreator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static function create(
4242
?string $path = '/',
4343
?bool $secure = true,
4444
?bool $httpOnly = true,
45-
?string $sameSite = Cookie::SAME_SITE_LAX
45+
?string $sameSite = CookieInterface::SAME_SITE_LAX
4646
): CookieInterface {
4747
return new Cookie($name, $value, $expire, $domain, $path, $secure, $httpOnly, $sameSite);
4848
}

src/CookieManagerInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use IteratorAggregate;
99
use Psr\Http\Message\ResponseInterface;
1010

11+
/**
12+
* @psalm-suppress MissingTemplateParam
13+
*/
1114
interface CookieManagerInterface extends Countable, IteratorAggregate
1215
{
1316
/**

0 commit comments

Comments
 (0)