Completed
Pull Request — 1.0 (#8)
by David
06:24
created
src/Definition/ValueUtils.php 1 patch
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -25,6 +25,9 @@  discard block
 block discarded – undo
25 25
         }
26 26
     }
27 27
 
28
+    /**
29
+     * @param string $containerVariable
30
+     */
28 31
     public static function dumpArguments($argumentsValues, $containerVariable, array $usedVariables) {
29 32
         $arguments = [];
30 33
         $prependedCode = [];
@@ -41,6 +44,9 @@  discard block
 block discarded – undo
41 44
         return new InlineEntry($argumentsCode, $prependedCodeString, $usedVariables);
42 45
     }
43 46
 
47
+    /**
48
+     * @param string $containerVariable
49
+     */
44 50
     private static function dumpArray(array $value, $containerVariable, array $usedVariables) {
45 51
         $code = array();
46 52
         $prependCode = array();
@@ -58,6 +64,9 @@  discard block
 block discarded – undo
58 64
         return new InlineEntry(sprintf('array(%s)', implode(', ', $code)), implode("\n", $prependCode), $usedVariables);
59 65
     }
60 66
 
67
+    /**
68
+     * @param string $containerVariable
69
+     */
61 70
     private static function dumpDefinition(DumpableInterface $definition, $containerVariable, array $usedVariables) {
62 71
         // If the identifier is null, we must inline the definition.
63 72
         if ($definition->getIdentifier() === null) {
Please login to merge, or discard this patch.
src/Compiler.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
         // Let's merge dumpable definitions with standard definitions.
96 96
         $convertedDefinitions = array_map([$this->converter, 'convert'], $this->definitions);
97
-        $allDefinitions = $convertedDefinitions + $this->dumpableDefinitions;
97
+        $allDefinitions = $convertedDefinitions+$this->dumpableDefinitions;
98 98
 
99 99
         foreach ($allDefinitions as $identifier => $definition) {
100 100
             $inlineEntry = $definition->toPhpCode('$container', ['$container']);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     {
114 114
         $pos = strrpos($className, '\\');
115 115
         if ($pos !== false) {
116
-            $shortClassName = substr($className, $pos + 1);
116
+            $shortClassName = substr($className, $pos+1);
117 117
             $namespaceLine = 'namespace '.substr($className, 0, $pos).';';
118 118
         } else {
119 119
             $shortClassName = $className;
Please login to merge, or discard this patch.
src/Definition/VariableUtils.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@
 block discarded – undo
23 23
 
24 24
             $numbers = '';
25 25
             while (true) {
26
-                $lastCharacter = substr($variable, strlen($variable) - 1);
26
+                $lastCharacter = substr($variable, strlen($variable)-1);
27 27
                 if ($lastCharacter >= '0' && $lastCharacter <= '9') {
28 28
                     $numbers = $lastCharacter.$numbers;
29
-                    $variable = substr($variable, 0, strlen($variable) - 1);
29
+                    $variable = substr($variable, 0, strlen($variable)-1);
30 30
                 } else {
31 31
                     break;
32 32
                 }
Please login to merge, or discard this patch.
src/DefinitionConverter.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 {
23 23
     /**
24 24
      * @param string $identifier
25
-     * @param DefinitionInterface|mixed $definition
25
+     * @param DefinitionInterface $definition
26 26
      * @return AliasDefinition|FactoryCallDefinition|ObjectDefinition|ParameterDefinition
27 27
      */
28 28
     public function convert($identifier, $definition)
Please login to merge, or discard this patch.
src/ServiceProvider/ServiceProviderLoader.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,6 @@  discard block
 block discarded – undo
64 64
 
65 65
     /**
66 66
      * @param string $serviceName
67
-     * @param ServiceProvider $serviceProvider
68 67
      * @param int $serviceProviderKey
69 68
      * @param callable $callable
70 69
      * @throws \TheCodingMachine\Yaco\CompilerException
@@ -122,11 +121,12 @@  discard block
 block discarded – undo
122 121
     }
123 122
 
124 123
     /**
125
-     * @param $serviceName
124
+     * @param string $serviceName
126 125
      * @param int $serviceProviderKey
127 126
      * @param callable $callable
128 127
      * @param ContainerDefinition $containerDefinition
129 128
      * @param CallbackWrapperDefinition|null $callbackWrapperDefinition
129
+     * @param string $decoratedServiceName
130 130
      * @return DumpableInterface
131 131
      */
132 132
     private function getServiceDefinitionFromCallable($decoratedServiceName, $serviceName, $serviceProviderKey, callable $callable, ContainerDefinition $containerDefinition, CallbackWrapperDefinition $callbackWrapperDefinition = null) {
Please login to merge, or discard this patch.
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -6,8 +6,6 @@  discard block
 block discarded – undo
6 6
 
7 7
 use Interop\Container\Definition\DefinitionInterface;
8 8
 use Interop\Container\ServiceProvider;
9
-use Puli\Discovery\Api\Discovery;
10
-use Puli\Discovery\Binding\ClassBinding;
11 9
 use TheCodingMachine\ServiceProvider\Registry;
12 10
 use TheCodingMachine\Yaco\Compiler;
13 11
 use TheCodingMachine\Yaco\CompilerException;
@@ -15,7 +13,6 @@  discard block
 block discarded – undo
15 13
 use TheCodingMachine\Yaco\Definition\DumpableInterface;
16 14
 use TheCodingMachine\Yaco\Definition\FactoryCallDefinition;
17 15
 use TheCodingMachine\Yaco\Definition\Reference;
18
-use TheCodingMachine\Yaco\DefinitionConverter;
19 16
 use TheCodingMachine\Yaco\DefinitionConverterInterface;
20 17
 
21 18
 class ServiceProviderLoader
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace TheCodingMachine\Yaco\ServiceProvider;
5 5
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
             return $this->converter->convert($decoratedServiceName, $callable);
135 135
         }
136 136
         if (is_array($callable) && is_string($callable[0])) {
137
-            $params = [ $containerDefinition ];
137
+            $params = [$containerDefinition];
138 138
             if ($callbackWrapperDefinition) {
139 139
                 $params[] = $callbackWrapperDefinition;
140 140
             }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
             $pos = strpos($callable, '::');
144 144
             $className = substr($callable, 0, $pos);
145 145
             $methodName = substr($callable, $pos+2);
146
-            $params = [ $containerDefinition ];
146
+            $params = [$containerDefinition];
147 147
             if ($callbackWrapperDefinition) {
148 148
                 $params[] = $callbackWrapperDefinition;
149 149
             }
Please login to merge, or discard this patch.