Completed
Push — compile ( 4bfe5a )
by Akihito
02:32
created
src/AppMetaModule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     protected function configure() : void
30 30
     {
31 31
         $this->bind(AbstractAppMeta::class)->toInstance($this->appMeta);
32
-        $this->bind(AppInterface::class)->to($this->appMeta->name . '\Module\App')->in(Scope::SINGLETON);
32
+        $this->bind(AppInterface::class)->to($this->appMeta->name.'\Module\App')->in(Scope::SINGLETON);
33 33
         $this->bind()->annotatedWith(AppName::class)->toInstance($this->appMeta->name);
34 34
     }
35 35
 }
Please login to merge, or discard this patch.
src/Provide/Router/RouterCollection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
             } catch (\Exception $e) {
38 38
                 throw new RouterException($e->getMessage(), (int) $e->getCode(), $e->getPrevious());
39 39
             }
40
-            if (! $match instanceof NullMatch) {
40
+            if (!$match instanceof NullMatch) {
41 41
                 return $match;
42 42
             }
43 43
         }
Please login to merge, or discard this patch.
src/Provide/Router/HttpMethodParams.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     private function getParams(string $method, array $server, array $post) : array
106 106
     {
107 107
         // post data exists
108
-        if ($method === 'post' && ! empty($post)) {
108
+        if ($method === 'post' && !empty($post)) {
109 109
             return $post;
110 110
         }
111 111
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
             return $put;
135 135
         }
136 136
         $isApplicationJson = strpos($contentType, self::APPLICATION_JSON) !== false;
137
-        if (! $isApplicationJson) {
137
+        if (!$isApplicationJson) {
138 138
             return [];
139 139
         }
140 140
         /** @var array<string, mixed> $content */
Please login to merge, or discard this patch.
src/Provide/Router/WebRouter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
         $request = new RouterMatch;
47 47
         /** @var array{HTTP_X_HTTP_METHOD_OVERRIDE?: string, REQUEST_METHOD: string} $server */
48 48
         [$request->method, $request->query] = $this->httpMethodParams->get($server, $globals['_GET'], $globals['_POST']);
49
-        $request->path = $this->schemeHost . parse_url($requestUri, 5); // 5 = PHP_URL_PATH
49
+        $request->path = $this->schemeHost.parse_url($requestUri, 5); // 5 = PHP_URL_PATH
50 50
 
51 51
         return $request;
52 52
     }
Please login to merge, or discard this patch.
src/Injector.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,6 @@
 block discarded – undo
9 9
 use BEAR\Package\Context\Provider\ProdCacheProvider;
10 10
 use BEAR\Package\Provide\Boot\ScriptinjectorModule;
11 11
 use BEAR\Sunday\Extension\Application\AppInterface;
12
-use Doctrine\Common\Cache\Cache;
13 12
 use Doctrine\Common\Cache\ChainCache;
14 13
 use Ray\Compiler\ScriptInjector;
15 14
 use Ray\Di\Injector as RayInjector;
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     public static function getInstance(string $appName, string $context, string $appDir, string $cacheNamespace = '') : InjectorInterface
32 32
     {
33
-        $injectorId = $appName . $context . $cacheNamespace;
33
+        $injectorId = $appName.$context.$cacheNamespace;
34 34
         if (isset(self::$instances[$injectorId])) {
35 35
             return self::$instances[$injectorId];
36 36
         }
@@ -46,18 +46,18 @@  discard block
 block discarded – undo
46 46
 
47 47
     private static function factory(Meta $meta, string $context, string $cacheNamespace, ChainCache $cache) : InjectorInterface
48 48
     {
49
-        $scriptDir = $meta->tmpDir . '/di';
50
-        ! is_dir($scriptDir) && ! @mkdir($scriptDir) && ! is_dir($scriptDir);
49
+        $scriptDir = $meta->tmpDir.'/di';
50
+        !is_dir($scriptDir) && !@mkdir($scriptDir) && !is_dir($scriptDir);
51 51
         $module = (new Module)($meta, $context, $cacheNamespace);
52 52
         $rayInjector = new RayInjector($module, $scriptDir);
53 53
         /** @var bool $isProd */
54 54
         $isProd = $rayInjector->getInstance(DiCompile::class);
55
-        if (! $isProd) {
55
+        if (!$isProd) {
56 56
             $rayInjector->getInstance(AppInterface::class);
57 57
 
58 58
             return $rayInjector;
59 59
         }
60
-        $scriptInjector = new ScriptInjector($scriptDir, function () use ($scriptDir, $module) {
60
+        $scriptInjector = new ScriptInjector($scriptDir, function() use ($scriptDir, $module) {
61 61
             return new ScriptinjectorModule($scriptDir, $module);
62 62
         });
63 63
         $scriptInjector->getInstance(AppInterface::class); // cache App as a singleton
Please login to merge, or discard this patch.
src/Compiler.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,6 @@
 block discarded – undo
14 14
 use BEAR\Sunday\Extension\Application\AppInterface;
15 15
 use Composer\Autoload\ClassLoader;
16 16
 use Doctrine\Common\Annotations\Reader;
17
-use Doctrine\Common\Cache\Cache;
18 17
 use function file_exists;
19 18
 use Ray\Di\AbstractModule;
20 19
 use Ray\Di\InjectorInterface;
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      */
91 91
     public function compile() : int
92 92
     {
93
-        if (! is_dir($this->appDir)) {
93
+        if (!is_dir($this->appDir)) {
94 94
             throw new \RuntimeException($this->appDir);
95 95
         }
96 96
         $preload = $this->compilePreload($this->appMeta, $this->context);
@@ -131,15 +131,15 @@  discard block
 block discarded – undo
131 131
 
132 132
     public function registerLoader(string $appDir) : void
133 133
     {
134
-        $loaderFile = $appDir . '/vendor/autoload.php';
135
-        if (! file_exists($loaderFile)) {
134
+        $loaderFile = $appDir.'/vendor/autoload.php';
135
+        if (!file_exists($loaderFile)) {
136 136
             throw new \RuntimeException('no loader');
137 137
         }
138 138
         /** @var ClassLoader $loader */
139 139
         $loader = require $loaderFile;
140 140
         spl_autoload_register(
141 141
             /** @var class-string $class */
142
-            function (string $class) use ($loader) : void {
142
+            function(string $class) use ($loader) : void {
143 143
                 $loader->loadClass($class);
144 144
                 if ($class !== NullPage::class) {
145 145
                     $this->classes[] = $class;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      */
193 193
     private function saveAutoloadFile(string $appDir, array $paths) : string
194 194
     {
195
-        $autoloadFile = '<?php' . PHP_EOL . 'require __DIR__ . \'/vendor/ray/di/src/ProviderInterface.php\';
195
+        $autoloadFile = '<?php'.PHP_EOL.'require __DIR__ . \'/vendor/ray/di/src/ProviderInterface.php\';
196 196
 ' . PHP_EOL;
197 197
         foreach ($paths as $path) {
198 198
             $autoloadFile .= sprintf(
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
                 $this->getRelativePath($appDir, $path)
201 201
             );
202 202
         }
203
-        $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL;
204
-        $loaderFile = realpath($appDir) . '/autoload.php';
203
+        $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL;
204
+        $loaderFile = realpath($appDir).'/autoload.php';
205 205
         file_put_contents($loaderFile, $autoloadFile);
206 206
 
207 207
         return $loaderFile;
@@ -211,15 +211,15 @@  discard block
 block discarded – undo
211 211
     {
212 212
         $this->loadResources($appMeta->name, $context, $appMeta->appDir);
213 213
         $paths = $this->getPaths($this->classes);
214
-        $output = '<?php' . PHP_EOL;
215
-        $output .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL;
214
+        $output = '<?php'.PHP_EOL;
215
+        $output .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL;
216 216
         foreach ($paths as $path) {
217 217
             $output .= sprintf(
218 218
                 "require_once %s';\n",
219 219
                 $this->getRelativePath($appMeta->appDir, $path)
220 220
             );
221 221
         }
222
-        $preloadFile = realpath($appMeta->appDir) . '/preload.php';
222
+        $preloadFile = realpath($appMeta->appDir).'/preload.php';
223 223
         file_put_contents($preloadFile, $output);
224 224
 
225 225
         return $preloadFile;
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     {
230 230
         $dir = (string) realpath($rootDir);
231 231
         if (strpos($file, $dir) !== false) {
232
-            return (string) preg_replace('#^' . preg_quote($dir, '#') . '#', "__DIR__ . '", $file);
232
+            return (string) preg_replace('#^'.preg_quote($dir, '#').'#', "__DIR__ . '", $file);
233 233
         }
234 234
 
235 235
         return $file;
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         $class = new \ReflectionClass($className);
262 262
         /** @var T $instance */
263 263
         $instance = $class->newInstanceWithoutConstructor();
264
-        if (! $instance instanceof $className) {
264
+        if (!$instance instanceof $className) {
265 265
             return;
266 266
         }
267 267
         $reader->getClassAnnotations($class);
@@ -291,11 +291,11 @@  discard block
 block discarded – undo
291 291
     private function saveNamedParam(NamedParameterInterface $namedParameter, object $instance, string $method) : void
292 292
     {
293 293
         // named parameter
294
-        if (! \in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
294
+        if (!\in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
295 295
             return;
296 296
         }
297 297
         $callable = [$instance, $method];
298
-        if (! is_callable($callable)) {
298
+        if (!is_callable($callable)) {
299 299
             return;
300 300
         }
301 301
         try {
@@ -315,13 +315,13 @@  discard block
 block discarded – undo
315 315
         $paths = [];
316 316
         foreach ($classes as $class) {
317 317
             // could be phpdoc tag by annotation loader
318
-            $isAutoloadFailed = ! class_exists($class, false) && ! interface_exists($class, false) && ! trait_exists($class, false);
318
+            $isAutoloadFailed = !class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false);
319 319
             if ($isAutoloadFailed) {
320 320
                 continue;
321 321
             }
322 322
             assert(class_exists($class) || interface_exists($class) || trait_exists($class));
323 323
             $filePath = (string) (new ReflectionClass($class))->getFileName();
324
-            if (! file_exists($filePath) || strpos($filePath, 'phar') === 0) {
324
+            if (!file_exists($filePath) || strpos($filePath, 'phar') === 0) {
325 325
                 continue;
326 326
             }
327 327
             $paths[] = $this->getRelativePath($this->appDir, $filePath);
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 
342 342
     private function getInstance(string $interface, string $name = '') : void
343 343
     {
344
-        $dependencyIndex = $interface . '-' . $name;
344
+        $dependencyIndex = $interface.'-'.$name;
345 345
         if (in_array($dependencyIndex, $this->compiled, true)) {
346 346
             printf("S %s:%s\n", $interface, $name);
347 347
 
Please login to merge, or discard this patch.