Completed
Push — 1.0 ( 8819c3...b01434 )
by David
03:23
created
src/YamlDefinitionLoader.php 2 patches
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -4,9 +4,7 @@  discard block
 block discarded – undo
4 4
 use Assembly\AliasDefinition;
5 5
 use Assembly\FactoryDefinition;
6 6
 use Assembly\InstanceDefinition;
7
-use Assembly\MethodCall;
8 7
 use Assembly\ParameterDefinition;
9
-use Assembly\PropertyAssignment;
10 8
 use Assembly\Reference;
11 9
 use Interop\Container\Definition\DefinitionInterface;
12 10
 use Interop\Container\Definition\DefinitionProviderInterface;
@@ -14,7 +12,6 @@  discard block
 block discarded – undo
14 12
 use Symfony\Component\Yaml\Parser;
15 13
 use TheCodingMachine\Definition\Exception\FileNotFoundException;
16 14
 use TheCodingMachine\Definition\Exception\InvalidArgumentException;
17
-use TheCodingMachine\Definition\Exception\RuntimeException;
18 15
 
19 16
 class YamlDefinitionLoader implements DefinitionProviderInterface
20 17
 {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             $importFileName = $import['resource'];
98 98
 
99 99
             if (strpos($importFileName, '/') !== 0) {
100
-                $importFileName = dirname($this->fileName).'/'.$importFileName;
100
+                $importFileName = dirname($this->fileName) . '/' . $importFileName;
101 101
             }
102 102
 
103 103
             $yamlDefinitionLoader = new self($importFileName);
@@ -207,12 +207,12 @@  discard block
 block discarded – undo
207 207
             if (is_string($service['factory'])) {
208 208
                 if (strpos($service['factory'], ':') !== false && strpos($service['factory'], '::') === false) {
209 209
                     $parts = explode(':', $service['factory']);
210
-                    $definition = new FactoryDefinition($id, $this->resolveServices('@'.$parts[0]), $parts[1]);
210
+                    $definition = new FactoryDefinition($id, $this->resolveServices('@' . $parts[0]), $parts[1]);
211 211
                 } elseif (strpos($service['factory'], ':') !== false && strpos($service['factory'], '::') !== false) {
212 212
                     $parts = explode('::', $service['factory']);
213 213
                     $definition = new FactoryDefinition($id, $parts[0], $parts[1]);
214 214
                 } else {
215
-                    throw new InvalidArgumentException('A "factory" must be in the format "service_name:method_name" or "class_name::method_name".Got "'.$service['factory'].'"');
215
+                    throw new InvalidArgumentException('A "factory" must be in the format "service_name:method_name" or "class_name::method_name".Got "' . $service['factory'] . '"');
216 216
                 }
217 217
             } else {
218 218
                 $definition = new FactoryDefinition($id, $this->resolveServices($service['factory'][0]), $service['factory'][1]);
@@ -357,9 +357,9 @@  discard block
 block discarded – undo
357 357
     {
358 358
         if (is_array($value)) {
359 359
             return array_map(array($this, 'resolveServices'), $value);
360
-        } elseif (is_string($value) &&  0 === strpos($value, '@=')) {
360
+        } elseif (is_string($value) && 0 === strpos($value, '@=')) {
361 361
             throw new InvalidArgumentException('Expressions (starting by "@=") are not supported by YamlDefinitionLoader. This is a Symfony specific feature.');
362
-        } elseif (is_string($value) &&  0 === strpos($value, '@')) {
362
+        } elseif (is_string($value) && 0 === strpos($value, '@')) {
363 363
             if (0 === strpos($value, '@@')) {
364 364
                 return substr($value, 1);
365 365
             } elseif (0 === strpos($value, '@?')) {
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
             } else {
368 368
                 $value = substr($value, 1);
369 369
                 if ('=' === substr($value, -1)) {
370
-                    throw new InvalidArgumentException('Non-strict services (ending with "=") are not supported by YamlDefinitionLoader. This is a Symfony specific feature.');            } else {
370
+                    throw new InvalidArgumentException('Non-strict services (ending with "=") are not supported by YamlDefinitionLoader. This is a Symfony specific feature.'); } else {
371 371
                 }
372 372
                 return new Reference($value);
373 373
             }
Please login to merge, or discard this patch.