Skip to content

Commit 18f04ba

Browse files
committed
remove null from array
1 parent 7e134ad commit 18f04ba

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

phpstan.neon

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,10 @@ parameters:
4444
- '#Doing instanceof PHPStan\\Type\\.+ is error\-prone and deprecated#'
4545

4646
- identifier: instanceof.alwaysTrue
47-
#- identifier: assign.propertyType
47+
48+
# false positive
49+
-
50+
identifier: assign.propertyType
51+
message: '#Property PhpParser\\Node\\Identifier\:\:\$name \(non\-empty\-string\) does not accept string#'
52+
path: rules/CodeQuality/Rector/ClassMethod/ReplaceTestFunctionPrefixWithAttributeRector.php
53+

rules/AnnotationsToAttributes/Rector/Class_/RequiresAnnotationWithValueToAttributeRector.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function refactor(Node $node): ?Node
121121
}
122122

123123
/**
124-
* @return array<string, AttributeGroup|null>
124+
* @return array<string, AttributeGroup>
125125
*/
126126
private function handleRequires(PhpDocInfo $phpDocInfo): array
127127
{
@@ -133,7 +133,13 @@ private function handleRequires(PhpDocInfo $phpDocInfo): array
133133
}
134134

135135
$requires = $desiredTagValueNode->value->value;
136-
$attributeGroups[$requires] = $this->requiresAttributeFactory->create($requires);
136+
137+
$requiresAttributeGroup = $this->requiresAttributeFactory->create($requires);
138+
if (! $requiresAttributeGroup instanceof AttributeGroup) {
139+
continue;
140+
}
141+
142+
$attributeGroups[$requires] = $requiresAttributeGroup;
137143

138144
$this->phpDocTagRemover->removeTagValueFromNode($phpDocInfo, $desiredTagValueNode);
139145
}

0 commit comments

Comments
 (0)