@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | $e = new PropertyExtractor(); |
| 22 | 22 | |
| 23 | 23 | $expected = ['test', 'test2', 'test3', 'testClass']; |
| 24 | - $prototypes = $e->getPrototypeProperties(file_get_contents(__DIR__ . '/Fixtures/TestClass.php')); |
|
| 24 | + $prototypes = $e->getPrototypeProperties(file_get_contents(__DIR__.'/Fixtures/TestClass.php')); |
|
| 25 | 25 | sort($prototypes); |
| 26 | 26 | $this->assertSame($expected, $prototypes); |
| 27 | 27 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $e = new PropertyExtractor(); |
| 32 | 32 | $this->assertSame( |
| 33 | 33 | [], |
| 34 | - $e->getPrototypeProperties(file_get_contents(__DIR__ . '/Fixtures/HydratedClass.php')) |
|
| 34 | + $e->getPrototypeProperties(file_get_contents(__DIR__.'/Fixtures/HydratedClass.php')) |
|
| 35 | 35 | ); |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | public function testNoClass(): void |
| 19 | 19 | { |
| 20 | 20 | $this->expectException(ClassNotDeclaredException::class); |
| 21 | - $this->getExtractor()->extract(dirname(__DIR__) . '/Fixtures/noClass.php', []); |
|
| 21 | + $this->getExtractor()->extract(dirname(__DIR__).'/Fixtures/noClass.php', []); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | private function getExtractor(): NodeExtractor |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | ?int $int = 123, |
| 21 | 21 | \StdClass $nullableClass2 = null, |
| 22 | 22 | string ...$variadicVar |
| 23 | - ) { |
|
| 23 | + ){ |
|
| 24 | 24 | $var2 = new ATest3(); |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -13,12 +13,12 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public static function getParams(string $method): array |
| 15 | 15 | { |
| 16 | - try { |
|
| 16 | + try{ |
|
| 17 | 17 | $rc = new \ReflectionClass(self::class); |
| 18 | 18 | $method = $rc->getMethod($method); |
| 19 | 19 | |
| 20 | 20 | return $method->getParameters(); |
| 21 | - } catch (\ReflectionException $e) { |
|
| 21 | + }catch (\ReflectionException $e){ |
|
| 22 | 22 | return []; |
| 23 | 23 | } |
| 24 | 24 | } |
@@ -13,12 +13,15 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public static function getParams(string $method): array |
| 15 | 15 | { |
| 16 | - try { |
|
| 16 | + try |
|
| 17 | + { |
|
| 17 | 18 | $rc = new \ReflectionClass(self::class); |
| 18 | 19 | $method = $rc->getMethod($method); |
| 19 | 20 | |
| 20 | 21 | return $method->getParameters(); |
| 21 | - } catch (\ReflectionException $e) { |
|
| 22 | + } |
|
| 23 | + catch (\ReflectionException $e) |
|
| 24 | + { |
|
| 22 | 25 | return []; |
| 23 | 26 | } |
| 24 | 27 | } |
@@ -27,7 +27,8 @@ discard block |
||
| 27 | 27 | $cd = ClassNode::create('class\name'); |
| 28 | 28 | $cd->constructorVars = $vars; |
| 29 | 29 | |
| 30 | - foreach (Fixtures\Params::getParams($method) as $param) { |
|
| 30 | + foreach (Fixtures\Params::getParams($method) as $param) |
|
| 31 | + { |
|
| 31 | 32 | $cd->addParam($param); |
| 32 | 33 | } |
| 33 | 34 | |
@@ -35,7 +36,8 @@ discard block |
||
| 35 | 36 | $this->names()->resolve($cd); |
| 36 | 37 | |
| 37 | 38 | $resolved = []; |
| 38 | - foreach ($cd->dependencies as $dependency) { |
|
| 39 | + foreach ($cd->dependencies as $dependency) |
|
| 40 | + { |
|
| 39 | 41 | $resolved[] = $dependency->var; |
| 40 | 42 | } |
| 41 | 43 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $cd = ClassNode::create('class\name'); |
| 21 | 21 | $cd->constructorVars = $vars; |
| 22 | 22 | |
| 23 | - foreach (Fixtures\Params::getParams($method) as $param) { |
|
| 23 | + foreach (Fixtures\Params::getParams($method) as $param){ |
|
| 24 | 24 | $cd->addParam($param); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $this->names()->resolve($cd); |
| 29 | 29 | |
| 30 | 30 | $resolved = []; |
| 31 | - foreach ($cd->dependencies as $dependency) { |
|
| 31 | + foreach ($cd->dependencies as $dependency){ |
|
| 32 | 32 | $resolved[] = $dependency->var; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | yield [ |
| 41 | 41 | 'paramsSource', |
| 42 | 42 | [], |
| 43 | - ['v2' => 'type1', 'v' => 'type2', 'vv' => 'type3',], |
|
| 43 | + ['v2' => 'type1', 'v' => 'type2', 'vv' => 'type3', ], |
|
| 44 | 44 | ['v2', 'v', 'vv'] |
| 45 | 45 | ]; |
| 46 | 46 | yield [ |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | $cd = ClassNode::create('class\name'); |
| 27 | 27 | |
| 28 | - foreach ($stmts as $alias => $name) { |
|
| 28 | + foreach ($stmts as $alias => $name){ |
|
| 29 | 29 | $cd->addImportUsage($name, $alias); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - foreach (Fixtures\Params::getParams('paramsSource') as $param) { |
|
| 32 | + foreach (Fixtures\Params::getParams('paramsSource') as $param){ |
|
| 33 | 33 | $cd->addParam($param); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $this->namespaces()->resolve($cd); |
| 38 | 38 | |
| 39 | 39 | $resolved = []; |
| 40 | - foreach ($cd->dependencies as $dependency) { |
|
| 40 | + foreach ($cd->dependencies as $dependency){ |
|
| 41 | 41 | $resolved[$dependency->property] = $dependency->type->getAliasOrShortName(); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -25,11 +25,13 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | $cd = ClassNode::create('class\name'); |
| 27 | 27 | |
| 28 | - foreach ($stmts as $alias => $name) { |
|
| 28 | + foreach ($stmts as $alias => $name) |
|
| 29 | + { |
|
| 29 | 30 | $cd->addImportUsage($name, $alias); |
| 30 | 31 | } |
| 31 | 32 | |
| 32 | - foreach (Fixtures\Params::getParams('paramsSource') as $param) { |
|
| 33 | + foreach (Fixtures\Params::getParams('paramsSource') as $param) |
|
| 34 | + { |
|
| 33 | 35 | $cd->addParam($param); |
| 34 | 36 | } |
| 35 | 37 | |
@@ -37,7 +39,8 @@ discard block |
||
| 37 | 39 | $this->namespaces()->resolve($cd); |
| 38 | 40 | |
| 39 | 41 | $resolved = []; |
| 40 | - foreach ($cd->dependencies as $dependency) { |
|
| 42 | + foreach ($cd->dependencies as $dependency) |
|
| 43 | + { |
|
| 41 | 44 | $resolved[$dependency->property] = $dependency->type->getAliasOrShortName(); |
| 42 | 45 | } |
| 43 | 46 | |
@@ -64,7 +64,8 @@ |
||
| 64 | 64 | $c->bindSingleton(TestClass::class, $t); |
| 65 | 65 | $p->bindProperty('testClass', TestClass::class); |
| 66 | 66 | |
| 67 | - $r = ContainerScope::runScope($c, static function () use ($t) { |
|
| 67 | + $r = ContainerScope::runScope($c, static function () use ($t) |
|
| 68 | + { |
|
| 68 | 69 | return $t->getTest(); |
| 69 | 70 | }); |
| 70 | 71 | |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | public static function convert(array $deps): array |
| 19 | 19 | { |
| 20 | 20 | $converted = []; |
| 21 | - foreach ($deps as $name => $type) { |
|
| 21 | + foreach ($deps as $name => $type){ |
|
| 22 | 22 | $converted[$name] = Dependency::create($name, $type); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -18,7 +18,8 @@ |
||
| 18 | 18 | public static function convert(array $deps): array |
| 19 | 19 | { |
| 20 | 20 | $converted = []; |
| 21 | - foreach ($deps as $name => $type) { |
|
| 21 | + foreach ($deps as $name => $type) |
|
| 22 | + { |
|
| 22 | 23 | $converted[$name] = Dependency::create($name, $type); |
| 23 | 24 | } |
| 24 | 25 | |
@@ -24,7 +24,8 @@ |
||
| 24 | 24 | { |
| 25 | 25 | public function setUp(): void |
| 26 | 26 | { |
| 27 | - if ((string)ini_get('zend.assertions') === 1) { |
|
| 27 | + if ((string)ini_get('zend.assertions') === 1) |
|
| 28 | + { |
|
| 28 | 29 | ini_set('zend.assertions', 0); |
| 29 | 30 | } |
| 30 | 31 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | { |
| 20 | 20 | public function setUp(): void |
| 21 | 21 | { |
| 22 | - if ((string)ini_get('zend.assertions') === 1) { |
|
| 22 | + if ((string)ini_get('zend.assertions') === 1){ |
|
| 23 | 23 | ini_set('zend.assertions', 0); |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $i = new Injector(); |
| 34 | 34 | |
| 35 | - $filename = __DIR__ . '/Fixtures/TestClass.php'; |
|
| 35 | + $filename = __DIR__.'/Fixtures/TestClass.php'; |
|
| 36 | 36 | $printed = $i->injectDependencies( |
| 37 | 37 | file_get_contents($filename), |
| 38 | 38 | $this->getDefinition($filename, ['testClass' => TestClass::class]) |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | $i = new Injector(); |
| 47 | 47 | |
| 48 | - $filename = __DIR__ . '/Fixtures/WithPromotedProperty.php'; |
|
| 48 | + $filename = __DIR__.'/Fixtures/WithPromotedProperty.php'; |
|
| 49 | 49 | $printed = $i->injectDependencies( |
| 50 | 50 | file_get_contents($filename), |
| 51 | 51 | $this->getDefinition($filename, ['two' => InjectionTwo::class]) |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | $i = new Injector(); |
| 67 | 67 | |
| 68 | - $filename = __DIR__ . '/Fixtures/TestEmptyClass.php'; |
|
| 68 | + $filename = __DIR__.'/Fixtures/TestEmptyClass.php'; |
|
| 69 | 69 | $content = file_get_contents($filename); |
| 70 | 70 | $printed = $i->injectDependencies( |
| 71 | 71 | file_get_contents($filename), |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | $i = new Injector(); |
| 85 | 85 | |
| 86 | - $filename = __DIR__ . '/Fixtures/TestClass.php'; |
|
| 86 | + $filename = __DIR__.'/Fixtures/TestClass.php'; |
|
| 87 | 87 | $r = $i->injectDependencies( |
| 88 | 88 | file_get_contents($filename), |
| 89 | 89 | $this->getDefinition($filename, ['testClass' => TestClass::class]) |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | $i = new Injector(); |
| 110 | 110 | |
| 111 | - $filename = __DIR__ . '/Fixtures/ChildClass.php'; |
|
| 111 | + $filename = __DIR__.'/Fixtures/ChildClass.php'; |
|
| 112 | 112 | $r = $i->injectDependencies( |
| 113 | 113 | file_get_contents($filename), |
| 114 | 114 | $this->getDefinition($filename, ['testClass' => TestClass::class]) |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | { |
| 127 | 127 | $i = new Injector(); |
| 128 | 128 | |
| 129 | - $filename = __DIR__ . '/Fixtures/ChildWithConstructorClass.php'; |
|
| 129 | + $filename = __DIR__.'/Fixtures/ChildWithConstructorClass.php'; |
|
| 130 | 130 | $r = $i->injectDependencies( |
| 131 | 131 | file_get_contents($filename), |
| 132 | 132 | $this->getDefinition($filename, ['testClass' => TestClass::class]) |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function testModifyConstructor(): void |
| 144 | 144 | { |
| 145 | - $filename = __DIR__ . '/Fixtures/WithConstructor.php'; |
|
| 145 | + $filename = __DIR__.'/Fixtures/WithConstructor.php'; |
|
| 146 | 146 | $extractor = new Traverse\Extractor(); |
| 147 | 147 | |
| 148 | 148 | $parameters = $extractor->extractFromFilename($filename); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | public function testPriorOptionalConstructorParameters(): void |
| 170 | 170 | { |
| 171 | - $filename = __DIR__ . '/Fixtures/OptionalConstructorArgsClass.php'; |
|
| 171 | + $filename = __DIR__.'/Fixtures/OptionalConstructorArgsClass.php'; |
|
| 172 | 172 | $extractor = new Traverse\Extractor(); |
| 173 | 173 | |
| 174 | 174 | $parameters = $extractor->extractFromFilename($filename); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | { |
| 200 | 200 | $i = new Injector(); |
| 201 | 201 | |
| 202 | - $filename = __DIR__ . '/ClassNode/ConflictResolver/Fixtures/ChildClass.php'; |
|
| 202 | + $filename = __DIR__.'/ClassNode/ConflictResolver/Fixtures/ChildClass.php'; |
|
| 203 | 203 | $printed = $i->injectDependencies( |
| 204 | 204 | file_get_contents($filename), |
| 205 | 205 | $this->getDefinition( |