Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 1.14.x up into 2.0.x #496

Merged
merged 6 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading