@@ -22,14 +22,14 @@ |
||
22 | 22 | */ |
23 | 23 | interface PromiseInterface |
24 | 24 | { |
25 | - /** |
|
26 | - * Evaluates promise. |
|
27 | - * |
|
28 | - * @param array $args |
|
29 | - * @param ObjectProphecy $object |
|
30 | - * @param MethodProphecy $method |
|
31 | - * |
|
32 | - * @return mixed |
|
33 | - */ |
|
34 | - public function execute(array $args, ObjectProphecy $object, MethodProphecy $method); |
|
25 | + /** |
|
26 | + * Evaluates promise. |
|
27 | + * |
|
28 | + * @param array $args |
|
29 | + * @param ObjectProphecy $object |
|
30 | + * @param MethodProphecy $method |
|
31 | + * |
|
32 | + * @return mixed |
|
33 | + */ |
|
34 | + public function execute(array $args, ObjectProphecy $object, MethodProphecy $method); |
|
35 | 35 | } |
@@ -24,44 +24,44 @@ |
||
24 | 24 | */ |
25 | 25 | class CallbackPromise implements PromiseInterface |
26 | 26 | { |
27 | - private $callback; |
|
27 | + private $callback; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Initializes callback promise. |
|
31 | - * |
|
32 | - * @param callable $callback Custom callback |
|
33 | - * |
|
34 | - * @throws \Prophecy\Exception\InvalidArgumentException |
|
35 | - */ |
|
36 | - public function __construct($callback) |
|
37 | - { |
|
38 | - if (!is_callable($callback)) { |
|
39 | - throw new InvalidArgumentException(sprintf( |
|
40 | - 'Callable expected as an argument to CallbackPromise, but got %s.', |
|
41 | - gettype($callback) |
|
42 | - )); |
|
43 | - } |
|
29 | + /** |
|
30 | + * Initializes callback promise. |
|
31 | + * |
|
32 | + * @param callable $callback Custom callback |
|
33 | + * |
|
34 | + * @throws \Prophecy\Exception\InvalidArgumentException |
|
35 | + */ |
|
36 | + public function __construct($callback) |
|
37 | + { |
|
38 | + if (!is_callable($callback)) { |
|
39 | + throw new InvalidArgumentException(sprintf( |
|
40 | + 'Callable expected as an argument to CallbackPromise, but got %s.', |
|
41 | + gettype($callback) |
|
42 | + )); |
|
43 | + } |
|
44 | 44 | |
45 | - $this->callback = $callback; |
|
46 | - } |
|
45 | + $this->callback = $callback; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Evaluates promise callback. |
|
50 | - * |
|
51 | - * @param array $args |
|
52 | - * @param ObjectProphecy $object |
|
53 | - * @param MethodProphecy $method |
|
54 | - * |
|
55 | - * @return mixed |
|
56 | - */ |
|
57 | - public function execute(array $args, ObjectProphecy $object, MethodProphecy $method) |
|
58 | - { |
|
59 | - $callback = $this->callback; |
|
48 | + /** |
|
49 | + * Evaluates promise callback. |
|
50 | + * |
|
51 | + * @param array $args |
|
52 | + * @param ObjectProphecy $object |
|
53 | + * @param MethodProphecy $method |
|
54 | + * |
|
55 | + * @return mixed |
|
56 | + */ |
|
57 | + public function execute(array $args, ObjectProphecy $object, MethodProphecy $method) |
|
58 | + { |
|
59 | + $callback = $this->callback; |
|
60 | 60 | |
61 | - if ($callback instanceof Closure && method_exists('Closure', 'bind') && (new ReflectionFunction($callback))->getClosureThis() !== null) { |
|
62 | - $callback = Closure::bind($callback, $object); |
|
63 | - } |
|
61 | + if ($callback instanceof Closure && method_exists('Closure', 'bind') && (new ReflectionFunction($callback))->getClosureThis() !== null) { |
|
62 | + $callback = Closure::bind($callback, $object); |
|
63 | + } |
|
64 | 64 | |
65 | - return call_user_func($callback, $args, $object, $method); |
|
66 | - } |
|
65 | + return call_user_func($callback, $args, $object, $method); |
|
66 | + } |
|
67 | 67 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | public function __construct($callback) |
37 | 37 | { |
38 | - if (!is_callable($callback)) { |
|
38 | + if ( ! is_callable($callback)) { |
|
39 | 39 | throw new InvalidArgumentException(sprintf( |
40 | 40 | 'Callable expected as an argument to CallbackPromise, but got %s.', |
41 | 41 | gettype($callback) |
@@ -21,15 +21,15 @@ |
||
21 | 21 | */ |
22 | 22 | final class LegacyClassTagRetriever implements MethodTagRetrieverInterface |
23 | 23 | { |
24 | - /** |
|
25 | - * @param \ReflectionClass $reflectionClass |
|
26 | - * |
|
27 | - * @return LegacyMethodTag[] |
|
28 | - */ |
|
29 | - public function getTagList(\ReflectionClass $reflectionClass) |
|
30 | - { |
|
31 | - $phpdoc = new DocBlock($reflectionClass->getDocComment()); |
|
24 | + /** |
|
25 | + * @param \ReflectionClass $reflectionClass |
|
26 | + * |
|
27 | + * @return LegacyMethodTag[] |
|
28 | + */ |
|
29 | + public function getTagList(\ReflectionClass $reflectionClass) |
|
30 | + { |
|
31 | + $phpdoc = new DocBlock($reflectionClass->getDocComment()); |
|
32 | 32 | |
33 | - return $phpdoc->getTagsByName('method'); |
|
34 | - } |
|
33 | + return $phpdoc->getTagsByName('method'); |
|
34 | + } |
|
35 | 35 | } |
@@ -21,49 +21,49 @@ |
||
21 | 21 | */ |
22 | 22 | final class ClassAndInterfaceTagRetriever implements MethodTagRetrieverInterface |
23 | 23 | { |
24 | - private $classRetriever; |
|
24 | + private $classRetriever; |
|
25 | 25 | |
26 | - public function __construct(MethodTagRetrieverInterface $classRetriever = null) |
|
27 | - { |
|
28 | - if (null !== $classRetriever) { |
|
29 | - $this->classRetriever = $classRetriever; |
|
26 | + public function __construct(MethodTagRetrieverInterface $classRetriever = null) |
|
27 | + { |
|
28 | + if (null !== $classRetriever) { |
|
29 | + $this->classRetriever = $classRetriever; |
|
30 | 30 | |
31 | - return; |
|
32 | - } |
|
31 | + return; |
|
32 | + } |
|
33 | 33 | |
34 | - $this->classRetriever = class_exists('phpDocumentor\Reflection\DocBlockFactory') && class_exists('phpDocumentor\Reflection\Types\ContextFactory') |
|
35 | - ? new ClassTagRetriever() |
|
36 | - : new LegacyClassTagRetriever() |
|
37 | - ; |
|
38 | - } |
|
34 | + $this->classRetriever = class_exists('phpDocumentor\Reflection\DocBlockFactory') && class_exists('phpDocumentor\Reflection\Types\ContextFactory') |
|
35 | + ? new ClassTagRetriever() |
|
36 | + : new LegacyClassTagRetriever() |
|
37 | + ; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @param \ReflectionClass $reflectionClass |
|
42 | - * |
|
43 | - * @return LegacyMethodTag[]|Method[] |
|
44 | - */ |
|
45 | - public function getTagList(\ReflectionClass $reflectionClass) |
|
46 | - { |
|
47 | - return array_merge( |
|
48 | - $this->classRetriever->getTagList($reflectionClass), |
|
49 | - $this->getInterfacesTagList($reflectionClass) |
|
50 | - ); |
|
51 | - } |
|
40 | + /** |
|
41 | + * @param \ReflectionClass $reflectionClass |
|
42 | + * |
|
43 | + * @return LegacyMethodTag[]|Method[] |
|
44 | + */ |
|
45 | + public function getTagList(\ReflectionClass $reflectionClass) |
|
46 | + { |
|
47 | + return array_merge( |
|
48 | + $this->classRetriever->getTagList($reflectionClass), |
|
49 | + $this->getInterfacesTagList($reflectionClass) |
|
50 | + ); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @param \ReflectionClass $reflectionClass |
|
55 | - * |
|
56 | - * @return LegacyMethodTag[]|Method[] |
|
57 | - */ |
|
58 | - private function getInterfacesTagList(\ReflectionClass $reflectionClass) |
|
59 | - { |
|
60 | - $interfaces = $reflectionClass->getInterfaces(); |
|
61 | - $tagList = array(); |
|
53 | + /** |
|
54 | + * @param \ReflectionClass $reflectionClass |
|
55 | + * |
|
56 | + * @return LegacyMethodTag[]|Method[] |
|
57 | + */ |
|
58 | + private function getInterfacesTagList(\ReflectionClass $reflectionClass) |
|
59 | + { |
|
60 | + $interfaces = $reflectionClass->getInterfaces(); |
|
61 | + $tagList = array(); |
|
62 | 62 | |
63 | - foreach($interfaces as $interface) { |
|
64 | - $tagList = array_merge($tagList, $this->classRetriever->getTagList($interface)); |
|
65 | - } |
|
63 | + foreach($interfaces as $interface) { |
|
64 | + $tagList = array_merge($tagList, $this->classRetriever->getTagList($interface)); |
|
65 | + } |
|
66 | 66 | |
67 | - return $tagList; |
|
68 | - } |
|
67 | + return $tagList; |
|
68 | + } |
|
69 | 69 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $interfaces = $reflectionClass->getInterfaces(); |
61 | 61 | $tagList = array(); |
62 | 62 | |
63 | - foreach($interfaces as $interface) { |
|
63 | + foreach ($interfaces as $interface) { |
|
64 | 64 | $tagList = array_merge($tagList, $this->classRetriever->getTagList($interface)); |
65 | 65 | } |
66 | 66 |
@@ -21,10 +21,10 @@ |
||
21 | 21 | */ |
22 | 22 | interface MethodTagRetrieverInterface |
23 | 23 | { |
24 | - /** |
|
25 | - * @param \ReflectionClass $reflectionClass |
|
26 | - * |
|
27 | - * @return LegacyMethodTag[]|Method[] |
|
28 | - */ |
|
29 | - public function getTagList(\ReflectionClass $reflectionClass); |
|
24 | + /** |
|
25 | + * @param \ReflectionClass $reflectionClass |
|
26 | + * |
|
27 | + * @return LegacyMethodTag[]|Method[] |
|
28 | + */ |
|
29 | + public function getTagList(\ReflectionClass $reflectionClass); |
|
30 | 30 | } |
@@ -22,39 +22,39 @@ |
||
22 | 22 | */ |
23 | 23 | final class ClassTagRetriever implements MethodTagRetrieverInterface |
24 | 24 | { |
25 | - private $docBlockFactory; |
|
26 | - private $contextFactory; |
|
27 | - |
|
28 | - public function __construct() |
|
29 | - { |
|
30 | - $this->docBlockFactory = DocBlockFactory::createInstance(); |
|
31 | - $this->contextFactory = new ContextFactory(); |
|
32 | - } |
|
33 | - |
|
34 | - /** |
|
35 | - * @param \ReflectionClass $reflectionClass |
|
36 | - * |
|
37 | - * @return Method[] |
|
38 | - */ |
|
39 | - public function getTagList(\ReflectionClass $reflectionClass) |
|
40 | - { |
|
41 | - try { |
|
42 | - $phpdoc = $this->docBlockFactory->create( |
|
43 | - $reflectionClass, |
|
44 | - $this->contextFactory->createFromReflector($reflectionClass) |
|
45 | - ); |
|
46 | - |
|
47 | - $methods = array(); |
|
48 | - |
|
49 | - foreach ($phpdoc->getTagsByName('method') as $tag) { |
|
50 | - if ($tag instanceof Method) { |
|
51 | - $methods[] = $tag; |
|
52 | - } |
|
53 | - } |
|
54 | - |
|
55 | - return $methods; |
|
56 | - } catch (\InvalidArgumentException $e) { |
|
57 | - return array(); |
|
58 | - } |
|
59 | - } |
|
25 | + private $docBlockFactory; |
|
26 | + private $contextFactory; |
|
27 | + |
|
28 | + public function __construct() |
|
29 | + { |
|
30 | + $this->docBlockFactory = DocBlockFactory::createInstance(); |
|
31 | + $this->contextFactory = new ContextFactory(); |
|
32 | + } |
|
33 | + |
|
34 | + /** |
|
35 | + * @param \ReflectionClass $reflectionClass |
|
36 | + * |
|
37 | + * @return Method[] |
|
38 | + */ |
|
39 | + public function getTagList(\ReflectionClass $reflectionClass) |
|
40 | + { |
|
41 | + try { |
|
42 | + $phpdoc = $this->docBlockFactory->create( |
|
43 | + $reflectionClass, |
|
44 | + $this->contextFactory->createFromReflector($reflectionClass) |
|
45 | + ); |
|
46 | + |
|
47 | + $methods = array(); |
|
48 | + |
|
49 | + foreach ($phpdoc->getTagsByName('method') as $tag) { |
|
50 | + if ($tag instanceof Method) { |
|
51 | + $methods[] = $tag; |
|
52 | + } |
|
53 | + } |
|
54 | + |
|
55 | + return $methods; |
|
56 | + } catch (\InvalidArgumentException $e) { |
|
57 | + return array(); |
|
58 | + } |
|
59 | + } |
|
60 | 60 | } |
@@ -13,8 +13,8 @@ |
||
13 | 13 | |
14 | 14 | class InterfaceNotFoundException extends ClassNotFoundException |
15 | 15 | { |
16 | - public function getInterfaceName() |
|
17 | - { |
|
18 | - return $this->getClassname(); |
|
19 | - } |
|
16 | + public function getInterfaceName() |
|
17 | + { |
|
18 | + return $this->getClassname(); |
|
19 | + } |
|
20 | 20 | } |
@@ -13,21 +13,21 @@ |
||
13 | 13 | |
14 | 14 | class ClassNotFoundException extends DoubleException |
15 | 15 | { |
16 | - private $classname; |
|
16 | + private $classname; |
|
17 | 17 | |
18 | - /** |
|
19 | - * @param string $message |
|
20 | - * @param string $classname |
|
21 | - */ |
|
22 | - public function __construct($message, $classname) |
|
23 | - { |
|
24 | - parent::__construct($message); |
|
18 | + /** |
|
19 | + * @param string $message |
|
20 | + * @param string $classname |
|
21 | + */ |
|
22 | + public function __construct($message, $classname) |
|
23 | + { |
|
24 | + parent::__construct($message); |
|
25 | 25 | |
26 | - $this->classname = $classname; |
|
27 | - } |
|
26 | + $this->classname = $classname; |
|
27 | + } |
|
28 | 28 | |
29 | - public function getClassname() |
|
30 | - { |
|
31 | - return $this->classname; |
|
32 | - } |
|
29 | + public function getClassname() |
|
30 | + { |
|
31 | + return $this->classname; |
|
32 | + } |
|
33 | 33 | } |
@@ -15,17 +15,17 @@ |
||
15 | 15 | |
16 | 16 | class ClassMirrorException extends \RuntimeException implements DoublerException |
17 | 17 | { |
18 | - private $class; |
|
18 | + private $class; |
|
19 | 19 | |
20 | - public function __construct($message, ReflectionClass $class) |
|
21 | - { |
|
22 | - parent::__construct($message); |
|
20 | + public function __construct($message, ReflectionClass $class) |
|
21 | + { |
|
22 | + parent::__construct($message); |
|
23 | 23 | |
24 | - $this->class = $class; |
|
25 | - } |
|
24 | + $this->class = $class; |
|
25 | + } |
|
26 | 26 | |
27 | - public function getReflectedClass() |
|
28 | - { |
|
29 | - return $this->class; |
|
30 | - } |
|
27 | + public function getReflectedClass() |
|
28 | + { |
|
29 | + return $this->class; |
|
30 | + } |
|
31 | 31 | } |