@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | public static function toArray($value) |
| 53 | 53 | { |
| 54 | 54 | if (!is_object($value)) { |
| 55 | - return (array) $value; |
|
| 55 | + return (array)$value; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | $array = array(); |
| 59 | 59 | |
| 60 | - foreach ((array) $value as $key => $val) { |
|
| 60 | + foreach ((array)$value as $key => $val) { |
|
| 61 | 61 | // properties are transformed to keys in the following way: |
| 62 | 62 | // private $property => "\0Classname\0property" |
| 63 | 63 | // protected $property => "\0*\0property" |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | "'"; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - $whitespace = str_repeat(' ', 4 * $indentation); |
|
| 150 | + $whitespace = str_repeat(' ', 4*$indentation); |
|
| 151 | 151 | |
| 152 | 152 | if (!$processed) { |
| 153 | 153 | $processed = new Context; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | if (null === $double || !$double instanceof ProphecySubjectInterface) { |
| 117 | 117 | throw new ObjectProphecyException( |
| 118 | - "Generated double must implement ProphecySubjectInterface, but it does not.\n". |
|
| 118 | + "Generated double must implement ProphecySubjectInterface, but it does not.\n" . |
|
| 119 | 119 | 'It seems you have wrongly configured doubler without required ClassPatch.', |
| 120 | 120 | $this |
| 121 | 121 | ); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $argumentsWildcard = $methodProphecy->getArgumentsWildcard(); |
| 140 | 140 | if (null === $argumentsWildcard) { |
| 141 | 141 | throw new MethodProphecyException(sprintf( |
| 142 | - "Can not add prophecy for a method `%s::%s()`\n". |
|
| 142 | + "Can not add prophecy for a method `%s::%s()`\n" . |
|
| 143 | 143 | "as you did not specify arguments wildcard for it.", |
| 144 | 144 | get_class($this->reveal()), |
| 145 | 145 | $methodProphecy->getMethodName() |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $reflectedMethod = new \ReflectionMethod($double, $methodName); |
| 63 | 63 | if ($reflectedMethod->isFinal()) { |
| 64 | 64 | throw new MethodProphecyException(sprintf( |
| 65 | - "Can not add prophecy for a method `%s::%s()`\n". |
|
| 65 | + "Can not add prophecy for a method `%s::%s()`\n" . |
|
| 66 | 66 | "as it is a final method.", |
| 67 | 67 | get_class($double), |
| 68 | 68 | $methodName |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | return class_exists($type) || interface_exists($type); |
| 107 | 107 | }; |
| 108 | 108 | |
| 109 | - if($isObject($type1) && !$isObject($type2)) { |
|
| 109 | + if ($isObject($type1) && !$isObject($type2)) { |
|
| 110 | 110 | return -1; |
| 111 | 111 | } |
| 112 | - elseif(!$isObject($type1) && $isObject($type2)) |
|
| 112 | + elseif (!$isObject($type1) && $isObject($type2)) |
|
| 113 | 113 | { |
| 114 | 114 | return 1; |
| 115 | 115 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $this->voidReturnType = true; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $this->will(function () use ($defaultType) { |
|
| 128 | + $this->will(function() use ($defaultType) { |
|
| 129 | 129 | switch ($defaultType) { |
| 130 | 130 | case 'void': return; |
| 131 | 131 | case 'string': return ''; |
@@ -136,11 +136,11 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | case 'callable': |
| 138 | 138 | case 'Closure': |
| 139 | - return function () {}; |
|
| 139 | + return function() {}; |
|
| 140 | 140 | |
| 141 | 141 | case 'Traversable': |
| 142 | 142 | case 'Generator': |
| 143 | - return (function () { yield; })(); |
|
| 143 | + return (function() { yield; })(); |
|
| 144 | 144 | |
| 145 | 145 | default: |
| 146 | 146 | $prophet = new Prophet; |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | if (!$arguments instanceof Argument\ArgumentsWildcard) { |
| 169 | 169 | throw new InvalidArgumentException(sprintf( |
| 170 | - "Either an array or an instance of ArgumentsWildcard expected as\n". |
|
| 170 | + "Either an array or an instance of ArgumentsWildcard expected as\n" . |
|
| 171 | 171 | 'a `MethodProphecy::withArguments()` argument, but got %s.', |
| 172 | 172 | gettype($arguments) |
| 173 | 173 | )); |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | )); |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | - $generator = function() use ($items) { |
|
| 251 | + $generator = function() use ($items) { |
|
| 252 | 252 | foreach ($items as $key => $value) { |
| 253 | 253 | yield $key => $value; |
| 254 | 254 | } |
@@ -79,8 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | if ($reflectionType instanceof ReflectionNamedType) { |
| 81 | 81 | $types = [$reflectionType]; |
| 82 | - } |
|
| 83 | - elseif ($reflectionType instanceof ReflectionUnionType) { |
|
| 82 | + } elseif ($reflectionType instanceof ReflectionUnionType) { |
|
| 84 | 83 | $types = $reflectionType->getTypes(); |
| 85 | 84 | } |
| 86 | 85 | |
@@ -96,8 +95,7 @@ discard block |
||
| 96 | 95 | // null is lowest priority |
| 97 | 96 | if ($type2 == 'null') { |
| 98 | 97 | return -1; |
| 99 | - } |
|
| 100 | - elseif ($type1 == 'null') { |
|
| 98 | + } elseif ($type1 == 'null') { |
|
| 101 | 99 | return 1; |
| 102 | 100 | } |
| 103 | 101 | |
@@ -108,8 +106,7 @@ discard block |
||
| 108 | 106 | |
| 109 | 107 | if($isObject($type1) && !$isObject($type2)) { |
| 110 | 108 | return -1; |
| 111 | - } |
|
| 112 | - elseif(!$isObject($type1) && $isObject($type2)) |
|
| 109 | + } elseif(!$isObject($type1) && $isObject($type2)) |
|
| 113 | 110 | { |
| 114 | 111 | return 1; |
| 115 | 112 | } |
@@ -21,10 +21,10 @@ |
||
| 21 | 21 | public function append(PredictionException $exception) |
| 22 | 22 | { |
| 23 | 23 | $message = $exception->getMessage(); |
| 24 | - $message = strtr($message, array("\n" => "\n "))."\n"; |
|
| 24 | + $message = strtr($message, array("\n" => "\n ")) . "\n"; |
|
| 25 | 25 | $message = empty($this->exceptions) ? $message : "\n" . $message; |
| 26 | 26 | |
| 27 | - $this->message = rtrim($this->message.$message); |
|
| 27 | + $this->message = rtrim($this->message . $message); |
|
| 28 | 28 | $this->exceptions[] = $exception; |
| 29 | 29 | } |
| 30 | 30 | |
@@ -54,8 +54,8 @@ |
||
| 54 | 54 | $verb = count($calls) === 1 ? 'was' : 'were'; |
| 55 | 55 | |
| 56 | 56 | throw new UnexpectedCallsException(sprintf( |
| 57 | - "No calls expected that match:\n". |
|
| 58 | - " %s->%s(%s)\n". |
|
| 57 | + "No calls expected that match:\n" . |
|
| 58 | + " %s->%s(%s)\n" . |
|
| 59 | 59 | "but %d %s made:\n%s", |
| 60 | 60 | get_class($object->reveal()), |
| 61 | 61 | $method->getMethodName(), |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | if (count($methodCalls)) { |
| 62 | 62 | throw new NoCallsException(sprintf( |
| 63 | - "No calls have been made that match:\n". |
|
| 64 | - " %s->%s(%s)\n". |
|
| 65 | - "but expected at least one.\n". |
|
| 63 | + "No calls have been made that match:\n" . |
|
| 64 | + " %s->%s(%s)\n" . |
|
| 65 | + "but expected at least one.\n" . |
|
| 66 | 66 | "Recorded `%s(...)` calls:\n%s", |
| 67 | 67 | |
| 68 | 68 | get_class($object->reveal()), |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | throw new NoCallsException(sprintf( |
| 77 | - "No calls have been made that match:\n". |
|
| 78 | - " %s->%s(%s)\n". |
|
| 77 | + "No calls have been made that match:\n" . |
|
| 78 | + " %s->%s(%s)\n" . |
|
| 79 | 79 | "but expected at least one.", |
| 80 | 80 | |
| 81 | 81 | get_class($object->reveal()), |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | if (count($calls)) { |
| 66 | 66 | $message = sprintf( |
| 67 | - "Expected exactly %d calls that match:\n". |
|
| 68 | - " %s->%s(%s)\n". |
|
| 67 | + "Expected exactly %d calls that match:\n" . |
|
| 68 | + " %s->%s(%s)\n" . |
|
| 69 | 69 | "but %d were made:\n%s", |
| 70 | 70 | |
| 71 | 71 | $this->times, |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | ); |
| 78 | 78 | } elseif (count($methodCalls)) { |
| 79 | 79 | $message = sprintf( |
| 80 | - "Expected exactly %d calls that match:\n". |
|
| 81 | - " %s->%s(%s)\n". |
|
| 82 | - "but none were made.\n". |
|
| 80 | + "Expected exactly %d calls that match:\n" . |
|
| 81 | + " %s->%s(%s)\n" . |
|
| 82 | + "but none were made.\n" . |
|
| 83 | 83 | "Recorded `%s(...)` calls:\n%s", |
| 84 | 84 | |
| 85 | 85 | $this->times, |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | ); |
| 92 | 92 | } else { |
| 93 | 93 | $message = sprintf( |
| 94 | - "Expected exactly %d calls that match:\n". |
|
| 95 | - " %s->%s(%s)\n". |
|
| 94 | + "Expected exactly %d calls that match:\n" . |
|
| 95 | + " %s->%s(%s)\n" . |
|
| 96 | 96 | "but none were made.", |
| 97 | 97 | |
| 98 | 98 | $this->times, |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | public function __construct(ClassMirror $mirror = null, ClassCreator $creator = null, |
| 51 | 51 | NameGenerator $namer = null) |
| 52 | 52 | { |
| 53 | - $this->mirror = $mirror ?: new ClassMirror; |
|
| 53 | + $this->mirror = $mirror ?: new ClassMirror; |
|
| 54 | 54 | $this->creator = $creator ?: new ClassCreator; |
| 55 | - $this->namer = $namer ?: new NameGenerator; |
|
| 55 | + $this->namer = $namer ?: new NameGenerator; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | $this->patches[] = $patch; |
| 76 | 76 | |
| 77 | - @usort($this->patches, function (ClassPatchInterface $patch1, ClassPatchInterface $patch2) { |
|
| 77 | + @usort($this->patches, function(ClassPatchInterface $patch1, ClassPatchInterface $patch2) { |
|
| 78 | 78 | return $patch2->getPriority() - $patch1->getPriority(); |
| 79 | 79 | }); |
| 80 | 80 | } |
@@ -95,9 +95,9 @@ discard block |
||
| 95 | 95 | foreach ($interfaces as $interface) { |
| 96 | 96 | if (!$interface instanceof ReflectionClass) { |
| 97 | 97 | throw new InvalidArgumentException(sprintf( |
| 98 | - "[ReflectionClass \$interface1 [, ReflectionClass \$interface2]] array expected as\n". |
|
| 98 | + "[ReflectionClass \$interface1 [, ReflectionClass \$interface2]] array expected as\n" . |
|
| 99 | 99 | "a second argument to `Doubler::double(...)`, but got %s.", |
| 100 | - is_object($interface) ? get_class($interface).' class' : gettype($interface) |
|
| 100 | + is_object($interface) ? get_class($interface) . ' class' : gettype($interface) |
|
| 101 | 101 | )); |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | if (null !== $class) { |
| 57 | 57 | if (true === $class->isInterface()) { |
| 58 | 58 | throw new InvalidArgumentException(sprintf( |
| 59 | - "Could not reflect %s as a class, because it\n". |
|
| 59 | + "Could not reflect %s as a class, because it\n" . |
|
| 60 | 60 | "is interface - use the second argument instead.", |
| 61 | 61 | $class->getName() |
| 62 | 62 | )); |
@@ -68,14 +68,14 @@ discard block |
||
| 68 | 68 | foreach ($interfaces as $interface) { |
| 69 | 69 | if (!$interface instanceof ReflectionClass) { |
| 70 | 70 | throw new InvalidArgumentException(sprintf( |
| 71 | - "[ReflectionClass \$interface1 [, ReflectionClass \$interface2]] array expected as\n". |
|
| 71 | + "[ReflectionClass \$interface1 [, ReflectionClass \$interface2]] array expected as\n" . |
|
| 72 | 72 | "a second argument to `ClassMirror::reflect(...)`, but got %s.", |
| 73 | - is_object($interface) ? get_class($interface).' class' : gettype($interface) |
|
| 73 | + is_object($interface) ? get_class($interface) . ' class' : gettype($interface) |
|
| 74 | 74 | )); |
| 75 | 75 | } |
| 76 | 76 | if (false === $interface->isInterface()) { |
| 77 | 77 | throw new InvalidArgumentException(sprintf( |
| 78 | - "Could not reflect %s as an interface, because it\n". |
|
| 78 | + "Could not reflect %s as an interface, because it\n" . |
|
| 79 | 79 | "is class - use the first argument instead.", |
| 80 | 80 | $interface->getName() |
| 81 | 81 | )); |
@@ -215,8 +215,7 @@ |
||
| 215 | 215 | if ($type instanceof ReflectionNamedType) { |
| 216 | 216 | $types = [$type->getName()]; |
| 217 | 217 | |
| 218 | - } |
|
| 219 | - elseif ($type instanceof ReflectionUnionType) { |
|
| 218 | + } elseif ($type instanceof ReflectionUnionType) { |
|
| 220 | 219 | $types = $type->getTypes(); |
| 221 | 220 | } |
| 222 | 221 | |