@@ -48,6 +48,6 @@ |
||
48 | 48 | */ |
49 | 49 | public function __toString() |
50 | 50 | { |
51 | - return '<Ducktype[' . implode(', ', $this->_expected) . ']>'; |
|
51 | + return '<Ducktype['.implode(', ', $this->_expected).']>'; |
|
52 | 52 | } |
53 | 53 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | namespace Mockery\Adapter\Phpunit\Legacy; |
22 | 22 | |
23 | -if (class_exists('PHPUnit_Framework_TestCase') && ! class_exists('PHPUnit\Util\Blacklist')) { |
|
23 | +if (class_exists('PHPUnit_Framework_TestCase') && !class_exists('PHPUnit\Util\Blacklist')) { |
|
24 | 24 | class_alias('PHPUnit_Framework_ExpectationFailedException', 'PHPUnit\Framework\ExpectationFailedException'); |
25 | 25 | class_alias('PHPUnit_Framework_Test', 'PHPUnit\Framework\Test'); |
26 | 26 | class_alias('PHPUnit_Framework_TestCase', 'PHPUnit\Framework\TestCase'); |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $allowMockingProtectedMethods = $this->_mockery_allowMockingProtectedMethods; |
212 | 212 | |
213 | 213 | $lastExpectation = \Mockery::parseShouldReturnArgs( |
214 | - $this, $methodNames, function ($method) use ($self, $allowMockingProtectedMethods) { |
|
214 | + $this, $methodNames, function($method) use ($self, $allowMockingProtectedMethods) { |
|
215 | 215 | $rm = $self->mockery_getMethod($method); |
216 | 216 | if ($rm) { |
217 | 217 | if ($rm->isPrivate()) { |
@@ -512,9 +512,9 @@ discard block |
||
512 | 512 | { |
513 | 513 | if ($order < $this->_mockery_currentOrder) { |
514 | 514 | $exception = new \Mockery\Exception\InvalidOrderException( |
515 | - 'Method ' . __CLASS__ . '::' . $method . '()' |
|
515 | + 'Method '.__CLASS__.'::'.$method.'()' |
|
516 | 516 | . ' called out of order: expected order ' |
517 | - . $order . ', was ' . $this->_mockery_currentOrder |
|
517 | + . $order.', was '.$this->_mockery_currentOrder |
|
518 | 518 | ); |
519 | 519 | $exception->setMock($this) |
520 | 520 | ->setMethodName($method) |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | if (!method_exists($this, $name) && method_exists(get_parent_class($this), '__call')) { |
637 | 637 | return call_user_func('parent::__call', $name, $args); |
638 | 638 | } |
639 | - return call_user_func_array('parent::' . $name, $args); |
|
639 | + return call_user_func_array('parent::'.$name, $args); |
|
640 | 640 | } |
641 | 641 | |
642 | 642 | /** |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | $rfc = new \ReflectionClass($this); |
656 | 656 | |
657 | 657 | // HHVM has a Stringish interface |
658 | - $interfaces = array_filter($rfc->getInterfaces(), function ($i) { |
|
658 | + $interfaces = array_filter($rfc->getInterfaces(), function($i) { |
|
659 | 659 | return $i->getName() !== "Stringish"; |
660 | 660 | }); |
661 | 661 | $onlyImplementsMock = 2 == count($interfaces); |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | |
731 | 731 | case 'callable': |
732 | 732 | case 'Closure': |
733 | - return function () { |
|
733 | + return function() { |
|
734 | 734 | }; |
735 | 735 | |
736 | 736 | case 'Traversable': |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | return $associatedRealObject->__call($method, $args); |
807 | 807 | } catch (BadMethodCallException $e) { |
808 | 808 | throw new BadMethodCallException( |
809 | - 'Static method ' . $associatedRealObject->mockery_getName() . '::' . $method |
|
809 | + 'Static method '.$associatedRealObject->mockery_getName().'::'.$method |
|
810 | 810 | . '() does not exist on this mock object', |
811 | 811 | null, |
812 | 812 | $e |
@@ -909,12 +909,12 @@ discard block |
||
909 | 909 | } |
910 | 910 | } |
911 | 911 | |
912 | - $message = 'Method ' . __CLASS__ . '::' . $method . |
|
912 | + $message = 'Method '.__CLASS__.'::'.$method. |
|
913 | 913 | '() does not exist on this mock object'; |
914 | 914 | |
915 | 915 | if (!is_null($rm)) { |
916 | - $message = 'Received ' . __CLASS__ . |
|
917 | - '::' . $method . '(), but no expectations were specified'; |
|
916 | + $message = 'Received '.__CLASS__. |
|
917 | + '::'.$method.'(), but no expectations were specified'; |
|
918 | 918 | } |
919 | 919 | |
920 | 920 | $bmce = new BadMethodCallException($message); |
@@ -955,10 +955,10 @@ discard block |
||
955 | 955 | private function getNonPublicMethods() |
956 | 956 | { |
957 | 957 | return array_map( |
958 | - function ($method) { |
|
958 | + function($method) { |
|
959 | 959 | return $method->getName(); |
960 | 960 | }, |
961 | - array_filter($this->mockery_getMethods(), function ($method) { |
|
961 | + array_filter($this->mockery_getMethods(), function($method) { |
|
962 | 962 | return !$method->isPublic(); |
963 | 963 | }) |
964 | 964 | ); |
@@ -31,6 +31,6 @@ |
||
31 | 31 | return; |
32 | 32 | } |
33 | 33 | |
34 | - eval("?>" . $definition->getCode()); |
|
34 | + eval("?>".$definition->getCode()); |
|
35 | 35 | } |
36 | 36 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $builder->addTarget('stdClass'); |
142 | 142 | $builder->setName($name); |
143 | 143 | continue; |
144 | - } elseif (is_string($arg) && substr($arg, strlen($arg)-1, 1) == ']') { |
|
144 | + } elseif (is_string($arg) && substr($arg, strlen($arg) - 1, 1) == ']') { |
|
145 | 145 | $parts = explode('[', $arg); |
146 | 146 | if (!class_exists($parts[0], true) && !interface_exists($parts[0], true)) { |
147 | 147 | throw new \Mockery\Exception('Can only create a partial mock from' |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | throw new \Mockery\Exception( |
194 | 194 | 'Unable to parse arguments sent to ' |
195 | - . get_class($this) . '::mock()' |
|
195 | + . get_class($this).'::mock()' |
|
196 | 196 | ); |
197 | 197 | } |
198 | 198 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | public function getKeyOfDemeterMockFor($method, $parent) |
265 | 265 | { |
266 | 266 | $keys = array_keys($this->_mocks); |
267 | - $match = preg_grep("/__demeter_" . md5($parent) . "_{$method}$/", $keys); |
|
267 | + $match = preg_grep("/__demeter_".md5($parent)."_{$method}$/", $keys); |
|
268 | 268 | if (count($match) == 1) { |
269 | 269 | $res = array_values($match); |
270 | 270 | if (count($res) > 0) { |
@@ -405,8 +405,8 @@ discard block |
||
405 | 405 | { |
406 | 406 | if ($order < $this->_currentOrder) { |
407 | 407 | $exception = new \Mockery\Exception\InvalidOrderException( |
408 | - 'Method ' . $method . ' called out of order: expected order ' |
|
409 | - . $order . ', was ' . $this->_currentOrder |
|
408 | + 'Method '.$method.' called out of order: expected order ' |
|
409 | + . $order.', was '.$this->_currentOrder |
|
410 | 410 | ); |
411 | 411 | $exception->setMock($mock) |
412 | 412 | ->setMethodName($method) |
@@ -490,11 +490,11 @@ discard block |
||
490 | 490 | $instantiator = new Instantiator; |
491 | 491 | $instance = $instantiator->instantiate($mockName); |
492 | 492 | } catch (\Exception $ex) { |
493 | - $internalMockName = $mockName . '_Internal'; |
|
493 | + $internalMockName = $mockName.'_Internal'; |
|
494 | 494 | |
495 | 495 | if (!class_exists($internalMockName)) { |
496 | - eval("class $internalMockName extends $mockName {" . |
|
497 | - 'public function __construct() {}' . |
|
496 | + eval("class $internalMockName extends $mockName {". |
|
497 | + 'public function __construct() {}'. |
|
498 | 498 | '}'); |
499 | 499 | } |
500 | 500 | |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | $className = substr($className, 1); // remove the first backslash |
538 | 538 | } |
539 | 539 | // all the namespaces and class name should match the regex |
540 | - $invalidNames = array_filter(explode('\\', $className), function ($name) { |
|
540 | + $invalidNames = array_filter(explode('\\', $className), function($name) { |
|
541 | 541 | return !preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $name); |
542 | 542 | }); |
543 | 543 | return empty($invalidNames); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | public function getMethods() |
53 | 53 | { |
54 | - return array_map(function ($method) { |
|
54 | + return array_map(function($method) { |
|
55 | 55 | return new Method($method); |
56 | 56 | }, $this->rfc->getMethods()); |
57 | 57 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public function getInterfaces() |
60 | 60 | { |
61 | 61 | $class = __CLASS__; |
62 | - return array_map(function ($interface) use ($class) { |
|
62 | + return array_map(function($interface) use ($class) { |
|
63 | 63 | return new $class($interface); |
64 | 64 | }, $this->rfc->getInterfaces()); |
65 | 65 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | return PHP_VERSION_ID >= 70100 ? $this->rfp->getType()->getName() : (string) $this->rfp->getType(); |
78 | 78 | } |
79 | 79 | |
80 | - if (preg_match('/^Parameter #[0-9]+ \[ \<(required|optional)\> (?<typehint>\S+ )?.*\$' . $this->rfp->getName() . ' .*\]$/', $this->rfp->__toString(), $typehintMatch)) { |
|
80 | + if (preg_match('/^Parameter #[0-9]+ \[ \<(required|optional)\> (?<typehint>\S+ )?.*\$'.$this->rfp->getName().' .*\]$/', $this->rfp->__toString(), $typehintMatch)) { |
|
81 | 81 | if (!empty($typehintMatch['typehint'])) { |
82 | 82 | return $typehintMatch['typehint']; |
83 | 83 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | { |
94 | 94 | $name = $this->rfp->getName(); |
95 | 95 | if (!$name || $name == '...') { |
96 | - $name = 'arg' . static::$parameterCounter++; |
|
96 | + $name = 'arg'.static::$parameterCounter++; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return $name; |
@@ -70,7 +70,7 @@ |
||
70 | 70 | |
71 | 71 | public function generate(MockConfiguration $config) |
72 | 72 | { |
73 | - $code = file_get_contents(__DIR__ . '/../Mock.php'); |
|
73 | + $code = file_get_contents(__DIR__.'/../Mock.php'); |
|
74 | 74 | $className = $config->getName() ?: $config->generateName(); |
75 | 75 | |
76 | 76 | $namedConfig = $config->rename($className); |
@@ -36,7 +36,7 @@ |
||
36 | 36 | |
37 | 37 | public function getParameters() |
38 | 38 | { |
39 | - return array_map(function ($parameter) { |
|
39 | + return array_map(function($parameter) { |
|
40 | 40 | return new Parameter($parameter); |
41 | 41 | }, $this->method->getParameters()); |
42 | 42 | } |