Skip to content

Commit 01489ff

Browse files
authored
Merge pull request #496 from greg0ire/2.0.x
Merge 1.14.x up into 2.0.x
2 parents 94f40ad + 331446e commit 01489ff

File tree

9 files changed

+30
-11
lines changed

9 files changed

+30
-11
lines changed

.github/workflows/static-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ on:
1212
jobs:
1313
static-analysis:
1414
name: "Static Analysis"
15-
uses: "doctrine/.github/.github/workflows/static-analysis.yml@2.1.0"
15+
uses: "doctrine/.github/.github/workflows/static-analysis.yml@3.0.0"

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
"require-dev": {
4141
"doctrine/cache": "^2.0",
4242
"doctrine/coding-standard": "^10",
43-
"phpstan/phpstan": "^1.8.0",
43+
"phpstan/phpstan": "^1.10.28",
4444
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
4545
"symfony/cache": "^5.4 || ^6",
46-
"vimeo/psalm": "^4.10"
46+
"vimeo/psalm": "^4.30 || ^5.14"
4747
},
4848
"suggest": {
4949
"php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations"

lib/Doctrine/Common/Annotations/DocLexer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function nextTokenIsAdjacent(): bool
7474
}
7575

7676
/**
77-
* {@inheritdoc}
77+
* {@inheritDoc}
7878
*/
7979
protected function getCatchablePatterns()
8080
{
@@ -86,15 +86,15 @@ protected function getCatchablePatterns()
8686
}
8787

8888
/**
89-
* {@inheritdoc}
89+
* {@inheritDoc}
9090
*/
9191
protected function getNonCatchablePatterns()
9292
{
9393
return ['\s+', '\*+', '(.)'];
9494
}
9595

9696
/**
97-
* {@inheritdoc}
97+
* {@inheritDoc}
9898
*/
9999
protected function getType(&$value)
100100
{

lib/Doctrine/Common/Annotations/DocParser.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
* A parser for docblock annotations.
5050
*
5151
* It is strongly discouraged to change the default annotation parsing process.
52+
*
53+
* @psalm-type Arguments = array{positional_arguments?: array<int, mixed>, named_arguments?: array<string, mixed>}
5254
*/
5355
final class DocParser
5456
{
@@ -1026,7 +1028,7 @@ private function Annotation()
10261028
/**
10271029
* MethodCall ::= ["(" [Values] ")"]
10281030
*
1029-
* @return mixed[]
1031+
* @psalm-return Arguments
10301032
*
10311033
* @throws AnnotationException
10321034
* @throws ReflectionException
@@ -1053,7 +1055,7 @@ private function MethodCall(): array
10531055
/**
10541056
* Values ::= Array | Value {"," Value}* [","]
10551057
*
1056-
* @return mixed[]
1058+
* @psalm-return Arguments
10571059
*
10581060
* @throws AnnotationException
10591061
* @throws ReflectionException
@@ -1415,7 +1417,7 @@ private function isIgnoredAnnotation(string $name): bool
14151417
/**
14161418
* Resolve positional arguments (without name) to named ones
14171419
*
1418-
* @param array<string,mixed> $arguments
1420+
* @psalm-param Arguments $arguments
14191421
*
14201422
* @return array<string,mixed>
14211423
*/

phpcs.xml.dist

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@
5656
<exclude-pattern>*/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php</exclude-pattern>
5757
<exclude-pattern>*/tests/Doctrine/Tests/Common/Annotations/Fixtures/*</exclude-pattern>
5858
</rule>
59+
<rule ref="SlevomatCodingStandard.Commenting.DocCommentSpacing">
60+
<exclude-pattern>*/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php</exclude-pattern>
61+
<exclude-pattern>*/tests/Doctrine/Tests/Common/Annotations/Fixtures/*</exclude-pattern>
62+
<exclude-pattern>*/tests/Doctrine/Tests/Common/Annotations/SimpleAnnotationReaderTest.php</exclude-pattern>
63+
</rule>
5964
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash.UseStartsWithBackslash">
6065
<exclude-pattern>*/tests/Doctrine/Tests/Common/Annotations/Fixtures/*</exclude-pattern>
6166
</rule>
@@ -88,6 +93,7 @@
8893

8994
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName">
9095
<exclude-pattern>*/tests/Doctrine/Tests/Common/Annotations/PhpParserTest.php</exclude-pattern>
96+
<exclude-pattern>*/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM141Test.php</exclude-pattern>
9197
</rule>
9298

9399
<!-- It is easier to understand tests that involve annotations if you can
@@ -119,6 +125,7 @@
119125
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingAnyTypeHint">
120126
<!-- there is a class property with an empty var annotation on purpose -->
121127
<exclude-pattern>*/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php</exclude-pattern>
128+
<exclude-pattern>*/tests/Doctrine/Tests/Common/Annotations/DummyClass.php</exclude-pattern>
122129
<exclude-pattern>*/tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithValidAnnotationTarget.php</exclude-pattern>
123130
</rule>
124131

phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
parameters:
22
level: 3
3+
phpVersion: 80200
34
paths:
45
- lib
56
- tests

psalm.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<?xml version="1.0"?>
22
<psalm
33
errorLevel="7"
4+
phpVersion="8.2"
45
resolveFromConfigFile="true"
6+
findUnusedBaselineEntry="true"
7+
findUnusedCode="false"
58
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
69
xmlns="https://getpsalm.org/schema/config"
710
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
@@ -12,4 +15,12 @@
1215
<directory name="vendor" />
1316
</ignoreFiles>
1417
</projectFiles>
18+
<issueHandlers>
19+
<NoValue>
20+
<errorLevel type="suppress">
21+
<file name="lib/Doctrine/Common/Annotations/Annotation/Enum.php" />
22+
<file name="lib/Doctrine/Common/Annotations/Annotation/Target.php" />
23+
</errorLevel>
24+
</NoValue>
25+
</issueHandlers>
1526
</psalm>

tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithInvalidAnnotationTargetAtProperty.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ class ClassWithInvalidAnnotationTargetAtProperty
1616
*/
1717
public $foo;
1818

19-
2019
/**
2120
* @var mixed
2221
* @AnnotationTargetAnnotation("Foo")

tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithValidAnnotationTarget.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class ClassWithValidAnnotationTarget
1414
/** @AnnotationTargetPropertyMethod("Some data") */
1515
public $foo;
1616

17-
1817
/** @AnnotationTargetAll("Some data",name="Some name") */
1918
public $name;
2019

0 commit comments

Comments
 (0)