Skip to content

Commit f8f87c9

Browse files
committed
coding style: TRUE/FALSE/NULL -> true/false/null
1 parent 24413b9 commit f8f87c9

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ And that's all. From now on, you don't need to use `require`. Great, isn't it?
5353

5454
When RobotLoader encounters duplicate class name during indexing, it throws an exception and informs you about it.
5555

56-
The `$loader->setAutoRefresh(TRUE or FALSE)` determines whether RobotLoader should reindex files if asked for nonexistent class.
56+
The `$loader->setAutoRefresh(true or false)` determines whether RobotLoader should reindex files if asked for nonexistent class.
5757
This feature should be disabled on production server.
5858

5959
If you want RobotLoader to skip some directory, use `$loader->excludeDirectory('temp')`.

src/RobotLoader/RobotLoader.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class RobotLoader
3535
public $acceptFiles = ['*.php'];
3636

3737
/** @var bool */
38-
private $autoRebuild = TRUE;
38+
private $autoRebuild = true;
3939

4040
/** @var array */
4141
private $scanPaths = [];
@@ -47,12 +47,12 @@ class RobotLoader
4747
private $classes = [];
4848

4949
/** @var bool */
50-
private $refreshed = FALSE;
50+
private $refreshed = false;
5151

5252
/** @var array of missing classes */
5353
private $missing = [];
5454

55-
/** @var string|NULL */
55+
/** @var string|null */
5656
private $tempDirectory;
5757

5858

@@ -69,10 +69,10 @@ public function __construct()
6969
* @param bool prepend autoloader?
7070
* @return static
7171
*/
72-
public function register($prepend = FALSE)
72+
public function register($prepend = false)
7373
{
7474
$this->loadCache();
75-
spl_autoload_register([$this, 'tryLoad'], TRUE, (bool) $prepend);
75+
spl_autoload_register([$this, 'tryLoad'], true, (bool) $prepend);
7676
return $this;
7777
}
7878

@@ -85,7 +85,7 @@ public function register($prepend = FALSE)
8585
public function tryLoad($type)
8686
{
8787
$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;
8989

9090
if ($this->autoRebuild) {
9191
if (!$info || !is_file($info['file'])) {
@@ -106,7 +106,7 @@ public function tryLoad($type)
106106
}
107107
$this->saveCache();
108108
}
109-
$info = isset($this->classes[$type]) ? $this->classes[$type] : NULL;
109+
$info = isset($this->classes[$type]) ? $this->classes[$type] : null;
110110
}
111111

112112
if ($info) {
@@ -171,7 +171,7 @@ public function rebuild()
171171
*/
172172
private function refresh()
173173
{
174-
$this->refreshed = TRUE; // prevents calling refresh() or updateFile() in tryLoad()
174+
$this->refreshed = true; // prevents calling refresh() or updateFile() in tryLoad()
175175
$files = [];
176176
foreach ($this->classes as $class => $info) {
177177
$files[$info['file']]['time'] = $info['time'];
@@ -217,7 +217,7 @@ private function createFileIterator($dir)
217217
$disallow = [];
218218
foreach (array_merge($ignoreDirs, $this->excludeDirs) as $item) {
219219
if ($item = realpath($item)) {
220-
$disallow[str_replace('\\', '/', $item)] = TRUE;
220+
$disallow[str_replace('\\', '/', $item)] = true;
221221
}
222222
}
223223

@@ -232,7 +232,7 @@ private function createFileIterator($dir)
232232
if (is_file("$path/netterobots.txt")) {
233233
foreach (file("$path/netterobots.txt") as $s) {
234234
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;
236236
}
237237
}
238238
}
@@ -277,7 +277,7 @@ private function updateFile($file)
277277
*/
278278
private function scanPhp($code)
279279
{
280-
$expected = FALSE;
280+
$expected = false;
281281
$namespace = '';
282282
$level = $minLevel = 0;
283283
$classes = [];
@@ -332,7 +332,7 @@ private function scanPhp($code)
332332
$minLevel = $token === '{' ? 1 : 0;
333333
}
334334

335-
$expected = NULL;
335+
$expected = null;
336336
}
337337

338338
if ($token === '{') {
@@ -352,7 +352,7 @@ private function scanPhp($code)
352352
* Sets auto-refresh mode.
353353
* @return static
354354
*/
355-
public function setAutoRefresh($on = TRUE)
355+
public function setAutoRefresh($on = true)
356356
{
357357
$this->autoRebuild = (bool) $on;
358358
return $this;
@@ -410,13 +410,13 @@ private function loadCache()
410410
private function saveCache()
411411
{
412412
$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";
414414
if (file_put_contents("$file.tmp", $code) !== strlen($code) || !rename("$file.tmp", $file)) {
415415
@unlink("$file.tmp"); // @ - file may not exist
416416
throw new \RuntimeException("Unable to create '$file'.");
417417
}
418418
if (function_exists('opcache_invalidate')) {
419-
@opcache_invalidate($file, TRUE); // @ can be restricted
419+
@opcache_invalidate($file, true); // @ can be restricted
420420
}
421421
}
422422

tests/Loaders/files/conditional.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
if (FALSE) {
3+
if (false) {
44
class ConditionalClass
55
{
66
}

0 commit comments

Comments
 (0)