Skip to content

Commit 0c26228

Browse files
committed
Use stable, revert changes in ForbidNotNormalizedTypeRule
1 parent 0560884 commit 0c26228

File tree

4 files changed

+76
-52
lines changed

4 files changed

+76
-52
lines changed

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"shipmonk/name-collision-detector": "^2.0.0",
2626
"slevomat/coding-standard": "^8.0.1"
2727
},
28-
"minimum-stability": "dev",
2928
"autoload": {
3029
"psr-4": {
3130
"ShipMonk\\PHPStan\\": "src/"

composer.lock

Lines changed: 40 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Rule/ForbidNotNormalizedTypeRule.php

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,17 @@ public function processNode(
100100
}
101101

102102
if ($node instanceof Property) {
103-
return $this->checkPropertyNativeType($node, $scope);
103+
return array_merge(
104+
$this->checkPropertyPhpDoc($node, $scope),
105+
$this->checkPropertyNativeType($node, $scope),
106+
);
104107
}
105108

106109
if ($node instanceof Catch_) {
107110
return $this->checkCatchNativeType($node, $scope);
108111
}
109112

110-
return $this->checkVarDoc($node, $scope);
113+
return $this->checkInlineVarDoc($node, $scope);
111114
}
112115

113116
/**
@@ -205,11 +208,38 @@ private function checkParamAndReturnNativeType(FunctionLike $node, Scope $scope)
205208
}
206209

207210
/**
208-
* Checks inline var docs and property var docs
209-
*
210211
* @return list<IdentifierRuleError>
211212
*/
212-
private function checkVarDoc(PhpParserNode $node, Scope $scope): array
213+
private function checkPropertyPhpDoc(
214+
Property $node,
215+
Scope $scope
216+
): array
217+
{
218+
$errors = [];
219+
220+
$resolvedPhpDoc = $this->resolvePhpDoc($node, $scope);
221+
222+
if ($resolvedPhpDoc === null) {
223+
return [];
224+
}
225+
226+
$nameScope = $resolvedPhpDoc->getNullableNameScope();
227+
228+
if ($nameScope === null) {
229+
return [];
230+
}
231+
232+
foreach ($resolvedPhpDoc->getPhpDocNodes() as $phpdocNode) {
233+
$errors = array_merge($errors, $this->processVarTags($node, $phpdocNode->getVarTagValues(), $nameScope));
234+
}
235+
236+
return $errors;
237+
}
238+
239+
/**
240+
* @return list<IdentifierRuleError>
241+
*/
242+
private function checkInlineVarDoc(PhpParserNode $node, Scope $scope): array
213243
{
214244
$docComment = $node->getDocComment();
215245

src/Rule/RequirePreviousExceptionPassRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ private function processExceptionCreation(
156156
}
157157

158158
/**
159-
* @return ParameterReflection[]
159+
* @return list<ParameterReflection>
160160
*/
161161
private function getCallLikeParameters(CallLike $node, Scope $scope): array
162162
{

0 commit comments

Comments
 (0)