Skip to content

Commit d8b6cd5

Browse files
authored
Merge pull request #5: upgrade phpdoc-parser version
2 parents a707e2f + e258644 commit d8b6cd5

File tree

9 files changed

+67
-60
lines changed

9 files changed

+67
-60
lines changed

.github/workflows/cs-fix.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
on:
2+
push:
3+
branches:
4+
- '*.*'
5+
6+
name: Fix Code Style
7+
8+
jobs:
9+
cs-fix:
10+
permissions:
11+
contents: write
12+
uses: spiral/gh-actions/.github/workflows/cs-fix.yml@master

.github/workflows/cs.yml

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

.github/workflows/phpunit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ jobs:
1313
os: >-
1414
['ubuntu-latest']
1515
php: >-
16-
['8.1', '8.2', '8.3']
16+
['8.1', '8.2', '8.3', '8.4']
1717
stability: >-
1818
['prefer-lowest', 'prefer-stable']

.github/workflows/psalm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ jobs:
1313
os: >-
1414
['ubuntu-latest']
1515
php: >-
16-
['8.2']
16+
['8.3']

.php-cs-fixer.dist.php

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,10 @@
22

33
declare(strict_types=1);
44

5-
if (!file_exists(__DIR__.'/src')) {
6-
exit(0);
7-
}
5+
require_once 'vendor/autoload.php';
86

9-
return (new PhpCsFixer\Config())
10-
->setRules([
11-
'@PSR12' => true,
12-
'ternary_operator_spaces' => false,
13-
])
14-
->setRiskyAllowed(true)
15-
->setFinder(
16-
(new PhpCsFixer\Finder())
17-
->in(__DIR__.'/src')
18-
->append([__FILE__])
19-
)
20-
->setCacheFile('.php-cs-fixer.cache');
7+
return \Spiral\CodeStyle\Builder::create()
8+
->include(__DIR__ . '/src')
9+
->include(__DIR__ . '/tests')
10+
->include(__FILE__)
11+
->build();

composer.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@
2424
],
2525
"require": {
2626
"php": ">=8.1",
27-
"symfony/property-info": "^6.3 || ^7.0",
28-
"phpstan/phpdoc-parser": "^1.24",
27+
"symfony/property-info": "^6.4.18 || ^7.2",
28+
"phpstan/phpdoc-parser": "^1.33 | ^2.1",
2929
"phpdocumentor/reflection-docblock": "^5.3"
3030
},
3131
"require-dev": {
32-
"roave/security-advisories": "dev-latest",
33-
"phpunit/phpunit": "^10.4",
34-
"friendsofphp/php-cs-fixer": "^3.38",
35-
"vimeo/psalm": "^5.15"
32+
"phpunit/phpunit": "^10.5.45",
33+
"spiral/code-style": "^2.2.2",
34+
"vimeo/psalm": "^5.26.1 || ^6.10"
3635
},
3736
"autoload": {
3837
"psr-4": {
@@ -45,8 +44,10 @@
4544
}
4645
},
4746
"scripts": {
48-
"test": "vendor/bin/phpunit",
49-
"psalm": "vendor/bin/psalm --config=psalm.xml ./src"
47+
"cs:fix": "php-cs-fixer fix -v",
48+
"test": "phpunit",
49+
"psalm": "psalm",
50+
"psalm:baseline": "psalm --set-baseline=psalm-baseline.xml"
5051
},
5152
"config": {
5253
"sort-packages": true

psalm-baseline.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<files psalm-version="6.10.1@f9fd6bc117e9ce1e854c2ed6777e7135aaa4966b">
3+
<file src="src/Attribute/Field.php">
4+
<ClassMustBeFinal>
5+
<code><![CDATA[Field]]></code>
6+
</ClassMustBeFinal>
7+
</file>
8+
<file src="src/Exception/DefinitionException.php">
9+
<ClassMustBeFinal>
10+
<code><![CDATA[DefinitionException]]></code>
11+
</ClassMustBeFinal>
12+
</file>
13+
<file src="src/Exception/GeneratorException.php">
14+
<ClassMustBeFinal>
15+
<code><![CDATA[GeneratorException]]></code>
16+
</ClassMustBeFinal>
17+
</file>
18+
<file src="src/Exception/InvalidTypeException.php">
19+
<ClassMustBeFinal>
20+
<code><![CDATA[InvalidTypeException]]></code>
21+
</ClassMustBeFinal>
22+
</file>
23+
<file src="src/Generator.php">
24+
<ClassMustBeFinal>
25+
<code><![CDATA[Generator]]></code>
26+
</ClassMustBeFinal>
27+
</file>
28+
</files>

psalm.xml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0"?>
2-
<psalm
3-
errorLevel="2"
4-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xmlns="https://getpsalm.org/schema/config"
6-
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
7-
findUnusedCode="false"
8-
findUnusedBaselineEntry="true"
2+
<psalm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="https://getpsalm.org/schema/config"
4+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
5+
errorLevel="2"
6+
errorBaseline="psalm-baseline.xml"
7+
findUnusedCode="false"
8+
findUnusedBaselineEntry="true"
99
>
1010
<projectFiles>
1111
<directory name="src" />
@@ -14,10 +14,6 @@
1414
</ignoreFiles>
1515
</projectFiles>
1616
<issueHandlers>
17-
<UndefinedAttributeClass>
18-
<errorLevel type="suppress">
19-
<referencedClass name="JetBrains\PhpStorm\ExpectedValues" />
20-
</errorLevel>
21-
</UndefinedAttributeClass>
17+
<MissingOverrideAttribute errorLevel="suppress" />
2218
</issueHandlers>
2319
</psalm>

src/Schema/Reference.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,8 @@ public function __construct(
1919

2020
public function jsonSerialize(): string
2121
{
22-
if (!\strrpos($this->className, '\\')) {
23-
return '#/definitions/' . $this->className;
24-
}
22+
$pos = \strrpos($this->className, '\\');
2523

26-
// basename of the class
27-
$basename = \substr($this->className, (int) \strrpos($this->className, '\\') + 1);
28-
29-
return '#/definitions/' . $basename;
24+
return '#/definitions/' . ($pos === false ? $this->className : \substr($this->className, $pos + 1));
3025
}
3126
}

0 commit comments

Comments
 (0)