@@ -83,7 +83,7 @@ |
||
83 | 83 | public function __toString() |
84 | 84 | { |
85 | 85 | if (null === $this->string) { |
86 | - $this->string = implode(', ', array_map(function ($token) { |
|
86 | + $this->string = implode(', ', array_map(function($token) { |
|
87 | 87 | return (string) $token; |
88 | 88 | }, $this->tokens)); |
89 | 89 | } |
@@ -170,7 +170,7 @@ |
||
170 | 170 | } |
171 | 171 | |
172 | 172 | private function createUnexpectedCallException(ObjectProphecy $prophecy, $methodName, |
173 | - array $arguments) |
|
173 | + array $arguments) |
|
174 | 174 | { |
175 | 175 | $classname = get_class($prophecy->reveal()); |
176 | 176 | $indentationLength = 8; // looks good |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | // Sort matches by their score value |
101 | - @usort($matches, function ($match1, $match2) { return $match2[0] - $match1[0]; }); |
|
101 | + @usort($matches, function($match1, $match2) { return $match2[0] - $match1[0]; }); |
|
102 | 102 | |
103 | 103 | $score = $matches[0][0]; |
104 | 104 | // If Highest rated method prophecy has a promise - execute it or return null instead |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $methodName = strtolower($methodName); |
146 | 146 | |
147 | 147 | return array_values( |
148 | - array_filter($this->recordedCalls, function (Call $call) use ($methodName, $wildcard) { |
|
148 | + array_filter($this->recordedCalls, function(Call $call) use ($methodName, $wildcard) { |
|
149 | 149 | return $methodName === strtolower($call->getMethodName()) |
150 | 150 | && 0 < $call->getScore($wildcard) |
151 | 151 | ; |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | |
187 | 187 | foreach (call_user_func_array('array_merge', $prophecy->getMethodProphecies()) as $methodProphecy) { |
188 | 188 | $expected[] = sprintf( |
189 | - " - %s(\n" . |
|
190 | - "%s\n" . |
|
189 | + " - %s(\n". |
|
190 | + "%s\n". |
|
191 | 191 | " )", |
192 | 192 | $methodProphecy->getMethodName(), |
193 | 193 | implode( |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | { |
221 | 221 | return preg_replace_callback( |
222 | 222 | '/^/m', |
223 | - function () use ($indentationLength) { |
|
223 | + function() use ($indentationLength) { |
|
224 | 224 | return str_repeat(' ', $indentationLength); |
225 | 225 | }, |
226 | 226 | $arguments |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | $stringify = array($this, __FUNCTION__); |
49 | 49 | |
50 | - return '['.implode(', ', array_map(function ($item, $key) use ($stringify) { |
|
50 | + return '['.implode(', ', array_map(function($item, $key) use ($stringify) { |
|
51 | 51 | return (is_integer($key) ? $key : '"'.$key.'"'). |
52 | 52 | ' => '.call_user_func($stringify, $item); |
53 | 53 | }, $value, array_keys($value))).']'; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | { |
89 | 89 | $self = $this; |
90 | 90 | |
91 | - return implode(PHP_EOL, array_map(function (Call $call) use ($self) { |
|
91 | + return implode(PHP_EOL, array_map(function(Call $call) use ($self) { |
|
92 | 92 | return sprintf(' - %s(%s) @ %s', |
93 | 93 | $call->getMethodName(), |
94 | 94 | implode(', ', array_map(array($self, 'stringify'), $call->getArguments())), |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | if (is_string($value)) { |
140 | 140 | // Match for most non printable chars somewhat taking multibyte chars into account |
141 | 141 | if (preg_match('/[^\x09-\x0d\x20-\xff]/', $value)) { |
142 | - return 'Binary String: 0x' . bin2hex($value); |
|
142 | + return 'Binary String: 0x'.bin2hex($value); |
|
143 | 143 | } |
144 | 144 | |
145 | - return "'" . |
|
146 | - str_replace(array("\r\n", "\n\r", "\r"), array("\n", "\n", "\n"), $value) . |
|
145 | + return "'". |
|
146 | + str_replace(array("\r\n", "\n\r", "\r"), array("\n", "\n", "\n"), $value). |
|
147 | 147 | "'"; |
148 | 148 | } |
149 | 149 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | if (is_array($value)) { |
157 | 157 | if (($key = $processed->contains($value)) !== false) { |
158 | - return 'Array &' . $key; |
|
158 | + return 'Array &'.$key; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | $array = $value; |
@@ -165,14 +165,14 @@ discard block |
||
165 | 165 | if (count($array) > 0) { |
166 | 166 | foreach ($array as $k => $v) { |
167 | 167 | $values .= sprintf( |
168 | - '%s %s => %s' . "\n", |
|
168 | + '%s %s => %s'."\n", |
|
169 | 169 | $whitespace, |
170 | 170 | self::recursiveExport($k, $indentation), |
171 | 171 | self::recursiveExport($value[$k], $indentation + 1, $processed) |
172 | 172 | ); |
173 | 173 | } |
174 | 174 | |
175 | - $values = "\n" . $values . $whitespace; |
|
175 | + $values = "\n".$values.$whitespace; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | return sprintf('Array &%s (%s)', $key, $values); |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | if (count($array) > 0) { |
193 | 193 | foreach ($array as $k => $v) { |
194 | 194 | $values .= sprintf( |
195 | - '%s %s => %s' . "\n", |
|
195 | + '%s %s => %s'."\n", |
|
196 | 196 | $whitespace, |
197 | 197 | self::recursiveExport($k, $indentation), |
198 | 198 | self::recursiveExport($v, $indentation + 1, $processed) |
199 | 199 | ); |
200 | 200 | } |
201 | 201 | |
202 | - $values = "\n" . $values . $whitespace; |
|
202 | + $values = "\n".$values.$whitespace; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | return sprintf('%s:%s Object (%s)', $class, $hash, $values); |
@@ -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 | } |
@@ -54,21 +54,21 @@ |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | if ($this->nodeIsDirectoryIterator($node)) { |
57 | - $constructor->setCode('return parent::__construct("' . __DIR__ . '");'); |
|
57 | + $constructor->setCode('return parent::__construct("'.__DIR__.'");'); |
|
58 | 58 | |
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | 62 | if ($this->nodeIsSplFileObject($node)) { |
63 | - $filePath = str_replace('\\','\\\\',__FILE__); |
|
64 | - $constructor->setCode('return parent::__construct("' . $filePath .'");'); |
|
63 | + $filePath = str_replace('\\', '\\\\', __FILE__); |
|
64 | + $constructor->setCode('return parent::__construct("'.$filePath.'");'); |
|
65 | 65 | |
66 | 66 | return; |
67 | 67 | } |
68 | 68 | |
69 | 69 | if ($this->nodeIsSymfonySplFileInfo($node)) { |
70 | - $filePath = str_replace('\\','\\\\',__FILE__); |
|
71 | - $constructor->setCode('return parent::__construct("' . $filePath .'", "", "");'); |
|
70 | + $filePath = str_replace('\\', '\\\\', __FILE__); |
|
71 | + $constructor->setCode('return parent::__construct("'.$filePath.'", "", "");'); |
|
72 | 72 | |
73 | 73 | return; |
74 | 74 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | */ |
52 | 52 | public function apply(ClassNode $node) |
53 | 53 | { |
54 | - $types = array_filter($node->getInterfaces(), function ($interface) { |
|
54 | + $types = array_filter($node->getInterfaces(), function($interface) { |
|
55 | 55 | return 0 !== strpos($interface, 'Prophecy\\'); |
56 | 56 | }); |
57 | 57 | $types[] = $node->getParentClass(); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $code = sprintf("class %s extends \%s implements %s {\n", |
47 | 47 | $classname, $class->getParentClass(), implode(', ', |
48 | - array_map(function ($interface) {return '\\'.$interface;}, $class->getInterfaces()) |
|
48 | + array_map(function($interface) {return '\\'.$interface; }, $class->getInterfaces()) |
|
49 | 49 | ) |
50 | 50 | ); |
51 | 51 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $php = sprintf("%s %s function %s%s(%s)%s {\n", |
68 | 68 | $method->getVisibility(), |
69 | 69 | $method->isStatic() ? 'static' : '', |
70 | - $method->returnsReference() ? '&':'', |
|
70 | + $method->returnsReference() ? '&' : '', |
|
71 | 71 | $method->getName(), |
72 | 72 | implode(', ', $this->generateArguments($method->getArguments())), |
73 | 73 | $this->getReturnType($method) |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | private function generateArguments(array $arguments) |
103 | 103 | { |
104 | 104 | $typeHintReference = $this->typeHintReference; |
105 | - return array_map(function (Node\ArgumentNode $argument) use ($typeHintReference) { |
|
105 | + return array_map(function(Node\ArgumentNode $argument) use ($typeHintReference) { |
|
106 | 106 | $php = ''; |
107 | 107 | |
108 | 108 | if (version_compare(PHP_VERSION, '7.1', '>=')) { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * @var MethodNode[] |
31 | 31 | */ |
32 | - private $methods = array(); |
|
32 | + private $methods = array(); |
|
33 | 33 | |
34 | 34 | public function getParentClass() |
35 | 35 | { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | public function addMethod(MethodNode $method, $force = false) |
104 | 104 | { |
105 | - if (!$this->isExtendable($method->getName())){ |
|
105 | + if (!$this->isExtendable($method->getName())) { |
|
106 | 106 | $message = sprintf( |
107 | 107 | 'Method `%s` is not extendable, so can not be added.', $method->getName() |
108 | 108 | ); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function addUnextendableMethod($unextendableMethod) |
154 | 154 | { |
155 | - if (!$this->isExtendable($unextendableMethod)){ |
|
155 | + if (!$this->isExtendable($unextendableMethod)) { |
|
156 | 156 | return; |
157 | 157 | } |
158 | 158 | $this->unextendableMethods[] = $unextendableMethod; |