Skip to content

Commit eef3354

Browse files
authored
Bump to PHP 8.1 and add 8.3 to pipeline (#1045)
- Bumps minimum PHP version to 8.1 - Upgrades to PHPUnit 10 - Adds 8.3 to pipeline with --ignore-platform-reqs to allow for Prophecy (which needs a new release)
1 parent 8b769d7 commit eef3354

91 files changed

Lines changed: 349 additions & 265 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yaml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
matrix:
2222
php-version:
23-
- '7.4'
23+
- '8.1'
2424

2525
steps:
2626
-
@@ -49,7 +49,7 @@ jobs:
4949
strategy:
5050
matrix:
5151
php-version:
52-
- '7.4'
52+
- '8.1'
5353

5454
steps:
5555
-
@@ -86,7 +86,7 @@ jobs:
8686
strategy:
8787
matrix:
8888
php-version:
89-
- '7.4'
89+
- '8.1'
9090

9191
steps:
9292
-
@@ -125,21 +125,35 @@ jobs:
125125
strategy:
126126
matrix:
127127
php-version:
128-
- '7.4'
129-
- '8.0'
130128
- '8.1'
131129
- '8.2'
132130
dependency:
133131
- 'lowest'
134132
- 'highest'
135133
with-examples: ['yes']
136134
allow-failures: [false]
135+
composer-options: ['']
137136
include:
138-
- php-version: '7.4'
137+
- php-version: '8.1'
139138
dependency: 'lowest'
140139
with-examples: 'no'
141140
allow-failures: false
142141
coverage: xdebug
142+
composer-options: ''
143+
- php-version: '8.3'
144+
dependency: 'lowest'
145+
with-examples: 'no'
146+
allow-failures: true
147+
flags: php-*'
148+
coverage: xdebug
149+
composer-options: '--ignore-platform-req=php*'
150+
- php-version: '8.3'
151+
dependency: 'highest'
152+
with-examples: 'no'
153+
allow-failures: true
154+
flags: php-*'
155+
coverage: xdebug
156+
composer-options: '--ignore-platform-req=php*'
143157

144158
steps:
145159
- name: "Checkout code"
@@ -162,12 +176,13 @@ jobs:
162176
uses: "ramsey/composer-install@v2"
163177
with:
164178
dependency-versions: "${{ matrix.dependency }}"
179+
composer-options: "${{ matrix.composer-options }}"
165180

166181
- name: PHP Info
167182
run: php --version
168183

169184
- name: "Run tests with PHPUnit"
170-
run: vendor/bin/phpunit --verbose
185+
run: vendor/bin/phpunit
171186
env:
172187
SKIP_XDEBUG_TESTS: "${{ matrix.skip_xdebug_tests }}"
173188

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
"minimum-stability": "stable",
1919
"prefer-stable": true,
2020
"require": {
21-
"php": "^7.4 || ^8.0",
21+
"php": "^8.1",
2222
"ext-dom": "*",
2323
"ext-json": "*",
2424
"ext-pcre": "*",
2525
"ext-reflection": "*",
2626
"ext-spl": "*",
2727
"ext-tokenizer": "*",
28-
"doctrine/annotations": "^1.13 || ^2.0",
28+
"doctrine/annotations": "^2.0",
2929
"phpbench/container": "^2.1",
3030
"phpbench/dom": "~0.3.3",
3131
"psr/log": "^1.1 || ^2.0 || ^3.0",
@@ -38,14 +38,15 @@
3838
"webmozart/glob": "^4.6"
3939
},
4040
"require-dev": {
41+
"rector/rector": "^0.18.10",
4142
"dantleech/invoke": "^2.0",
4243
"friendsofphp/php-cs-fixer": "^3.0",
43-
"phpspec/prophecy": "^1.12",
44+
"phpspec/prophecy": "dev-master",
4445
"phpstan/phpstan": "^1.0",
4546
"phpstan/phpstan-phpunit": "^1.0",
4647
"jangregor/phpstan-prophecy": "^1.0",
4748
"phpstan/extension-installer": "^1.1",
48-
"phpunit/phpunit": "^9.0",
49+
"phpunit/phpunit": "^10.0",
4950
"symfony/error-handler": "^5.2 || ^6.0 || ^7.0",
5051
"symfony/var-dumper": "^4.0 || ^5.0 || ^6.0 || ^7.0"
5152
},

extensions/xdebug/tests/Unit/XDebugUtilTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function testCacheGrindExtension($xdebugVersion, $useCompression, $expect
6161
$this->assertEquals($expectedExtension, $cacheGrindExtension);
6262
}
6363

64-
public function provideGenerate()
64+
public static function provideGenerate()
6565
{
6666
return [
6767
[
@@ -77,7 +77,7 @@ public function provideGenerate()
7777
];
7878
}
7979

80-
public function provideXdebugVersion(): array
80+
public static function provideXdebugVersion(): array
8181
{
8282
return [
8383
['2.8.1', false, '.cachegrind'],

flake.lock

Lines changed: 63 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# this is a WIP flake for development and experimentation only
2+
{
3+
description = "php-tui/php-tui";
4+
5+
inputs = {
6+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
7+
};
8+
9+
outputs = inputs @ {
10+
self,
11+
flake-parts,
12+
...
13+
}:
14+
flake-parts.lib.mkFlake {inherit inputs;} {
15+
# This flake is for Linux (x86) and Apple (darwin) systems
16+
# If you need more systems, inspect `nixpkgs.lib.systems.flakeExposed` and
17+
# add them to this list.
18+
#
19+
# $ nix repl "<nixpkgs>"
20+
# nix-repl> lib.systems.flakeExposed
21+
systems = ["x86_64-linux" "aarch64-linux"];
22+
23+
perSystem = {
24+
pkgs,
25+
system,
26+
...
27+
}: let
28+
phpForPhpTui = (pkgs.php81.buildEnv {
29+
extensions = ({ enabled, all }: enabled ++ (with all; [
30+
imagick
31+
]));
32+
extraConfig = ''
33+
'';
34+
});
35+
in {
36+
# Run `nix fmt` to reformat the nix files
37+
formatter = pkgs.alejandra;
38+
39+
# Run `nix develop` to enter the development shell
40+
devShells.default = pkgs.mkShellNoCC {
41+
name = "php-devshell";
42+
43+
buildInputs = [
44+
pkgs.bash
45+
pkgs.vhs
46+
pkgs.hugo
47+
phpForPhpTui
48+
pkgs.php81.packages.composer
49+
];
50+
shellHook = ''
51+
if [ ! -d ".venv" ]; then
52+
python3 -m venv .venv;
53+
fi
54+
source .venv/bin/activate;'';
55+
};
56+
};
57+
};
58+
}

lib/Report/Model/BarChart.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,6 @@ public function yAxisLabelRange(int $steps): array
125125
{
126126
$max = max($this->yValues());
127127

128-
if (false === $max) {
129-
return [];
130-
}
131128
$step = $max / $steps;
132129

133130
return range(0, $max, $step);

phpunit.xml.dist

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
3-
<phpunit
4-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
6-
colors="true"
7-
bootstrap="tests/bootstrap.php"
8-
failOnWarning="true"
9-
>
10-
11-
<testsuites>
12-
<testsuite name="PhpBench">
13-
<directory>./tests</directory>
14-
</testsuite>
15-
<testsuite name="PhpBench Xdebug Extension">
16-
<directory>./extensions/xdebug/tests</directory>
17-
</testsuite>
18-
</testsuites>
19-
20-
<coverage
21-
cacheDirectory=".phpunit.cache/coverage"
22-
processUncoveredFiles="true"
23-
>
24-
<include>
25-
<directory suffix=".php">./lib</directory>
26-
<directory suffix=".php">./extensions/xdebug/lib</directory>
27-
</include>
28-
</coverage>
3+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" colors="true" bootstrap="tests/bootstrap.php" failOnWarning="true" cacheDirectory=".phpunit.cache">
4+
<testsuites>
5+
<testsuite name="PhpBench">
6+
<directory>./tests</directory>
7+
</testsuite>
8+
<testsuite name="PhpBench Xdebug Extension">
9+
<directory>./extensions/xdebug/tests</directory>
10+
</testsuite>
11+
</testsuites>
12+
<coverage>
13+
<include>
14+
<directory suffix=".php">./lib</directory>
15+
<directory suffix=".php">./extensions/xdebug/lib</directory>
16+
</include>
17+
</coverage>
2918
</phpunit>

tests/Benchmark/Expression/ParserBench.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function benchEvaluate(array $params): void
4747
/**
4848
* @return Generator<mixed>
4949
*/
50-
public function provideExpressions(): Generator
50+
public static function provideExpressions(): Generator
5151
{
5252
yield 'comp. w/tol' => [
5353
'expr' => '10 seconds < 10 seconds +/- 10 seconds',

tests/Benchmark/Expression/ParserFoo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function benchEvaluate(array $params): void
4747
/**
4848
* @return Generator<mixed>
4949
*/
50-
public function provideExpressions(): Generator
50+
public static function provideExpressions(): Generator
5151
{
5252
yield 'comp. w/tol' => [
5353
'expr' => '10 seconds < 10 seconds +/- 10 seconds',

tests/Benchmark/Report/Generator/ComponentGeneratorBench.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function prepare(array $config): void
6565
/**
6666
* @return Generator<mixed>
6767
*/
68-
public function provideConfigs(): Generator
68+
public static function provideConfigs(): Generator
6969
{
7070
yield 'text' => [
7171
'config' => [
@@ -114,7 +114,7 @@ public function provideConfigs(): Generator
114114
];
115115
}
116116

117-
public function provideNumberOfIterations(): Generator
117+
public static function provideNumberOfIterations(): Generator
118118
{
119119
for ($i = 0; $i < 100; $i += 25) {
120120
yield $i => [

0 commit comments

Comments
 (0)