Skip to content

Commit 5152086

Browse files
committed
Our own RobotLoader fork
1 parent 2c5ca8d commit 5152086

File tree

4 files changed

+503
-5
lines changed

4 files changed

+503
-5
lines changed

phpcs.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@
8686
<rule ref="Consistence.NamingConventions.ValidVariableName.NotCamelCaps">
8787
<exclude-pattern>src/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocator.php</exclude-pattern>
8888
</rule>
89+
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowEmpty.DisallowedEmpty">
90+
<exclude-pattern>src/RobotLoader/RobotLoader.php</exclude-pattern>
91+
</rule>
8992
<exclude-pattern>tests/*/data</exclude-pattern>
9093
<exclude-pattern>tests/*/traits</exclude-pattern>
9194
<exclude-pattern>tests/tmp</exclude-pattern>

phpstan-baseline.neon

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
parameters:
42
ignoreErrors:
53
-
@@ -127,6 +125,66 @@ parameters:
127125
count: 1
128126
path: src/Reflection/Php/PhpClassReflectionExtension.php
129127

128+
-
129+
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
130+
count: 1
131+
path: src/RobotLoader/RobotLoader.php
132+
133+
-
134+
message: "#^Only booleans are allowed in a negated boolean, array\\<string, int\\|string\\>\\|null given\\.$#"
135+
count: 1
136+
path: src/RobotLoader/RobotLoader.php
137+
138+
-
139+
message: "#^Only booleans are allowed in a negated boolean, string\\|null given\\.$#"
140+
count: 1
141+
path: src/RobotLoader/RobotLoader.php
142+
143+
-
144+
message: "#^Argument of an invalid type array\\<int, string\\>\\|false supplied for foreach, only iterables are supported\\.$#"
145+
count: 1
146+
path: src/RobotLoader/RobotLoader.php
147+
148+
-
149+
message: "#^Only booleans are allowed in a negated boolean, int\\|false given\\.$#"
150+
count: 1
151+
path: src/RobotLoader/RobotLoader.php
152+
153+
-
154+
message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, string\\|false given\\.$#"
155+
count: 1
156+
path: src/RobotLoader/RobotLoader.php
157+
158+
-
159+
message: "#^Unreachable statement \\- code above always terminates\\.$#"
160+
count: 2
161+
path: src/RobotLoader/RobotLoader.php
162+
163+
-
164+
message: "#^Parameter \\#1 \\$source of function token_get_all expects string, string\\|false given\\.$#"
165+
count: 1
166+
path: src/RobotLoader/RobotLoader.php
167+
168+
-
169+
message: "#^Only booleans are allowed in an if condition, int\\|false\\|null given\\.$#"
170+
count: 2
171+
path: src/RobotLoader/RobotLoader.php
172+
173+
-
174+
message: "#^Only booleans are allowed in &&, string given on the left side\\.$#"
175+
count: 1
176+
path: src/RobotLoader/RobotLoader.php
177+
178+
-
179+
message: "#^Only booleans are allowed in a ternary operator condition, string given\\.$#"
180+
count: 1
181+
path: src/RobotLoader/RobotLoader.php
182+
183+
-
184+
message: "#^Call to function is_array\\(\\) with array\\<string, array\\('file' \\=\\> string, 'time' \\=\\> int\\)\\> will always evaluate to true\\.$#"
185+
count: 1
186+
path: src/RobotLoader/RobotLoader.php
187+
130188
-
131189
message: "#^Property PHPStan\\\\Rules\\\\Registry\\:\\:\\$rules with generic interface PHPStan\\\\Rules\\\\Rule does not specify its types\\: TNodeType$#"
132190
count: 1
@@ -196,5 +254,3 @@ parameters:
196254
message: "#^Method PHPStan\\\\Node\\\\FileNodeTest\\:\\:getRule\\(\\) return type with generic interface PHPStan\\\\Rules\\\\Rule does not specify its types\\: TNodeType$#"
197255
count: 1
198256
path: tests/PHPStan/Node/FileNodeTest.php
199-
200-

src/Command/CommandHelper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use PHPStan\File\FileFinder;
1818
use PHPStan\File\FileHelper;
1919
use PHPStan\File\FileReader;
20+
use PHPStan\RobotLoader\RobotLoader;
2021
use Symfony\Component\Console\Input\InputInterface;
2122
use Symfony\Component\Console\Output\ConsoleOutputInterface;
2223
use Symfony\Component\Console\Output\OutputInterface;
@@ -284,7 +285,7 @@ public static function begin(
284285
$autoloadDirectories = $container->getParameter('autoload_directories');
285286
$featureToggles = $container->getParameter('featureToggles');
286287
if (count($autoloadDirectories) > 0 && !$featureToggles['disableRobotLoader']) {
287-
$robotLoader = new \Nette\Loaders\RobotLoader();
288+
$robotLoader = new RobotLoader();
288289
$robotLoader->acceptFiles = array_map(static function (string $extension): string {
289290
return sprintf('*.%s', $extension);
290291
}, $container->getParameter('fileExtensions'));

0 commit comments

Comments
 (0)