Skip to content

Commit

Permalink
Merge pull request #496 from greg0ire/2.0.x
Browse files Browse the repository at this point in the history
Merge 1.14.x up into 2.0.x
  • Loading branch information
greg0ire authored Sep 5, 2024
2 parents 94f40ad + 331446e commit 01489ff
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ on:
jobs:
static-analysis:
name: "Static Analysis"
uses: "doctrine/.github/.github/workflows/static-analysis.yml@2.1.0"
uses: "doctrine/.github/.github/workflows/static-analysis.yml@3.0.0"
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
"require-dev": {
"doctrine/cache": "^2.0",
"doctrine/coding-standard": "^10",
"phpstan/phpstan": "^1.8.0",
"phpstan/phpstan": "^1.10.28",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"symfony/cache": "^5.4 || ^6",
"vimeo/psalm": "^4.10"
"vimeo/psalm": "^4.30 || ^5.14"
},
"suggest": {
"php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations"
Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/Common/Annotations/DocLexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function nextTokenIsAdjacent(): bool
}

/**
* {@inheritdoc}
* {@inheritDoc}
*/
protected function getCatchablePatterns()
{
Expand All @@ -86,15 +86,15 @@ protected function getCatchablePatterns()
}

/**
* {@inheritdoc}
* {@inheritDoc}
*/
protected function getNonCatchablePatterns()
{
return ['\s+', '\*+', '(.)'];
}

/**
* {@inheritdoc}
* {@inheritDoc}
*/
protected function getType(&$value)
{
Expand Down
8 changes: 5 additions & 3 deletions lib/Doctrine/Common/Annotations/DocParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
* A parser for docblock annotations.
*
* It is strongly discouraged to change the default annotation parsing process.
*
* @psalm-type Arguments = array{positional_arguments?: array<int, mixed>, named_arguments?: array<string, mixed>}
*/
final class DocParser
{
Expand Down Expand Up @@ -1026,7 +1028,7 @@ private function Annotation()
/**
* MethodCall ::= ["(" [Values] ")"]
*
* @return mixed[]
* @psalm-return Arguments
*
* @throws AnnotationException
* @throws ReflectionException
Expand All @@ -1053,7 +1055,7 @@ private function MethodCall(): array
/**
* Values ::= Array | Value {"," Value}* [","]
*
* @return mixed[]
* @psalm-return Arguments
*
* @throws AnnotationException
* @throws ReflectionException
Expand Down Expand Up @@ -1415,7 +1417,7 @@ private function isIgnoredAnnotation(string $name): bool
/**
* Resolve positional arguments (without name) to named ones
*
* @param array<string,mixed> $arguments
* @psalm-param Arguments $arguments
*
* @return array<string,mixed>
*/
Expand Down
7 changes: 7 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
<exclude-pattern>*/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php</exclude-pattern>
<exclude-pattern>*/tests/Doctrine/Tests/Common/Annotations/Fixtures/*</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.Commenting.DocCommentSpacing">
<exclude-pattern>*/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php</exclude-pattern>
<exclude-pattern>*/tests/Doctrine/Tests/Common/Annotations/Fixtures/*</exclude-pattern>
<exclude-pattern>*/tests/Doctrine/Tests/Common/Annotations/SimpleAnnotationReaderTest.php</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash.UseStartsWithBackslash">
<exclude-pattern>*/tests/Doctrine/Tests/Common/Annotations/Fixtures/*</exclude-pattern>
</rule>
Expand Down Expand Up @@ -88,6 +93,7 @@

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

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

Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
parameters:
level: 3
phpVersion: 80200
paths:
- lib
- tests
Expand Down
11 changes: 11 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?xml version="1.0"?>
<psalm
errorLevel="7"
phpVersion="8.2"
resolveFromConfigFile="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand All @@ -12,4 +15,12 @@
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<issueHandlers>
<NoValue>
<errorLevel type="suppress">
<file name="lib/Doctrine/Common/Annotations/Annotation/Enum.php" />
<file name="lib/Doctrine/Common/Annotations/Annotation/Target.php" />
</errorLevel>
</NoValue>
</issueHandlers>
</psalm>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class ClassWithInvalidAnnotationTargetAtProperty
*/
public $foo;


/**
* @var mixed
* @AnnotationTargetAnnotation("Foo")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class ClassWithValidAnnotationTarget
/** @AnnotationTargetPropertyMethod("Some data") */
public $foo;


/** @AnnotationTargetAll("Some data",name="Some name") */
public $name;

Expand Down

0 comments on commit 01489ff

Please sign in to comment.