You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fa7f417
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: utils/phpstan/src/Rule/CheaperGuardFirstRule.php
+16-15Lines changed: 16 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,12 @@
4
4
5
5
namespaceRector\Utils\PHPStan\Rule;
6
6
7
+
usePhpParser\Node\Stmt\Else_;
8
+
usePhpParser\Node\Expr\MethodCall;
9
+
usePhpParser\Node\Expr\NullsafeMethodCall;
10
+
usePhpParser\Node\Expr\StaticCall;
11
+
usePhpParser\Node\Expr\FuncCall;
12
+
usePhpParser\Node\Name;
7
13
usePhpParser\Node;
8
14
usePhpParser\Node\Expr\Assign;
9
15
usePhpParser\Node\Expr\CallLike;
@@ -33,17 +39,14 @@
33
39
*/
34
40
finalclass CheaperGuardFirstRule implements Rule
35
41
{
36
-
/**
37
-
* @var string
38
-
*/
39
-
privateconstERROR_MESSAGE = 'Cheap guard on line %d can run before the expensive call on line %d; move the early return up to bail before the costly analysis.';
42
+
privateconststringERROR_MESSAGE = 'Cheap guard on line %d can run before the expensive call on line %d; move the early return up to bail before the costly analysis.';
40
43
41
44
/**
42
45
* Calls that trigger heavy analysis (type resolution, docblock parsing, file re-parsing).
43
46
*
44
47
* @var string[]
45
48
*/
46
-
privateconstEXPENSIVE_CALLS = [
49
+
privateconstarrayEXPENSIVE_CALLS = [
47
50
'getType',
48
51
'getNativeType',
49
52
'isObjectType',
@@ -57,18 +60,15 @@ final class CheaperGuardFirstRule implements Rule
0 commit comments