@@ -30,10 +30,10 @@ class RobotLoader
3030
3131 private const RETRY_LIMIT = 3 ;
3232
33- /** @var array */
33+ /** @var string[] */
3434 public $ ignoreDirs = ['.* ' , '*.old ' , '*.bak ' , '*.tmp ' , 'temp ' ];
3535
36- /** @var array */
36+ /** @var string[] */
3737 public $ acceptFiles = ['*.php ' ];
3838
3939 /** @var bool */
@@ -42,10 +42,10 @@ class RobotLoader
4242 /** @var bool */
4343 private $ reportParseErrors = true ;
4444
45- /** @var array */
45+ /** @var string[] */
4646 private $ scanPaths = [];
4747
48- /** @var array */
48+ /** @var string[] */
4949 private $ excludeDirs = [];
5050
5151 /** @var array of class => [file, time] */
@@ -133,7 +133,7 @@ public function addDirectory(...$paths): self
133133
134134 public function reportParseErrors (bool $ on = true ): self
135135 {
136- $ this ->reportParseErrors = ( bool ) $ on ;
136+ $ this ->reportParseErrors = $ on ;
137137 return $ this ;
138138 }
139139
@@ -239,7 +239,7 @@ private function createFileIterator(string $dir): Nette\Utils\Finder
239239 throw new Nette \IOException ("File or directory ' $ dir' not found. " );
240240 }
241241
242- if (! is_array ($ ignoreDirs = $ this ->ignoreDirs )) {
242+ if (is_string ($ ignoreDirs = $ this ->ignoreDirs )) {
243243 trigger_error (__CLASS__ . ': $ignoreDirs must be an array. ' , E_USER_WARNING );
244244 $ ignoreDirs = preg_split ('#[,\s]+# ' , $ ignoreDirs );
245245 }
@@ -250,7 +250,7 @@ private function createFileIterator(string $dir): Nette\Utils\Finder
250250 }
251251 }
252252
253- if (! is_array ($ acceptFiles = $ this ->acceptFiles )) {
253+ if (is_string ($ acceptFiles = $ this ->acceptFiles )) {
254254 trigger_error (__CLASS__ . ': $acceptFiles must be an array. ' , E_USER_WARNING );
255255 $ acceptFiles = preg_split ('#[,\s]+# ' , $ acceptFiles );
256256 }
@@ -309,7 +309,7 @@ private function scanPhp(string $file): array
309309 {
310310 $ code = file_get_contents ($ file );
311311 $ expected = false ;
312- $ namespace = '' ;
312+ $ namespace = $ name = '' ;
313313 $ level = $ minLevel = 0 ;
314314 $ classes = [];
315315
@@ -389,7 +389,7 @@ private function scanPhp(string $file): array
389389 */
390390 public function setAutoRefresh (bool $ on = true ): self
391391 {
392- $ this ->autoRebuild = ( bool ) $ on ;
392+ $ this ->autoRebuild = $ on ;
393393 return $ this ;
394394 }
395395
@@ -416,7 +416,7 @@ private function loadCache(): void
416416 return ;
417417 }
418418
419- $ handle = fopen ("$ file.lock " , 'c + ' );
419+ $ handle = fopen ("$ file.lock " , 'cb + ' );
420420 if (!$ handle || !flock ($ handle , LOCK_EX )) {
421421 throw new \RuntimeException ("Unable to create or acquire exclusive lock on file ' $ file.lock'. " );
422422 }
0 commit comments