Skip to content

Commit ffc355d

Browse files
committed
Simplify code
1 parent 6bab877 commit ffc355d

8 files changed

+7
-42
lines changed

phpstan-baseline.neon

-35
Original file line numberDiff line numberDiff line change
@@ -277,41 +277,6 @@ parameters:
277277
count: 1
278278
path: src/Reflection/SignatureMap/Php8SignatureMapProvider.php
279279

280-
-
281-
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
282-
count: 1
283-
path: src/Rules/Api/ApiClassExtendsRule.php
284-
285-
-
286-
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
287-
count: 1
288-
path: src/Rules/Api/ApiClassImplementsRule.php
289-
290-
-
291-
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
292-
count: 1
293-
path: src/Rules/Api/ApiInstantiationRule.php
294-
295-
-
296-
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
297-
count: 1
298-
path: src/Rules/Api/ApiInterfaceExtendsRule.php
299-
300-
-
301-
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
302-
count: 1
303-
path: src/Rules/Api/ApiMethodCallRule.php
304-
305-
-
306-
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
307-
count: 1
308-
path: src/Rules/Api/ApiStaticCallRule.php
309-
310-
-
311-
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
312-
count: 1
313-
path: src/Rules/Api/ApiTraitUseRule.php
314-
315280
-
316281
message: "#^Binary operation \"\\+\" between array\\{class\\-string\\<TNodeType of PhpParser\\\\Node\\>\\} and array\\<string, class\\-string\\>\\|false results in an error\\.$#"
317282
count: 1

src/Rules/Api/ApiClassExtendsRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function processNode(Node $node, Scope $scope): array
4242
}
4343

4444
$extendedClassReflection = $this->reflectionProvider->getClass($extendedClassName);
45-
if (!$this->apiRuleHelper->isPhpStanCode($scope, $extendedClassReflection->getName(), $extendedClassReflection->getFileName() ?: null)) {
45+
if (!$this->apiRuleHelper->isPhpStanCode($scope, $extendedClassReflection->getName(), $extendedClassReflection->getFileName())) {
4646
return [];
4747
}
4848

src/Rules/Api/ApiClassImplementsRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private function checkName(Scope $scope, Node\Name $name): array
5454
}
5555

5656
$implementedClassReflection = $this->reflectionProvider->getClass($implementedClassName);
57-
if (!$this->apiRuleHelper->isPhpStanCode($scope, $implementedClassReflection->getName(), $implementedClassReflection->getFileName() ?: null)) {
57+
if (!$this->apiRuleHelper->isPhpStanCode($scope, $implementedClassReflection->getName(), $implementedClassReflection->getFileName())) {
5858
return [];
5959
}
6060

src/Rules/Api/ApiInstantiationRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function processNode(Node $node, Scope $scope): array
4040
}
4141

4242
$classReflection = $this->reflectionProvider->getClass($className);
43-
if (!$this->apiRuleHelper->isPhpStanCode($scope, $classReflection->getName(), $classReflection->getFileName() ?: null)) {
43+
if (!$this->apiRuleHelper->isPhpStanCode($scope, $classReflection->getName(), $classReflection->getFileName())) {
4444
return [];
4545
}
4646

src/Rules/Api/ApiInterfaceExtendsRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private function checkName(Scope $scope, Node\Name $name): array
5454
}
5555

5656
$extendedInterfaceReflection = $this->reflectionProvider->getClass($extendedInterface);
57-
if (!$this->apiRuleHelper->isPhpStanCode($scope, $extendedInterfaceReflection->getName(), $extendedInterfaceReflection->getFileName() ?: null)) {
57+
if (!$this->apiRuleHelper->isPhpStanCode($scope, $extendedInterfaceReflection->getName(), $extendedInterfaceReflection->getFileName())) {
5858
return [];
5959
}
6060

src/Rules/Api/ApiMethodCallRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function processNode(Node $node, Scope $scope): array
3838
}
3939

4040
$declaringClass = $methodReflection->getDeclaringClass();
41-
if (!$this->apiRuleHelper->isPhpStanCode($scope, $declaringClass->getName(), $declaringClass->getFileName() ?: null)) {
41+
if (!$this->apiRuleHelper->isPhpStanCode($scope, $declaringClass->getName(), $declaringClass->getFileName())) {
4242
return [];
4343
}
4444

src/Rules/Api/ApiStaticCallRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function processNode(Node $node, Scope $scope): array
5353

5454
$methodReflection = $classReflection->getNativeMethod($methodName);
5555
$declaringClass = $methodReflection->getDeclaringClass();
56-
if (!$this->apiRuleHelper->isPhpStanCode($scope, $declaringClass->getName(), $declaringClass->getFileName() ?: null)) {
56+
if (!$this->apiRuleHelper->isPhpStanCode($scope, $declaringClass->getName(), $declaringClass->getFileName())) {
5757
return [];
5858
}
5959

src/Rules/Api/ApiTraitUseRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function processNode(Node $node, Scope $scope): array
4141
}
4242

4343
$traitReflection = $this->reflectionProvider->getClass($traitName);
44-
if (!$this->apiRuleHelper->isPhpStanCode($scope, $traitReflection->getName(), $traitReflection->getFileName() ?: null)) {
44+
if (!$this->apiRuleHelper->isPhpStanCode($scope, $traitReflection->getName(), $traitReflection->getFileName())) {
4545
continue;
4646
}
4747

0 commit comments

Comments
 (0)