Skip to content

Commit e56d8e3

Browse files
authored
Update PHPUnit and PHPCS, require 8.2+ (#39)
- Updates to current PHPUnit versions - Updates to current PHPCS - PHPStan ignored, will deal with it in a separate PR - Bumped min PHP to 8.2, oldest currently supported version - Update test syntax for newer PHPUnit
1 parent 66f952a commit e56d8e3

22 files changed

Lines changed: 129 additions & 144 deletions

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Check out code
18-
uses: actions/checkout@v2
18+
uses: actions/checkout@v6
1919

2020
- name: Setup PHP
2121
uses: shivammathur/setup-php@v2
2222

2323
- name: Cache Composer packages
2424
id: composer-cache
25-
uses: actions/cache@v2
25+
uses: actions/cache@v5
2626
with:
2727
path: vendor
2828
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.json') }}

.github/workflows/static-analysis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Check out code
18-
uses: actions/checkout@v2
18+
uses: actions/checkout@v6
1919

2020
- name: Setup PHP
2121
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: '8.2'
2224

2325
- name: Cache Composer packages
2426
id: composer-cache
25-
uses: actions/cache@v2
27+
uses: actions/cache@v5
2628
with:
2729
path: vendor
2830
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.json') }}

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ jobs:
2020
- 'high'
2121
- 'low'
2222
php:
23-
- '8.0'
23+
- '8.2'
2424

2525
steps:
2626
- name: Check out code
27-
uses: actions/checkout@v2
27+
uses: actions/checkout@v6
2828

2929
- name: Setup PHP
3030
uses: shivammathur/setup-php@v2
@@ -35,7 +35,7 @@ jobs:
3535

3636
- name: Cache Composer packages
3737
id: composer-cache
38-
uses: actions/cache@v2
38+
uses: actions/cache@v5
3939
with:
4040
path: vendor
4141
key: ${{ runner.os }}-php-${{ matrix.dependencies }}-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
@@ -70,4 +70,4 @@ jobs:
7070

7171
- name: Submit code coverage
7272
if: ${{ always() }}
73-
uses: codecov/codecov-action@v1
73+
uses: codecov/codecov-action@v5

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/build/
22
/vendor/
33
composer.lock
4-
.phpunit.result.cache
4+
.phpunit.cache

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
"sort-packages": true
2323
},
2424
"require": {
25-
"php": "^8.0"
25+
"php": "^8.2"
2626
},
2727
"require-dev": {
2828
"phpstan/phpstan": "^0.12.32",
2929
"phpstan/phpstan-phpunit": "^0.12",
30-
"phpunit/phpunit": "^8.3 || ^9",
31-
"squizlabs/php_codesniffer": "^3.6"
30+
"phpunit/phpunit": "^11.0 || ^12.0 || ^13.0",
31+
"squizlabs/php_codesniffer": "^4.0"
3232
},
3333
"scripts": {
3434
"test": [

phpunit.xml

Lines changed: 0 additions & 22 deletions
This file was deleted.

phpunit.xml.dist

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
cacheDirectory=".phpunit.cache"
6+
executionOrder="depends,defects"
7+
shortenArraysForExportThreshold="10"
8+
requireCoverageMetadata="true"
9+
beStrictAboutCoverageMetadata="false"
10+
beStrictAboutOutputDuringTests="true"
11+
displayDetailsOnAllIssues="true"
12+
failOnAllIssues="true">
13+
<testsuites>
14+
<testsuite name="default">
15+
<directory>tests</directory>
16+
</testsuite>
17+
</testsuites>
18+
19+
<source ignoreIndirectDeprecations="true" restrictNotices="true" restrictWarnings="true">
20+
<include>
21+
<directory>src</directory>
22+
</include>
23+
</source>
24+
</phpunit>

src/Containers/ParsedInput.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function asArray(): array
151151
/**
152152
* Invoked via `isset` and `empty`
153153
*/
154-
public function offsetExists($offset)
154+
public function offsetExists($offset): bool
155155
{
156156
throw new BadMethodCallException(
157157
"ParsedInput is already validated, and contains all expected " .
@@ -161,9 +161,8 @@ public function offsetExists($offset)
161161

162162
/**
163163
* Invoked by array access of the object
164-
* @return mixed
165164
*/
166-
public function offsetGet($offset)
165+
public function offsetGet($offset): mixed
167166
{
168167
$data = $this->getData();
169168
if (
@@ -182,15 +181,15 @@ public function offsetGet($offset)
182181
/**
183182
* Invoked by setting an array value on the object
184183
*/
185-
public function offsetSet($offset, $value)
184+
public function offsetSet($offset, $value): never
186185
{
187186
throw new BadMethodCallException("ParsedInput is read-only");
188187
}
189188

190189
/**
191190
* Invoked via `unset`
192191
*/
193-
public function offsetUnset($offset)
192+
public function offsetUnset($offset): never
194193
{
195194
throw new BadMethodCallException("ParsedInput is read-only");
196195
}

src/Containers/SafeInput.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
*/
1414
class SafeInput extends ParsedInput
1515
{
16-
1716
public function __construct(ParsedInput $valid)
1817
{
1918
if (!$valid->isValidated()) {

src/Exceptions/InputException.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
class InputException extends UnexpectedValueException
1111
{
12-
1312
public const PARSE_ERROR = 1;
1413
public const FORMAT_ERROR = 2;
1514
public const MISSING_VALUES = 3;

0 commit comments

Comments
 (0)