Passed
Branch main (a99a01)
by Michael
03:35
created
src/Core/CallProxy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
      * @param array         $dependencies
32 32
      */
33 33
     public function __construct(
34
-        private object | string $class,
34
+        private object|string $class,
35 35
         private array $dependencies = []
36 36
     ) {
37 37
         $this->resolved = $this->resolvePassedClass(
Please login to merge, or discard this patch.
src/Core/MethodForwarder.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
      * @param array         $dependencies
20 20
      */
21 21
     public function __construct(
22
-        private object | string $class,
22
+        private object|string $class,
23 23
         private array $dependencies
24 24
     ) {
25 25
     }
@@ -44,19 +44,19 @@  discard block
 block discarded – undo
44 44
         return collect(
45 45
             $this->convertToNamespace($this->class)
46 46
         )->pipe(
47
-            fn ($class) => collect(
47
+            fn($class) => collect(
48 48
                 explode(self::CLASS_SEPARATOR, $class[0])
49 49
             )
50 50
         )->pipe(
51
-            fn ($delimited) => $delimited->map(
52
-                fn ($item) => str_replace(
51
+            fn($delimited) => $delimited->map(
52
+                fn($item) => str_replace(
53 53
                     Str::{config('enhanced-container.from.naming')}(config('enhanced-container.from.layer')),
54 54
                     Str::{config('enhanced-container.to.naming')}(config('enhanced-container.to.layer')),
55 55
                     $item
56 56
                 )
57 57
             )
58 58
         )->pipe(
59
-            fn ($structure) => implode(
59
+            fn($structure) => implode(
60 60
                 self::CLASS_SEPARATOR,
61 61
                 $structure->put(
62 62
                     $structure->keys()->last(),
Please login to merge, or discard this patch.
src/Bind.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,5 +67,5 @@
 block discarded – undo
67 67
      *
68 68
      * @return void
69 69
      */
70
-    public function for(array|string $concrete): void;
70
+    public function for (array|string $concrete): void;
71 71
 }
Please login to merge, or discard this patch.
src/Traits/HelpsProxies.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
         return is_object($class)
21 21
             ? $class
22 22
             : rescue(
23
-                function () use ($class, $dependencies): object {
24
-                    if (! empty($dependencies) && ! Arr::isAssoc($dependencies)) {
23
+                function() use ($class, $dependencies) : object {
24
+                    if (!empty($dependencies) && !Arr::isAssoc($dependencies)) {
25 25
                         $constructor = (new \ReflectionClass($class))->getConstructor();
26 26
 
27 27
                         if ($constructor) {
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
                     return resolve($class, $dependencies);
36 36
                 },
37
-                fn ($e) => throw new \BadMethodCallException($e->getMessage())
37
+                fn($e) => throw new \BadMethodCallException($e->getMessage())
38 38
             );
39 39
     }
40 40
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     {
73 73
         return collect($parameters)
74 74
             ->slice(0, count($toCombine))
75
-            ->map(fn ($param) => $param->getName())
75
+            ->map(fn($param) => $param->getName())
76 76
             ->combine(array_slice($toCombine, 0, count($parameters)))
77 77
             ->all();
78 78
     }
Please login to merge, or discard this patch.
src/Overrides/Container.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
         // If the factory is not a Closure, it means it is just a class name which is
261 261
         // bound into this container to the abstract type and we will just wrap it
262 262
         // up inside its own Closure to give us more convenience when extending.
263
-        if (! $concrete instanceof Closure) {
264
-            if (! is_string($concrete)) {
263
+        if (!$concrete instanceof Closure) {
264
+            if (!is_string($concrete)) {
265 265
                 throw new TypeError(self::class.'::bind(): Argument #2 ($concrete) must be of type Closure|string|null');
266 266
             }
267 267
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
      */
288 288
     protected function getClosure($abstract, $concrete)
289 289
     {
290
-        return function ($container, $parameters = []) use ($abstract, $concrete) {
290
+        return function($container, $parameters = []) use ($abstract, $concrete) {
291 291
             if ($abstract == $concrete) {
292 292
                 return $container->build($concrete);
293 293
             }
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
      */
374 374
     public function bindIf($abstract, $concrete = null, $shared = false)
375 375
     {
376
-        if (! $this->bound($abstract)) {
376
+        if (!$this->bound($abstract)) {
377 377
             $this->bind($abstract, $concrete, $shared);
378 378
         }
379 379
     }
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
      */
400 400
     public function singletonIf($abstract, $concrete = null)
401 401
     {
402
-        if (! $this->bound($abstract)) {
402
+        if (!$this->bound($abstract)) {
403 403
             $this->singleton($abstract, $concrete);
404 404
         }
405 405
     }
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
      */
428 428
     public function scopedIf($abstract, $concrete = null)
429 429
     {
430
-        if (! $this->bound($abstract)) {
430
+        if (!$this->bound($abstract)) {
431 431
             $this->scopedInstances[] = $abstract;
432 432
 
433 433
             $this->singleton($abstract, $concrete);
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
      */
496 496
     protected function removeAbstractAlias($searched)
497 497
     {
498
-        if (! isset($this->aliases[$searched])) {
498
+        if (!isset($this->aliases[$searched])) {
499 499
             return;
500 500
         }
501 501
 
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
         $tags = is_array($tags) ? $tags : array_slice(func_get_args(), 1);
521 521
 
522 522
         foreach ($tags as $tag) {
523
-            if (! isset($this->tags[$tag])) {
523
+            if (!isset($this->tags[$tag])) {
524 524
                 $this->tags[$tag] = [];
525 525
             }
526 526
 
@@ -538,11 +538,11 @@  discard block
 block discarded – undo
538 538
      */
539 539
     public function tagged($tag)
540 540
     {
541
-        if (! isset($this->tags[$tag])) {
541
+        if (!isset($this->tags[$tag])) {
542 542
             return [];
543 543
         }
544 544
 
545
-        return new RewindableGenerator(function () use ($tag) {
545
+        return new RewindableGenerator(function() use ($tag) {
546 546
             foreach ($this->tags[$tag] as $abstract) {
547 547
                 yield $this->make($abstract);
548 548
             }
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
      */
596 596
     public function refresh($abstract, $target, $method)
597 597
     {
598
-        return $this->rebinding($abstract, function ($app, $instance) use ($target, $method) {
598
+        return $this->rebinding($abstract, function($app, $instance) use ($target, $method) {
599 599
             $target->{$method}($instance);
600 600
         });
601 601
     }
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
      */
636 636
     public function wrap(Closure $callback, array $parameters = [])
637 637
     {
638
-        return function () use ($callback, $parameters) {
638
+        return function() use ($callback, $parameters) {
639 639
             return $this->call($callback, $parameters);
640 640
         };
641 641
     }
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
      */
664 664
     public function factory($abstract)
665 665
     {
666
-        return function () use ($abstract) {
666
+        return function() use ($abstract) {
667 667
             return $this->make($abstract);
668 668
         };
669 669
     }
@@ -738,12 +738,12 @@  discard block
 block discarded – undo
738 738
 
739 739
         $concrete = $this->getContextualConcrete($abstract);
740 740
 
741
-        $needsContextualBuild = ! empty($parameters) || ! is_null($concrete);
741
+        $needsContextualBuild = !empty($parameters) || !is_null($concrete);
742 742
 
743 743
         // If an instance of the type is currently being managed as a singleton we'll
744 744
         // just return an existing instance instead of instantiating new instances
745 745
         // so the developer can keep using the same objects instance every time.
746
-        if (isset($this->instances[$abstract]) && ! $needsContextualBuild) {
746
+        if (isset($this->instances[$abstract]) && !$needsContextualBuild) {
747 747
             return $this->instances[$abstract];
748 748
         }
749 749
 
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
         // If the requested type is registered as a singleton we'll want to cache off
773 773
         // the instances in "memory" so we can return it later without creating an
774 774
         // entirely new instance of an object on each subsequent request for it.
775
-        if ($this->isShared($abstract) && ! $needsContextualBuild) {
775
+        if ($this->isShared($abstract) && !$needsContextualBuild) {
776 776
             $this->instances[$abstract] = $object;
777 777
         }
778 778
 
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
      */
817 817
     protected function getContextualConcrete($abstract)
818 818
     {
819
-        if (! is_null($binding = $this->findInContextualBindings($abstract))) {
819
+        if (!is_null($binding = $this->findInContextualBindings($abstract))) {
820 820
             return $binding;
821 821
         }
822 822
 
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
         }
829 829
 
830 830
         foreach ($this->abstractAliases[$abstract] as $alias) {
831
-            if (! is_null($binding = $this->findInContextualBindings($alias))) {
831
+            if (!is_null($binding = $this->findInContextualBindings($alias))) {
832 832
                 return $binding;
833 833
             }
834 834
         }
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
         // If the type is not instantiable, the developer is attempting to resolve
885 885
         // an abstract type such as an Interface or Abstract Class and there is
886 886
         // no binding registered for the abstractions so we need to bail out.
887
-        if (! $reflector->isInstantiable()) {
887
+        if (!$reflector->isInstantiable()) {
888 888
             return $this->notInstantiable($concrete);
889 889
         }
890 890
 
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
      */
1007 1007
     protected function resolvePrimitive(ReflectionParameter $parameter)
1008 1008
     {
1009
-        if (! is_null($concrete = $this->getContextualConcrete('$'.$parameter->getName()))) {
1009
+        if (!is_null($concrete = $this->getContextualConcrete('$'.$parameter->getName()))) {
1010 1010
             return $concrete instanceof Closure ? $concrete($this) : $concrete;
1011 1011
         }
1012 1012
 
@@ -1065,11 +1065,11 @@  discard block
 block discarded – undo
1065 1065
 
1066 1066
         $abstract = $this->getAlias($className);
1067 1067
 
1068
-        if (! is_array($concrete = $this->getContextualConcrete($abstract))) {
1068
+        if (!is_array($concrete = $this->getContextualConcrete($abstract))) {
1069 1069
             return $this->make($className);
1070 1070
         }
1071 1071
 
1072
-        return array_map(function ($abstract) {
1072
+        return array_map(function($abstract) {
1073 1073
             return $this->resolve($abstract);
1074 1074
         }, $concrete);
1075 1075
     }
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
      */
1085 1085
     protected function notInstantiable($concrete)
1086 1086
     {
1087
-        if (! empty($this->buildStack)) {
1087
+        if (!empty($this->buildStack)) {
1088 1088
             $previous = implode(', ', $this->buildStack);
1089 1089
 
1090 1090
             $message = "Target [$concrete] is not instantiable while building [$previous].";
@@ -1446,7 +1446,7 @@  discard block
 block discarded – undo
1446 1446
     #[\ReturnTypeWillChange]
1447 1447
     public function offsetSet($key, $value)
1448 1448
     {
1449
-        $this->bind($key, $value instanceof Closure ? $value : function () use ($value) {
1449
+        $this->bind($key, $value instanceof Closure ? $value : function() use ($value) {
1450 1450
             return $value;
1451 1451
         });
1452 1452
     }
Please login to merge, or discard this patch.
src/Overrides/BoundMethod.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public static function call($container, $callback, array $parameters = [], $defaultMethod = null)
26 26
     {
27
-        if (is_string($callback) && ! $defaultMethod && method_exists($callback, '__invoke')) {
27
+        if (is_string($callback) && !$defaultMethod && method_exists($callback, '__invoke')) {
28 28
             $defaultMethod = '__invoke';
29 29
         }
30 30
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
             return static::callClass($container, $callback, $parameters, $defaultMethod);
33 33
         }
34 34
 
35
-        return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
35
+        return static::callBoundMethod($container, $callback, function() use ($container, $callback, $parameters) {
36 36
             return $callback(...array_values(static::getMethodDependencies($container, $callback, $parameters)));
37 37
         });
38 38
     }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     protected static function callBoundMethod($container, $callback, $default)
81 81
     {
82
-        if (! is_array($callback)) {
82
+        if (!is_array($callback)) {
83 83
             return Util::unwrapIfClosure($default);
84 84
         }
85 85
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     {
148 148
         if (is_string($callback) && strpos($callback, '::') !== false) {
149 149
             $callback = explode('::', $callback);
150
-        } elseif (is_object($callback) && ! $callback instanceof Closure) {
150
+        } elseif (is_object($callback) && !$callback instanceof Closure) {
151 151
             $callback = [$callback, '__invoke'];
152 152
         }
153 153
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
             $dependencies[] = $parameters[$paramName];
175 175
 
176 176
             unset($parameters[$paramName]);
177
-        } elseif (! is_null($className = Util::getParameterClassName($parameter))) {
177
+        } elseif (!is_null($className = Util::getParameterClassName($parameter))) {
178 178
             if (array_key_exists($className, $parameters)) {
179 179
                 $dependencies[] = $parameters[$className];
180 180
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
             }
185 185
         } elseif ($parameter->isDefaultValueAvailable()) {
186 186
             $dependencies[] = $parameter->getDefaultValue();
187
-        } elseif (! $parameter->isOptional() && ! array_key_exists($paramName, $parameters)) {
187
+        } elseif (!$parameter->isOptional() && !array_key_exists($paramName, $parameters)) {
188 188
             $message = "Unable to resolve dependency [{$parameter}] in class {$parameter->getDeclaringClass()->getName()}";
189 189
 
190 190
             throw new BindingResolutionException($message);
Please login to merge, or discard this patch.
src/LecServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
      */
32 32
     public function packageBooted(): void
33 33
     {
34
-        $this->app->bind(Call::class, function ($_app, $params) {
34
+        $this->app->bind(Call::class, function($_app, $params) {
35 35
             return new CallProxy(
36 36
                 current($params),
37 37
                 last($params)
Please login to merge, or discard this patch.
src/Helpers/helpers.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 use MichaelRubel\EnhancedContainer\Call;
6 6
 use MichaelRubel\EnhancedContainer\Core\BindingBuilder;
7 7
 
8
-if (! function_exists('call')) {
8
+if (!function_exists('call')) {
9 9
     /**
10 10
      * @param string|object $class
11 11
      * @param array         $parameters
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     }
19 19
 }
20 20
 
21
-if (! function_exists('bind')) {
21
+if (!function_exists('bind')) {
22 22
     /**
23 23
      * @param string|object $abstract
24 24
      *
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     }
31 31
 }
32 32
 
33
-if (! function_exists('singleton')) {
33
+if (!function_exists('singleton')) {
34 34
     /**
35 35
      * @param string              $abstract
36 36
      * @param Closure|string|null $concrete
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     }
44 44
 }
45 45
 
46
-if (! function_exists('scoped')) {
46
+if (!function_exists('scoped')) {
47 47
     /**
48 48
      * @param string              $abstract
49 49
      * @param Closure|string|null $concrete
Please login to merge, or discard this patch.
src/Traits/BootsCallProxies.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@
 block discarded – undo
22 22
     {
23 23
         $dependencies = (
24 24
             new \ReflectionClass(static::class)
25
-        )?->getConstructor()?->getParameters();
25
+        ) ? ->getConstructor() ? ->getParameters();
26 26
 
27
-        if (! empty($dependencies)) {
27
+        if (!empty($dependencies)) {
28 28
             $this->proxy = new Fluent();
29 29
 
30
-            collect($dependencies)->map(function ($param) {
30
+            collect($dependencies)->map(function($param) {
31 31
                 $class = $param->getType()->getName();
32 32
 
33 33
                 if (class_exists($class) || interface_exists($class)) {
Please login to merge, or discard this patch.