From 44c6e8210d28f531edc0ed8a1ef16ae7b1e0bc0c Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Sun, 30 Aug 2026 18:17:32 +0200 Subject: [PATCH] Run the tests written for `@pure-unless-parameter-passed` The provider holding them was written but never named among the ones `testParse` is run with, so its two cases had never run. They do not pass: `PureUnlessParameterIsPassedTagValueNode` is the one node of `src/Ast/PhpDoc` without a `__set_state()`, which is what the test reads the node back with after writing it out with `var_export()`. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01GavWEzia8ZVUYEe6JEde9i --- .../PureUnlessParameterIsPassedTagValueNode.php | 14 ++++++++++++++ tests/PHPStan/Parser/PhpDocParserTest.php | 1 + 2 files changed, 15 insertions(+) diff --git a/src/Ast/PhpDoc/PureUnlessParameterIsPassedTagValueNode.php b/src/Ast/PhpDoc/PureUnlessParameterIsPassedTagValueNode.php index a49f5fd0..d59b320a 100644 --- a/src/Ast/PhpDoc/PureUnlessParameterIsPassedTagValueNode.php +++ b/src/Ast/PhpDoc/PureUnlessParameterIsPassedTagValueNode.php @@ -26,4 +26,18 @@ public function __toString(): string return trim("{$this->parameterName} {$this->description}"); } + /** + * @param array $properties + */ + public static function __set_state(array $properties): self + { + $instance = new self($properties['parameterName'], $properties['description']); + if (isset($properties['attributes'])) { + foreach ($properties['attributes'] as $key => $value) { + $instance->setAttribute($key, $value); + } + } + return $instance; + } + } diff --git a/tests/PHPStan/Parser/PhpDocParserTest.php b/tests/PHPStan/Parser/PhpDocParserTest.php index b118798d..eacece63 100644 --- a/tests/PHPStan/Parser/PhpDocParserTest.php +++ b/tests/PHPStan/Parser/PhpDocParserTest.php @@ -104,6 +104,7 @@ protected function setUp(): void * @dataProvider provideTypelessParamTagsData * @dataProvider provideParamClosureThisTagsData * @dataProvider providePureUnlessCallableIsImpureTagsData + * @dataProvider providePureUnlessParameterIsPassedTagsData * @dataProvider provideVarTagsData * @dataProvider provideReturnTagsData * @dataProvider provideThrowsTagsData