File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ public function tryLoad(string $type): void
122122 */
123123 public function addDirectory (...$ paths ): self
124124 {
125- if (is_array ($ paths [0 ])) {
125+ if (is_array ($ paths [0 ] ?? null )) {
126126 trigger_error (__METHOD__ . '() use variadics ...$paths to add an array of paths. ' , E_USER_WARNING );
127127 $ paths = $ paths [0 ];
128128 }
@@ -144,7 +144,7 @@ public function reportParseErrors(bool $on = true): self
144144 */
145145 public function excludeDirectory (...$ paths ): self
146146 {
147- if (is_array ($ paths [0 ])) {
147+ if (is_array ($ paths [0 ] ?? null )) {
148148 trigger_error (__METHOD__ . '() use variadics ...$paths to add an array of paths. ' , E_USER_WARNING );
149149 $ paths = $ paths [0 ];
150150 }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * Test: Nette\Loaders\RobotLoader bug # 17 POC.
5+ */
6+
7+ declare (strict_types=1 );
8+
9+ use Nette \Loaders \RobotLoader ;
10+ use Tester \Assert ;
11+
12+
13+ require __DIR__ . '/../bootstrap.php ' ;
14+
15+ $ loader = new RobotLoader ;
16+ $ loader ->setTempDirectory (TEMP_DIR );
17+
18+ Assert::noError (
19+ function () use ($ loader ) {
20+ $ loader ->addDirectory (...[]);
21+ }
22+ );
23+
24+ Assert::noError (
25+ function () use ($ loader ) {
26+ $ loader ->excludeDirectory (...[]);
27+ }
28+ );
You can’t perform that action at this time.
0 commit comments