Completed
Branch develop (9f43d2)
by Filipe
05:14
created
spec/ContainerBuilderSpec.php 2 patches
Unused Use Statements   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,11 +2,11 @@
 block discarded – undo
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
 {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
spec/ContainerSpec.php 2 patches
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         };
Please login to merge, or discard this patch.
spec/Definition/AliasSpec.php 1 patch
Unused Use Statements   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,11 +2,10 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
spec/Definition/FactorySpec.php 2 patches
Unused Use Statements   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,10 +2,9 @@
 block discarded – undo
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
 {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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']
Please login to merge, or discard this patch.
spec/Definition/Object/ResolverSpec.php 1 patch
Unused Use Statements   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,12 +2,11 @@
 block discarded – undo
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
 {
Please login to merge, or discard this patch.
spec/Definition/ObjectDefinitionSpec.php 3 patches
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
spec/Definition/ValueSpec.php 1 patch
Unused Use Statements   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,10 +2,9 @@
 block discarded – undo
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
 {
Please login to merge, or discard this patch.
spec/ObjectHydratorSpec.php 1 patch
Unused Use Statements   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,11 +2,9 @@
 block discarded – undo
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';
Please login to merge, or discard this patch.
src/Definition/ObjectDefinition.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.