@@ -2,11 +2,11 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace spec\Slick\Di; |
| 4 | 4 | |
| 5 | -use Slick\Di\ContainerInterface; |
|
| 6 | -use Slick\Di\ContainerAwareInterface; |
|
| 7 | -use Slick\Di\ContainerBuilder; |
|
| 8 | 5 | use PhpSpec\ObjectBehavior; |
| 9 | 6 | use Prophecy\Argument; |
| 7 | +use Slick\Di\ContainerAwareInterface; |
|
| 8 | +use Slick\Di\ContainerBuilder; |
|
| 9 | +use Slick\Di\ContainerInterface; |
|
| 10 | 10 | |
| 11 | 11 | class ContainerBuilderSpec extends ObjectBehavior |
| 12 | 12 | { |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | function it_hydrates_a_container_with_an_array_from_a_file(ContainerInterface $container) |
| 42 | 42 | { |
| 43 | 43 | $container->register(Argument::type('string'), Argument::any())->shouldBeCalledTimes(3); |
| 44 | - $this->beConstructedWith(__DIR__ .'/services/services1.php'); |
|
| 44 | + $this->beConstructedWith(__DIR__.'/services/services1.php'); |
|
| 45 | 45 | $this->setContainer($container); |
| 46 | 46 | $this->getContainer()->shouldBeAnInstanceOf(ContainerInterface::class); |
| 47 | 47 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | function it_hydrates_a_container_with_all_arrays_form_the_files_within_a_directory(ContainerInterface $container) |
| 50 | 50 | { |
| 51 | 51 | $container->register(Argument::type('string'), Argument::any())->shouldBeCalledTimes(6); |
| 52 | - $this->beConstructedWith(__DIR__ .'/services'); |
|
| 52 | + $this->beConstructedWith(__DIR__.'/services'); |
|
| 53 | 53 | $this->setContainer($container); |
| 54 | 54 | $this->getContainer()->shouldBeAnInstanceOf(ContainerInterface::class); |
| 55 | 55 | } |
@@ -11,12 +11,12 @@ |
||
| 11 | 11 | |
| 12 | 12 | use Interop\Container\ContainerInterface; |
| 13 | 13 | use Interop\Container\Exception\NotFoundException; |
| 14 | -use Slick\Di\Container; |
|
| 15 | 14 | use PhpSpec\ObjectBehavior; |
| 16 | 15 | use Prophecy\Argument; |
| 16 | +use Slick\Di\Container; |
|
| 17 | 17 | use Slick\Di\ContainerInjectionInterface; |
| 18 | -use Slick\Di\Definition\Scope; |
|
| 19 | 18 | use Slick\Di\DefinitionInterface; |
| 19 | +use Slick\Di\Definition\Scope; |
|
| 20 | 20 | use Slick\Di\ObjectHydratorAwareInterface; |
| 21 | 21 | use Slick\Di\ObjectHydratorInterface; |
| 22 | 22 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | function it_registers_a_callable_executing_it_when_resolving() |
| 78 | 78 | { |
| 79 | - $callable = function ($test) { |
|
| 79 | + $callable = function($test) { |
|
| 80 | 80 | return $test; |
| 81 | 81 | }; |
| 82 | 82 | $this->register( |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | function it_registers_an_alias_that_points_to_other_definition() |
| 92 | 92 | { |
| 93 | - $object = (object)[]; |
|
| 93 | + $object = (object) []; |
|
| 94 | 94 | $this->register('test-object', $object); |
| 95 | 95 | $this->register('alias', '@test-object'); |
| 96 | 96 | $this->get('alias')->shouldBe($object); |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | function it_is_aware_of_definition_resolution_scope() |
| 100 | 100 | { |
| 101 | - $callable = function () { |
|
| 101 | + $callable = function() { |
|
| 102 | 102 | static $calls; |
| 103 | 103 | |
| 104 | - if (!$calls) { $calls = 0;} |
|
| 104 | + if (!$calls) { $calls = 0; } |
|
| 105 | 105 | |
| 106 | 106 | return $calls++; |
| 107 | 107 | }; |
@@ -2,11 +2,10 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace spec\Slick\Di\Definition; |
| 4 | 4 | |
| 5 | -use Slick\Di\ContainerInterface; |
|
| 6 | -use Slick\Di\Definition\Alias; |
|
| 7 | 5 | use PhpSpec\ObjectBehavior; |
| 8 | -use Prophecy\Argument; |
|
| 6 | +use Slick\Di\ContainerInterface; |
|
| 9 | 7 | use Slick\Di\DefinitionInterface; |
| 8 | +use Slick\Di\Definition\Alias; |
|
| 10 | 9 | use Slick\Di\Exception\ContainerNotSetException; |
| 11 | 10 | |
| 12 | 11 | class AliasSpec extends ObjectBehavior |
@@ -2,10 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace spec\Slick\Di\Definition; |
| 4 | 4 | |
| 5 | -use Slick\Di\Definition\Factory; |
|
| 6 | 5 | use PhpSpec\ObjectBehavior; |
| 7 | -use Prophecy\Argument; |
|
| 8 | 6 | use Slick\Di\DefinitionInterface; |
| 7 | +use Slick\Di\Definition\Factory; |
|
| 9 | 8 | |
| 10 | 9 | class FactorySpec extends ObjectBehavior |
| 11 | 10 | { |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | function let() |
| 13 | 13 | { |
| 14 | 14 | $this->beConstructedWith( |
| 15 | - function (){ |
|
| 15 | + function() { |
|
| 16 | 16 | return 'Test Callable'; |
| 17 | 17 | } |
| 18 | 18 | ); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | function it_can_have_parameters_to_pass_to_callable_on_resolve() |
| 37 | 37 | { |
| 38 | 38 | $this->beConstructedWith( |
| 39 | - function ($test) { |
|
| 39 | + function($test) { |
|
| 40 | 40 | return $test; |
| 41 | 41 | }, |
| 42 | 42 | ['test with parameters'] |
@@ -2,12 +2,11 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace spec\Slick\Di\Definition\Object; |
| 4 | 4 | |
| 5 | +use PhpSpec\ObjectBehavior; |
|
| 5 | 6 | use Slick\Di\ContainerInterface; |
| 6 | 7 | use Slick\Di\Definition\Object\DefinitionData; |
| 7 | 8 | use Slick\Di\Definition\Object\Resolver; |
| 8 | 9 | use Slick\Di\Definition\Object\ResolverInterface; |
| 9 | -use PhpSpec\ObjectBehavior; |
|
| 10 | -use Prophecy\Argument; |
|
| 11 | 10 | |
| 12 | 11 | class ResolverSpec extends ObjectBehavior |
| 13 | 12 | { |
@@ -5,11 +5,11 @@ |
||
| 5 | 5 | use PhpSpec\Exception\Example\FailureException; |
| 6 | 6 | use PhpSpec\ObjectBehavior; |
| 7 | 7 | use Slick\Di\ContainerInterface; |
| 8 | +use Slick\Di\DefinitionInterface; |
|
| 8 | 9 | use Slick\Di\Definition\FluentObjectDefinitionInterface; |
| 10 | +use Slick\Di\Definition\ObjectDefinition; |
|
| 9 | 11 | use Slick\Di\Definition\Object\DefinitionData; |
| 10 | 12 | use Slick\Di\Definition\Object\ResolverInterface; |
| 11 | -use Slick\Di\Definition\ObjectDefinition; |
|
| 12 | -use Slick\Di\DefinitionInterface; |
|
| 13 | 13 | use Slick\Di\Exception\ClassNotFoundException; |
| 14 | 14 | use Slick\Di\Exception\MethodNotFoundException; |
| 15 | 15 | use Slick\Di\Exception\PropertyNotFoundException; |
@@ -103,7 +103,7 @@ |
||
| 103 | 103 | { |
| 104 | 104 | return [ |
| 105 | 105 | 'haveArgumentsEquals' => function ($subject, $arguments) { |
| 106 | - return $subject->arguments == $arguments; |
|
| 106 | + return $subject->arguments == $arguments; |
|
| 107 | 107 | }, |
| 108 | 108 | 'haveACallEquals' => function (DefinitionData $subject, $expectedCall) { |
| 109 | 109 | $call = null; |
@@ -102,10 +102,10 @@ discard block |
||
| 102 | 102 | public function getMatchers() |
| 103 | 103 | { |
| 104 | 104 | return [ |
| 105 | - 'haveArgumentsEquals' => function ($subject, $arguments) { |
|
| 105 | + 'haveArgumentsEquals' => function($subject, $arguments) { |
|
| 106 | 106 | return $subject->arguments == $arguments; |
| 107 | 107 | }, |
| 108 | - 'haveACallEquals' => function (DefinitionData $subject, $expectedCall) { |
|
| 108 | + 'haveACallEquals' => function(DefinitionData $subject, $expectedCall) { |
|
| 109 | 109 | $call = null; |
| 110 | 110 | foreach ($subject->calls as $call) { |
| 111 | 111 | if ($call == $expectedCall) { |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | try { |
| 117 | 117 | \PHPUnit_Framework_Assert::assertEquals($expectedCall, $call); |
| 118 | 118 | } catch (\PHPUnit_Framework_ExpectationFailedException $caught) { |
| 119 | - $message .= "\n". $caught->getComparisonFailure()->getDiff(); |
|
| 119 | + $message .= "\n".$caught->getComparisonFailure()->getDiff(); |
|
| 120 | 120 | |
| 121 | 121 | } |
| 122 | 122 | |
@@ -2,10 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace spec\Slick\Di\Definition; |
| 4 | 4 | |
| 5 | -use Slick\Di\Definition\Value; |
|
| 6 | 5 | use PhpSpec\ObjectBehavior; |
| 7 | -use Prophecy\Argument; |
|
| 8 | 6 | use Slick\Di\DefinitionInterface; |
| 7 | +use Slick\Di\Definition\Value; |
|
| 9 | 8 | |
| 10 | 9 | class ValueSpec extends ObjectBehavior |
| 11 | 10 | { |
@@ -2,11 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace spec\Slick\Di; |
| 4 | 4 | |
| 5 | -use Slick\Di\ContainerAwareInterface; |
|
| 5 | +use PhpSpec\ObjectBehavior; |
|
| 6 | 6 | use Slick\Di\ContainerInterface; |
| 7 | 7 | use Slick\Di\ObjectHydrator; |
| 8 | -use PhpSpec\ObjectBehavior; |
|
| 9 | -use Prophecy\Argument; |
|
| 10 | 8 | use Slick\Di\ObjectHydratorInterface; |
| 11 | 9 | |
| 12 | 10 | require_once 'DryClass.php'; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * |
| 103 | 103 | * @param array ...$arguments Arguments passed to object constructor |
| 104 | 104 | * |
| 105 | - * @return $this|Object|self |
|
| 105 | + * @return ObjectDefinition |
|
| 106 | 106 | */ |
| 107 | 107 | public function with(...$arguments) |
| 108 | 108 | { |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * |
| 124 | 124 | * @param array ...$arguments |
| 125 | 125 | * |
| 126 | - * @return self|Object |
|
| 126 | + * @return ObjectDefinition |
|
| 127 | 127 | */ |
| 128 | 128 | public function withConstructorArgument(...$arguments) |
| 129 | 129 | { |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * |
| 218 | 218 | * @param mixed $value |
| 219 | 219 | * |
| 220 | - * @return self|Object |
|
| 220 | + * @return ObjectDefinition |
|
| 221 | 221 | */ |
| 222 | 222 | public function assign($value) |
| 223 | 223 | { |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * |
| 233 | 233 | * @param string $property |
| 234 | 234 | * |
| 235 | - * @return self|Object |
|
| 235 | + * @return ObjectDefinition |
|
| 236 | 236 | */ |
| 237 | 237 | public function to($property) |
| 238 | 238 | { |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * @param string $name |
| 257 | 257 | * @param mixed $value |
| 258 | 258 | * |
| 259 | - * @return self|Object |
|
| 259 | + * @return ObjectDefinition |
|
| 260 | 260 | */ |
| 261 | 261 | public function assignProperty($name, $value) |
| 262 | 262 | { |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function __construct($className) |
| 59 | 59 | { |
| 60 | - if (! class_exists($className)) { |
|
| 60 | + if (!class_exists($className)) { |
|
| 61 | 61 | throw new ClassNotFoundException( |
| 62 | - "The class '{$className}' does not exists or it cannot be " . |
|
| 63 | - "loaded. Object definition therefore cannot be " . |
|
| 62 | + "The class '{$className}' does not exists or it cannot be ". |
|
| 63 | + "loaded. Object definition therefore cannot be ". |
|
| 64 | 64 | "created." |
| 65 | 65 | ); |
| 66 | 66 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | public function callMethod($methodName, ...$arguments) |
| 198 | 198 | { |
| 199 | 199 | |
| 200 | - if (! method_exists($this->definitionData->className, $methodName)) { |
|
| 200 | + if (!method_exists($this->definitionData->className, $methodName)) { |
|
| 201 | 201 | throw new MethodNotFoundException( |
| 202 | 202 | "The method '{$methodName}' is not defined in the class ". |
| 203 | 203 | "{$this->definitionData->className}" |
@@ -236,9 +236,9 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | public function to($property) |
| 238 | 238 | { |
| 239 | - if (! property_exists($this->definitionData->className, $property)) { |
|
| 239 | + if (!property_exists($this->definitionData->className, $property)) { |
|
| 240 | 240 | throw new PropertyNotFoundException( |
| 241 | - "The class '{$this->definitionData->className}' has no " . |
|
| 241 | + "The class '{$this->definitionData->className}' has no ". |
|
| 242 | 242 | "property called '{$property}'." |
| 243 | 243 | ); |
| 244 | 244 | } |