@@ -35,7 +35,7 @@ class RobotLoader
35
35
public $ acceptFiles = ['*.php ' ];
36
36
37
37
/** @var bool */
38
- private $ autoRebuild = TRUE ;
38
+ private $ autoRebuild = true ;
39
39
40
40
/** @var array */
41
41
private $ scanPaths = [];
@@ -47,12 +47,12 @@ class RobotLoader
47
47
private $ classes = [];
48
48
49
49
/** @var bool */
50
- private $ refreshed = FALSE ;
50
+ private $ refreshed = false ;
51
51
52
52
/** @var array of missing classes */
53
53
private $ missing = [];
54
54
55
- /** @var string|NULL */
55
+ /** @var string|null */
56
56
private $ tempDirectory ;
57
57
58
58
@@ -69,10 +69,10 @@ public function __construct()
69
69
* @param bool prepend autoloader?
70
70
* @return static
71
71
*/
72
- public function register ($ prepend = FALSE )
72
+ public function register ($ prepend = false )
73
73
{
74
74
$ this ->loadCache ();
75
- spl_autoload_register ([$ this , 'tryLoad ' ], TRUE , (bool ) $ prepend );
75
+ spl_autoload_register ([$ this , 'tryLoad ' ], true , (bool ) $ prepend );
76
76
return $ this ;
77
77
}
78
78
@@ -85,7 +85,7 @@ public function register($prepend = FALSE)
85
85
public function tryLoad ($ type )
86
86
{
87
87
$ type = ltrim ($ type , '\\' ); // PHP namespace bug #49143
88
- $ info = isset ($ this ->classes [$ type ]) ? $ this ->classes [$ type ] : NULL ;
88
+ $ info = isset ($ this ->classes [$ type ]) ? $ this ->classes [$ type ] : null ;
89
89
90
90
if ($ this ->autoRebuild ) {
91
91
if (!$ info || !is_file ($ info ['file ' ])) {
@@ -106,7 +106,7 @@ public function tryLoad($type)
106
106
}
107
107
$ this ->saveCache ();
108
108
}
109
- $ info = isset ($ this ->classes [$ type ]) ? $ this ->classes [$ type ] : NULL ;
109
+ $ info = isset ($ this ->classes [$ type ]) ? $ this ->classes [$ type ] : null ;
110
110
}
111
111
112
112
if ($ info ) {
@@ -171,7 +171,7 @@ public function rebuild()
171
171
*/
172
172
private function refresh ()
173
173
{
174
- $ this ->refreshed = TRUE ; // prevents calling refresh() or updateFile() in tryLoad()
174
+ $ this ->refreshed = true ; // prevents calling refresh() or updateFile() in tryLoad()
175
175
$ files = [];
176
176
foreach ($ this ->classes as $ class => $ info ) {
177
177
$ files [$ info ['file ' ]]['time ' ] = $ info ['time ' ];
@@ -217,7 +217,7 @@ private function createFileIterator($dir)
217
217
$ disallow = [];
218
218
foreach (array_merge ($ ignoreDirs , $ this ->excludeDirs ) as $ item ) {
219
219
if ($ item = realpath ($ item )) {
220
- $ disallow [str_replace ('\\' , '/ ' , $ item )] = TRUE ;
220
+ $ disallow [str_replace ('\\' , '/ ' , $ item )] = true ;
221
221
}
222
222
}
223
223
@@ -232,7 +232,7 @@ private function createFileIterator($dir)
232
232
if (is_file ("$ path/netterobots.txt " )) {
233
233
foreach (file ("$ path/netterobots.txt " ) as $ s ) {
234
234
if (preg_match ('#^(?:disallow \\s*:)? \\s*( \\S+)#i ' , $ s , $ matches )) {
235
- $ disallow [$ path . rtrim ('/ ' . ltrim ($ matches [1 ], '/ ' ), '/ ' )] = TRUE ;
235
+ $ disallow [$ path . rtrim ('/ ' . ltrim ($ matches [1 ], '/ ' ), '/ ' )] = true ;
236
236
}
237
237
}
238
238
}
@@ -277,7 +277,7 @@ private function updateFile($file)
277
277
*/
278
278
private function scanPhp ($ code )
279
279
{
280
- $ expected = FALSE ;
280
+ $ expected = false ;
281
281
$ namespace = '' ;
282
282
$ level = $ minLevel = 0 ;
283
283
$ classes = [];
@@ -332,7 +332,7 @@ private function scanPhp($code)
332
332
$ minLevel = $ token === '{ ' ? 1 : 0 ;
333
333
}
334
334
335
- $ expected = NULL ;
335
+ $ expected = null ;
336
336
}
337
337
338
338
if ($ token === '{ ' ) {
@@ -352,7 +352,7 @@ private function scanPhp($code)
352
352
* Sets auto-refresh mode.
353
353
* @return static
354
354
*/
355
- public function setAutoRefresh ($ on = TRUE )
355
+ public function setAutoRefresh ($ on = true )
356
356
{
357
357
$ this ->autoRebuild = (bool ) $ on ;
358
358
return $ this ;
@@ -410,13 +410,13 @@ private function loadCache()
410
410
private function saveCache ()
411
411
{
412
412
$ file = $ this ->getCacheFile ();
413
- $ code = "<?php \nreturn " . var_export ([$ this ->classes , $ this ->missing ], TRUE ) . "; \n" ;
413
+ $ code = "<?php \nreturn " . var_export ([$ this ->classes , $ this ->missing ], true ) . "; \n" ;
414
414
if (file_put_contents ("$ file.tmp " , $ code ) !== strlen ($ code ) || !rename ("$ file.tmp " , $ file )) {
415
415
@unlink ("$ file.tmp " ); // @ - file may not exist
416
416
throw new \RuntimeException ("Unable to create ' $ file'. " );
417
417
}
418
418
if (function_exists ('opcache_invalidate ' )) {
419
- @opcache_invalidate ($ file , TRUE ); // @ can be restricted
419
+ @opcache_invalidate ($ file , true ); // @ can be restricted
420
420
}
421
421
}
422
422
0 commit comments