Skip to content

Commit 6252f66

Browse files
authored
Merge pull request #96 from smeghead/chore/vendor-update
chore: supported php version make >=8.2 and update vendors.
2 parents 51fac4a + 1723e4f commit 6252f66

File tree

7 files changed

+36
-17
lines changed

7 files changed

+36
-17
lines changed

.github/workflows/php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
php-versions: ['8.0', '8.1', '8.2', '8.3', '8.4']
15+
php-versions: ['8.2', '8.3', '8.4']
1616
name: PHP ${{ matrix.php-versions }} Test
1717
steps:
1818
- uses: actions/checkout@v4

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
### Features
44

55
* doc: add Extension Visual Studio Code.
6+
* chore: supported php version >=8.2.
7+
* chore: update vendors.
68

79
## v1.5.3 (2024-12-26)
810

Dockerfile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
FROM plantuml/plantuml
22

3-
RUN apt-get update && apt-get install -y php8.1-cli php-xml php-mbstring php-xdebug fonts-noto-cjk git zip && apt-get clean && rm -rf /var/lib/apt/lists/*
3+
RUN apt-get update && apt-get install -y \
4+
software-properties-common \
5+
ca-certificates \
6+
wget \
7+
gnupg \
8+
fonts-noto-cjk \
9+
git \
10+
zip \
11+
&& add-apt-repository ppa:ondrej/php \
12+
&& apt-get update && apt-get install -y \
13+
php8.2-cli \
14+
php8.2-mbstring \
15+
php8.2-xml \
16+
php8.2-curl \
17+
php8.2-xdebug \
18+
&& rm -rf /var/lib/apt/lists/*
419
RUN echo '#!/bin/sh' > /usr/bin/plantuml && echo 'java -jar /opt/plantuml.jar "$@"' >> /usr/bin/plantuml && chmod +x /usr/bin/plantuml
520

621
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
"PlantUML"
88
],
99
"require": {
10-
"php" : ">=8.0",
10+
"php" : ">=8.2",
1111
"symfony/finder": "^5.3|^6.0|^7.0",
1212
"nikic/php-parser": "^5.2",
13-
"phpstan/phpdoc-parser": "^1.30"
13+
"phpstan/phpdoc-parser": "^2.3"
1414
},
1515
"require-dev": {
16-
"phpunit/phpunit": "^9.6",
16+
"phpunit/phpunit": "^11.5",
1717
"clue/phar-composer": "^1.2",
1818
"phpstan/phpstan": "^1.10",
1919
"smeghead/php-vendor-credits": "~0.0.4"

src/Php/Doc/PhpDocComment.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use PHPStan\PhpDocParser\Parser\PhpDocParser;
1313
use PHPStan\PhpDocParser\Parser\TokenIterator;
1414
use PHPStan\PhpDocParser\Parser\TypeParser;
15+
use PHPStan\PhpDocParser\ParserConfig;
1516

1617
final class PhpDocComment
1718
{
@@ -79,11 +80,15 @@ public function getReturnTypeName(): string {
7980

8081
private function getParseResult(): PhpDocNode
8182
{
82-
$lexer = new Lexer();
83-
$constExprParser = new ConstExprParser();
84-
$typeParser = new TypeParser($constExprParser);
85-
$phpDocParser = new PhpDocParser($typeParser, $constExprParser);
83+
$config = new ParserConfig([]);
84+
85+
$lexer = new Lexer($config);
86+
$constExprParser = new ConstExprParser($config);
87+
$typeParser = new TypeParser($config, $constExprParser);
88+
$phpDocParser = new PhpDocParser($config, $typeParser, $constExprParser);
89+
8690
$tokens = new TokenIterator($lexer->tokenize('/** ' . $this->text . ' */'));
91+
8792
return $phpDocParser->parse($tokens); // PhpDocNode
8893
}
8994

test/OptionsTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
declare(strict_types=1);
44

5+
use PHPUnit\Framework\Attributes\DataProvider;
56
use PHPUnit\Framework\TestCase;
67

78
use Smeghead\PhpClassDiagram\Config\Options;
@@ -131,17 +132,15 @@ public function testClassNameSummaryDefault(): void
131132
$this->assertTrue($options->classNameSummary(), 'classNameSummary is default on.');
132133
}
133134

134-
/**
135-
* @dataProvider provideDiagrams
136-
*/
135+
#[DataProvider('provideDiagrams')]
137136
public function testDiagrams(array $options, string $expected): void
138137
{
139138
$options = new Options($options);
140139

141140
$this->assertSame($expected, $options->diagram(), sprintf('diagram is %s.', $expected));
142141
}
143142

144-
public function provideDiagrams(): array
143+
public static function provideDiagrams(): array
145144
{
146145
return [
147146
[[], Options::DIAGRAM_CLASS],// default

test/PhpReflectionTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
declare(strict_types=1);
44

5+
use PHPUnit\Framework\Attributes\RequiresPhp;
56
use PHPUnit\Framework\TestCase;
67

78
use Smeghead\PhpClassDiagram\Config\Options;
@@ -343,10 +344,7 @@ public function testTrait(): void
343344
$this->assertSame('string', $data->getMethods()[0]->getParams()[0]->getType()->getName(), 'parameter type.');
344345
$this->assertSame([], $data->getMethods()[0]->getParams()[0]->getType()->getTypes()[0]->getNamespace(), 'parameter type namespace.');
345346
}
346-
/**
347-
* @requires PHP >= 8.1
348-
* PHP8.0 dose not have `enum`.
349-
*/
347+
350348
public function testEnum(): void
351349
{
352350
$options = new Options([]);

0 commit comments

Comments
 (0)