Skip to content

Commit 1db3c10

Browse files
committed
used PHP 7.1 features
1 parent 458ca5c commit 1db3c10

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/RobotLoader/RobotLoader.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class RobotLoader
2626
{
2727
use Nette\SmartObject;
2828

29-
const RETRY_LIMIT = 3;
29+
private const RETRY_LIMIT = 3;
3030

3131
/** @var array */
3232
public $ignoreDirs = ['.*', '*.old', '*.bak', '*.tmp', 'temp'];
@@ -84,7 +84,7 @@ public function register(bool $prepend = false): self
8484
public function tryLoad(string $type): void
8585
{
8686
$type = ltrim($type, '\\'); // PHP namespace bug #49143
87-
$info = isset($this->classes[$type]) ? $this->classes[$type] : null;
87+
$info = $this->classes[$type] ?? null;
8888

8989
if ($this->autoRebuild) {
9090
if (!$info || !is_file($info['file'])) {
@@ -105,11 +105,11 @@ public function tryLoad(string $type): void
105105
}
106106
$this->saveCache();
107107
}
108-
$info = isset($this->classes[$type]) ? $this->classes[$type] : null;
108+
$info = $this->classes[$type] ?? null;
109109
}
110110

111111
if ($info) {
112-
call_user_func(function ($file) { require $file; }, $info['file']);
112+
(function ($file) { require $file; })($info['file']);
113113
}
114114
}
115115

@@ -402,7 +402,7 @@ public function setTempDirectory(string $dir): self
402402
private function loadCache(): void
403403
{
404404
$file = $this->getCacheFile();
405-
list($this->classes, $this->missing) = @include $file; // @ file may not exist
405+
[$this->classes, $this->missing] = @include $file; // @ file may not exist
406406
if (is_array($this->classes)) {
407407
return;
408408
}
@@ -412,7 +412,7 @@ private function loadCache(): void
412412
throw new \RuntimeException("Unable to create or acquire exclusive lock on file '$file.lock'.");
413413
}
414414

415-
list($this->classes, $this->missing) = @include $file; // @ file may not exist
415+
[$this->classes, $this->missing] = @include $file; // @ file may not exist
416416
if (!is_array($this->classes)) {
417417
$this->rebuild();
418418
}

0 commit comments

Comments
 (0)