diff --git a/.github/workflows/psalm.yml b/.github/workflows/psalm.yml index 138ccdc8..58178a3a 100644 --- a/.github/workflows/psalm.yml +++ b/.github/workflows/psalm.yml @@ -15,7 +15,7 @@ jobs: dependencies: - "locked" php-version: - - "8.0" + - "8.1" operating-system: - "ubuntu-latest" diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 84ca6caf..f222c747 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,6 +2,7 @@ diff --git a/psalm-baseline.xml b/psalm-baseline.xml index fe5f1c35..2606c946 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -103,6 +103,9 @@ $namespaceAlias + + method_exists($constReflection, 'isFinal') + is_array($constant) @@ -278,9 +281,6 @@ getName getName - - ReflectionEnumUnitCase - getBackingType getCases @@ -367,9 +367,10 @@ - + $array['name'] $parameterOutput + $reflectionMethod->isStatic() $value $value $value @@ -459,6 +460,9 @@ $reflectionProperty->getDocBlock() + + method_exists($reflectionProperty, 'isReadonly') + new static($array['name']) new static() @@ -592,18 +596,14 @@ - + allowsNull getName getName getParentClass + getTypes - - - - ReflectionIntersectionType - ReflectionIntersectionType - + @@ -1086,9 +1086,6 @@ $tokens - - $shortDescription - $context === 0x00 $this->shortDescription != '' && $tagIndex === null @@ -2304,14 +2301,16 @@ - + + new DocBlockScanner($docComment) new DocBlockScanner($docComment) new DocBlockScanner($docComment) new DocBlockScanner($docComment) - + testDocBlockScannerDescriptions testDocBlockScannerParsesTagsWithNoValuesProperly + testInvalidDocBlock $tags[0] diff --git a/src/Scanner/DocBlockScanner.php b/src/Scanner/DocBlockScanner.php index 955bb6c2..de13ef1a 100644 --- a/src/Scanner/DocBlockScanner.php +++ b/src/Scanner/DocBlockScanner.php @@ -25,7 +25,7 @@ class DocBlockScanner protected $docComment; /** @var string */ - protected $shortDescription; + protected $shortDescription = ''; /** @var string */ protected $longDescription = ''; diff --git a/test/Scanner/DocBlockScannerTest.php b/test/Scanner/DocBlockScannerTest.php index b1d9f6f4..0a696564 100644 --- a/test/Scanner/DocBlockScannerTest.php +++ b/test/Scanner/DocBlockScannerTest.php @@ -51,4 +51,11 @@ public function testDocBlockScannerDescriptions() self::assertEquals('Short Description', $tokenScanner->getShortDescription()); self::assertEquals('Long Description continued in the second line', $tokenScanner->getLongDescription()); } + + public function testInvalidDocBlock() + { + $docComment = '/**'; + $tokenScanner = new DocBlockScanner($docComment); + self::assertEquals('', $tokenScanner->getShortDescription()); + } }