Skip to content

Commit 88498ea

Browse files
committed
Support PHPUnit 11 and nikic/php-parser v5 and drop PHP 7.2, PHP 7.3
Fixes #72
1 parent ef80b8e commit 88498ea

10 files changed

+32
-18
lines changed

.github/workflows/lint-and-analyse.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v4
15-
- name: Use php 7.2
15+
- name: Use php 7.4
1616
uses: shivammathur/setup-php@v2
1717
with:
18-
php-version: 7.2
18+
php-version: 7.4
1919
- name: Validate composer.json and composer.lock
2020
run: composer validate
2121
- name: Get Composer Cache Directory

.github/workflows/tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
continue-on-error: ${{ matrix.experimental }}
1515
strategy:
1616
matrix:
17-
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
17+
php-version: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
1818
os: [ubuntu-latest]
1919
experimental: [false]
2020
composer-options: ['']
@@ -53,7 +53,7 @@ jobs:
5353
strategy:
5454
fail-fast: false
5555
matrix:
56-
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
56+
php-version: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
5757
os: [ubuntu-latest]
5858
experimental: [false]
5959
composer-options: ['']
@@ -85,7 +85,7 @@ jobs:
8585
strategy:
8686
fail-fast: false
8787
matrix:
88-
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
88+
php-version: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
8989
os: [ubuntu-latest]
9090
experimental: [false]
9191
composer-options: ['']
@@ -119,7 +119,7 @@ jobs:
119119
strategy:
120120
fail-fast: false
121121
matrix:
122-
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
122+
php-version: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
123123
os: [ubuntu-latest]
124124
experimental: [false]
125125
composer-options: ['']

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased] - yyyy-mm-dd
99

1010
- Attempt to reload the current page in a newly-selected version
11+
- Support PHPUnit 10 and 11
12+
- Support `nikic/php-parser` v5
13+
- Support Symfony v7
1114

1215
## [5.5.4] - 2023-12-16
1316

@@ -26,7 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2629

2730
## [5.5.1] - 2022-02-17
2831

29-
- Allow new/more versions of symfony (^5|^6)
32+
- Allow new/more versions of Symfony (^5|^6)
3033
- Upgrade `phpdocumentor/reflection-docblock` to `~5.3`
3134

3235
## [5.5.0] - 2022-01-09

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
}
3636
],
3737
"require": {
38-
"php": "^7.2.20 || ^8.0",
38+
"php": "^7.4 || ^8.0",
3939
"twig/twig": "^3.0",
40-
"nikic/php-parser": "^4.10",
40+
"nikic/php-parser": "^5",
4141
"symfony/console": "~3.4|~4.3|^5|^6|^7",
4242
"symfony/finder": "~3.4|~4.3|^5|^6|^7",
4343
"symfony/filesystem": "~3.4|~4.3|^5|^6|^7",
@@ -56,10 +56,10 @@
5656
"phpcbf": "@php ./vendor/bin/phpcbf"
5757
},
5858
"require-dev": {
59-
"phpunit/phpunit": "^7 || ^8 || ^9 || ^10",
60-
"phpstan/phpstan": "^1.4.6",
59+
"phpunit/phpunit": "^7 || ^8 || ^9 || ^10 || ^11 || ^12",
60+
"phpstan/phpstan": "^2.1",
6161
"wdes/coding-standard": "^3.3.1",
62-
"phpstan/phpstan-phpunit": "^1"
62+
"phpstan/phpstan-phpunit": "^2"
6363
},
6464
"autoload": {
6565
"psr-4": {

src/Doctum.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ private function getDocblockParser(): DocBlockParser
523523

524524
private function getPhpParser(): PhpParser
525525
{
526-
return (new ParserFactory())->create(ParserFactory::PREFER_PHP7);
526+
return (new ParserFactory())->createForNewestSupportedVersion();
527527
}
528528

529529
private function getPhpTraverser(): NodeTraverser

tests/Parser/ClassVisitor/MethodClassVisitorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function testAddsMethods(): void
3232
$class->expects($this->any())
3333
->method('getTags')
3434
->with($this->equalTo('method'))
35-
->will($this->returnValue($property));
35+
->willReturn($property);
3636

3737
$visitor = new MethodClassVisitor();
3838
/** @var ClassReflection $class */

tests/Parser/DocBlockParserTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class DocBlockParserTest extends TestCase
3232
/**
3333
* @dataProvider getParseTests
3434
*/
35+
#[\PHPUnit\Framework\Attributes\DataProvider('getParseTests')]
3536
public function testParse(string $comment, array $expected): void
3637
{
3738
$parser = new DocBlockParser();
@@ -42,6 +43,7 @@ public function testParse(string $comment, array $expected): void
4243
/**
4344
* @dataProvider getParseTests
4445
*/
46+
#[\PHPUnit\Framework\Attributes\DataProvider('getParseTests')]
4547
public function testParseWithNamespace(string $comment, array $expected): void
4648
{
4749
$parser = new DocBlockParser();
@@ -52,6 +54,7 @@ public function testParseWithNamespace(string $comment, array $expected): void
5254
/**
5355
* @dataProvider getParseTests
5456
*/
57+
#[\PHPUnit\Framework\Attributes\DataProvider('getParseTests')]
5558
public function testParseWithAliases(string $comment, array $expected): void
5659
{
5760
$parser = new DocBlockParser();

tests/Parser/NodeVisitorTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Doctum\Reflection\PropertyReflection;
2525
use Doctum\Store\ArrayStore;
2626
use PhpParser\Node\Expr\Variable;
27+
use PhpParser\Node\Name;
2728

2829
/**
2930
* @author Tomasz Struczyński <[email protected]>
@@ -34,6 +35,7 @@ class NodeVisitorTest extends AbstractTestCase
3435
/**
3536
* @dataProvider getMethodTypehints
3637
*/
38+
#[\PHPUnit\Framework\Attributes\DataProvider('getMethodTypehints')]
3739
public function testMethodTypehints(ClassReflection $classReflection, ClassMethod $method, array $expectedHints): void
3840
{
3941
$parserContext = new ParserContext(new TrueFilter(), new DocBlockParser(), new Standard());
@@ -64,6 +66,7 @@ public function testMethodTypehints(ClassReflection $classReflection, ClassMetho
6466
/**
6567
* @dataProvider getMethodReturnTypeHints
6668
*/
69+
#[\PHPUnit\Framework\Attributes\DataProvider('getMethodReturnTypeHints')]
6770
public function testMethodReturnTypeHints(ClassReflection $classReflection, ClassMethod $method, string $expectedReturnType): void
6871
{
6972
$parserContext = new ParserContext(new TrueFilter(), new DocBlockParser(), new Standard());
@@ -113,7 +116,7 @@ private static function getPrimitiveMethodReturnType(): array
113116
$method = new ClassMethod(
114117
'testMethod',
115118
[
116-
'returnType' => 'string',
119+
'returnType' => new Name('string'),
117120
]
118121
);
119122

@@ -165,7 +168,7 @@ private static function getNullableMethodReturnType(): array
165168
$method = new ClassMethod(
166169
'testMethod',
167170
[
168-
'returnType' => new NullableType('Test\\Class'),
171+
'returnType' => new NullableType(new Name('Test\\Class')),
169172
]
170173
);
171174

@@ -194,12 +197,12 @@ private static function getMethodTypehintsPrimiteveParameters(): array
194197
new Param(
195198
new Variable('param1'),
196199
null,
197-
'int'
200+
new Name('int')
198201
),
199202
new Param(
200203
new Variable('param2'),
201204
null,
202-
'string'
205+
new Name('string')
203206
),
204207
],
205208
]

tests/Parser/ProjectTraverserTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class ProjectTraverserTest extends TestCase
2626
/**
2727
* @dataProvider getTraverseOrderClasses
2828
*/
29+
#[\PHPUnit\Framework\Attributes\DataProvider('getTraverseOrderClasses')]
2930
public function testTraverseOrder(
3031
string $interfaceName,
3132
string $parentName,
@@ -61,6 +62,7 @@ public function testTraverseOrder(
6162
/**
6263
* @dataProvider getNamespaceDetectionClasses
6364
*/
65+
#[\PHPUnit\Framework\Attributes\DataProvider('getNamespaceDetectionClasses')]
6466
public function testNamespaceDetection(
6567
string $interfaceName,
6668
string $parentName,

tests/Renderer/TwigExtensionTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ public static function dataProviderParseDesc(): array
201201
/**
202202
* @dataProvider dataProviderParseDesc
203203
*/
204+
#[\PHPUnit\Framework\Attributes\DataProvider('dataProviderParseDesc')]
204205
public function testParseDesc(string $intput, string $expectedOutput, ?Reflection $ref = null): void
205206
{
206207
$extension = new TwigExtension();
@@ -399,6 +400,7 @@ public static function dataProviderMarkdownToHtml(): array
399400
/**
400401
* @dataProvider dataProviderMarkdownToHtml
401402
*/
403+
#[\PHPUnit\Framework\Attributes\DataProvider('dataProviderMarkdownToHtml')]
402404
public function testMarkdownToHtml(string $intput, string $expectedOutput): void
403405
{
404406
$extension = new TwigExtension();
@@ -503,6 +505,7 @@ public static function dataProviderTransformContentsIntoLinks(): array
503505
/**
504506
* @dataProvider dataProviderTransformContentsIntoLinks
505507
*/
508+
#[\PHPUnit\Framework\Attributes\DataProvider('dataProviderTransformContentsIntoLinks')]
506509
public function testTransformContentsIntoLinks(string $intput, string $expectedOutput, Reflection $refl): void
507510
{
508511
$extension = new TwigExtension();

0 commit comments

Comments
 (0)