Completed
Push — fix-compile-autoload ( 9c5dea...1e91e0 )
by Akihito
02:39
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
         file_put_contents($fileName, $autoloadFile);
217 217
 
218 218
         return $fileName;
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 require __DIR__ . '/vendor/autoload.php'
237 237
 
238 238
 %s", $this->context, $requiredOnceFile);
239
-        $fileName = realpath($appMeta->appDir) . '/preload.php';
239
+        $fileName = realpath($appMeta->appDir).'/preload.php';
240 240
         file_put_contents($fileName, $preloadFile);
241 241
 
242 242
         return $fileName;
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
     {
247 247
         $dir = (string) realpath($rootDir);
248 248
         if (strpos($file, $dir) !== false) {
249
-            return (string) preg_replace('#^' . preg_quote($dir, '#') . '#', "__DIR__ . '", $file);
249
+            return (string) preg_replace('#^'.preg_quote($dir, '#').'#', "__DIR__ . '", $file);
250 250
         }
251 251
 
252 252
         return $file;
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         $class = new ReflectionClass($className);
279 279
         /** @var T $instance */
280 280
         $instance = $class->newInstanceWithoutConstructor();
281
-        if (! $instance instanceof $className) {
281
+        if (!$instance instanceof $className) {
282 282
             return;
283 283
         }
284 284
         $reader->getClassAnnotations($class);
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
     private function saveNamedParam(NamedParameterInterface $namedParameter, object $instance, string $method) : void
309 309
     {
310 310
         // named parameter
311
-        if (! \in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
311
+        if (!\in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
312 312
             return;
313 313
         }
314 314
         $callable = [$instance, $method];
315
-        if (! is_callable($callable)) {
315
+        if (!is_callable($callable)) {
316 316
             return;
317 317
         }
318 318
         try {
@@ -332,13 +332,13 @@  discard block
 block discarded – undo
332 332
         $paths = [];
333 333
         foreach ($classes as $class) {
334 334
             // could be phpdoc tag by annotation loader
335
-            $isAutoloadFailed = ! class_exists($class, false) && ! interface_exists($class, false) && ! trait_exists($class, false);
335
+            $isAutoloadFailed = !class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false);
336 336
             if ($isAutoloadFailed) {
337 337
                 continue;
338 338
             }
339 339
             assert(class_exists($class) || interface_exists($class) || trait_exists($class));
340 340
             $filePath = (string) (new ReflectionClass($class))->getFileName();
341
-            if (! file_exists($filePath) || strpos($filePath, 'phar') === 0) {
341
+            if (!file_exists($filePath) || strpos($filePath, 'phar') === 0) {
342 342
                 continue;
343 343
             }
344 344
             $paths[] = $this->getRelativePath($this->appDir, $filePath);
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 
359 359
     private function getInstance(string $interface, string $name = '') : void
360 360
     {
361
-        $dependencyIndex = $interface . '-' . $name;
361
+        $dependencyIndex = $interface.'-'.$name;
362 362
         if (in_array($dependencyIndex, $this->compiled, true)) {
363 363
             printf("S %s:%s\n", $interface, $name);
364 364
 
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 
398 398
     private function hookNullObjectClass(string $appDir) : void
399 399
     {
400
-        $compileScript = realpath($appDir) . '/.compile.php';
400
+        $compileScript = realpath($appDir).'/.compile.php';
401 401
         if (file_exists($compileScript)) {
402 402
             require $compileScript;
403 403
         }
Please login to merge, or discard this patch.