Completed
Push — fix-compile-autoload ( 1e91e0...450cf6 )
by Akihito
03:06
created
src/Compiler.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public function compile() : int
98 98
     {
99
-        if (! is_dir($this->appDir)) {
99
+        if (!is_dir($this->appDir)) {
100 100
             throw new RuntimeException($this->appDir);
101 101
         }
102 102
         $preload = $this->compilePreload($this->appMeta, $this->context);
@@ -137,15 +137,15 @@  discard block
 block discarded – undo
137 137
 
138 138
     public function registerLoader(string $appDir) : void
139 139
     {
140
-        $loaderFile = $appDir . '/vendor/autoload.php';
141
-        if (! file_exists($loaderFile)) {
140
+        $loaderFile = $appDir.'/vendor/autoload.php';
141
+        if (!file_exists($loaderFile)) {
142 142
             throw new RuntimeException('no loader');
143 143
         }
144 144
         /** @var ClassLoader $loader */
145 145
         $loader = require $loaderFile;
146 146
         spl_autoload_register(
147 147
             /** @var class-string $class */
148
-            function (string $class) use ($loader) : void {
148
+            function(string $class) use ($loader) : void {
149 149
                 $loader->loadClass($class);
150 150
                 if ($class !== NullPage::class) {
151 151
                     $this->classes[] = $class;
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 %s
213 213
 require __DIR__ . '/vendor/autoload.php';
214 214
 ", $this->context, $requiredFile);
215
-        $fileName = realpath($appDir) . '/autoload.php';
215
+        $fileName = realpath($appDir).'/autoload.php';
216 216
         if (file_exists($fileName)) {
217 217
             $fileName .= ' (overwritten)';
218 218
         }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 require __DIR__ . '/vendor/autoload.php'
240 240
 
241 241
 %s", $this->context, $requiredOnceFile);
242
-        $fileName = realpath($appMeta->appDir) . '/preload.php';
242
+        $fileName = realpath($appMeta->appDir).'/preload.php';
243 243
         if (file_exists($fileName)) {
244 244
             $fileName .= 'overwritten';
245 245
         }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
     {
253 253
         $dir = (string) realpath($rootDir);
254 254
         if (strpos($file, $dir) !== false) {
255
-            return (string) preg_replace('#^' . preg_quote($dir, '#') . '#', "__DIR__ . '", $file);
255
+            return (string) preg_replace('#^'.preg_quote($dir, '#').'#', "__DIR__ . '", $file);
256 256
         }
257 257
 
258 258
         return $file;
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
         $class = new ReflectionClass($className);
285 285
         /** @var T $instance */
286 286
         $instance = $class->newInstanceWithoutConstructor();
287
-        if (! $instance instanceof $className) {
287
+        if (!$instance instanceof $className) {
288 288
             return;
289 289
         }
290 290
         $reader->getClassAnnotations($class);
@@ -314,11 +314,11 @@  discard block
 block discarded – undo
314 314
     private function saveNamedParam(NamedParameterInterface $namedParameter, object $instance, string $method) : void
315 315
     {
316 316
         // named parameter
317
-        if (! \in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
317
+        if (!\in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
318 318
             return;
319 319
         }
320 320
         $callable = [$instance, $method];
321
-        if (! is_callable($callable)) {
321
+        if (!is_callable($callable)) {
322 322
             return;
323 323
         }
324 324
         try {
@@ -338,13 +338,13 @@  discard block
 block discarded – undo
338 338
         $paths = [];
339 339
         foreach ($classes as $class) {
340 340
             // could be phpdoc tag by annotation loader
341
-            $isAutoloadFailed = ! class_exists($class, false) && ! interface_exists($class, false) && ! trait_exists($class, false);
341
+            $isAutoloadFailed = !class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false);
342 342
             if ($isAutoloadFailed) {
343 343
                 continue;
344 344
             }
345 345
             assert(class_exists($class) || interface_exists($class) || trait_exists($class));
346 346
             $filePath = (string) (new ReflectionClass($class))->getFileName();
347
-            if (! file_exists($filePath) || strpos($filePath, 'phar') === 0) {
347
+            if (!file_exists($filePath) || strpos($filePath, 'phar') === 0) {
348 348
                 continue;
349 349
             }
350 350
             $paths[] = $this->getRelativePath($this->appDir, $filePath);
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 
365 365
     private function getInstance(string $interface, string $name = '') : void
366 366
     {
367
-        $dependencyIndex = $interface . '-' . $name;
367
+        $dependencyIndex = $interface.'-'.$name;
368 368
         if (in_array($dependencyIndex, $this->compiled, true)) {
369 369
             printf("S %s:%s\n", $interface, $name);
370 370
 
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 
404 404
     private function hookNullObjectClass(string $appDir) : void
405 405
     {
406
-        $compileScript = realpath($appDir) . '/.compile.php';
406
+        $compileScript = realpath($appDir).'/.compile.php';
407 407
         if (file_exists($compileScript)) {
408 408
             require $compileScript;
409 409
         }
Please login to merge, or discard this patch.