@@ -35,7 +35,7 @@ |
||
| 35 | 35 | private $__moka_methods = []; |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | - * @return object |
|
| 38 | + * @return \PHPUnit\Framework\MockObject\MockObject |
|
| 39 | 39 | */ |
| 40 | 40 | public function __moka_getMock() |
| 41 | 41 | { |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | protected function doCall(string $name, array $arguments) |
| 102 | 102 | { |
| 103 | - if (!$this->__moka_mockingStrategy instanceof MockingStrategyInterface) { |
|
| 103 | + if ( ! $this->__moka_mockingStrategy instanceof MockingStrategyInterface) { |
|
| 104 | 104 | return null; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | protected function doGet(string $name) |
| 119 | 119 | { |
| 120 | - if (!$this->__moka_mockingStrategy instanceof MockingStrategyInterface) { |
|
| 120 | + if ( ! $this->__moka_mockingStrategy instanceof MockingStrategyInterface) { |
|
| 121 | 121 | return null; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -8,11 +8,9 @@ |
||
| 8 | 8 | use Moka\Exception\MockNotCreatedException; |
| 9 | 9 | use Moka\Exception\NotImplementedException; |
| 10 | 10 | use function Moka\Factory\buildStubs; |
| 11 | -use Moka\Factory\StubFactory; |
|
| 12 | 11 | use Moka\Stub\MethodStub; |
| 13 | 12 | use Moka\Stub\PropertyStub; |
| 14 | 13 | use Moka\Stub\StubInterface; |
| 15 | -use Moka\Stub\StubSet; |
|
| 16 | 14 | |
| 17 | 15 | /** |
| 18 | 16 | * Class AbstractMockingStrategy |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | final protected static function checkDependencies(string $dependencyClassName, string $dependencyPackageName) |
| 35 | 35 | { |
| 36 | - if (!class_exists($dependencyClassName)) { |
|
| 36 | + if ( ! class_exists($dependencyClassName)) { |
|
| 37 | 37 | throw new MissingDependencyException( |
| 38 | 38 | sprintf( |
| 39 | 39 | 'Class "%s" does not exist, please install package "%s"', |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | { |
| 152 | 152 | $this->verifyMockType(); |
| 153 | 153 | |
| 154 | - if (!is_a($mock, $this->mockType)) { |
|
| 154 | + if ( ! is_a($mock, $this->mockType)) { |
|
| 155 | 155 | throw new InvalidArgumentException( |
| 156 | 156 | sprintf( |
| 157 | 157 | 'Mock object must be an instance of "%s", "%s" given', |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | private function verifyMockType(): void |
| 171 | 171 | { |
| 172 | - if (!$this->mockType) { |
|
| 172 | + if ( ! $this->mockType) { |
|
| 173 | 173 | throw new NotImplementedException('Mock type was not defined'); |
| 174 | 174 | } |
| 175 | 175 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | public function get($id): ProxyInterface |
| 35 | 35 | { |
| 36 | - if (!$this->has($id)) { |
|
| 36 | + if ( ! $this->has($id)) { |
|
| 37 | 37 | throw new InvalidIdentifierException( |
| 38 | 38 | sprintf( |
| 39 | 39 | 'Cannot find mock object with identifier "%s"', |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | public function getCallable(): callable |
| 34 | 34 | { |
| 35 | - return function () { |
|
| 35 | + return function() { |
|
| 36 | 36 | }; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -309,17 +309,17 @@ discard block |
||
| 309 | 309 | ]; |
| 310 | 310 | |
| 311 | 311 | $data = array_merge( |
| 312 | - array_map(function (array $set) { |
|
| 312 | + array_map(function(array $set) { |
|
| 313 | 313 | array_unshift($set, $required = true); |
| 314 | 314 | return $set; |
| 315 | 315 | }, $required), |
| 316 | - array_map(function (array $set) { |
|
| 316 | + array_map(function(array $set) { |
|
| 317 | 317 | array_unshift($set, $required = false); |
| 318 | 318 | return $set; |
| 319 | 319 | }, $optional) |
| 320 | 320 | ); |
| 321 | 321 | |
| 322 | - return array_reduce($data, function (array $data, array $set) { |
|
| 322 | + return array_reduce($data, function(array $data, array $set) { |
|
| 323 | 323 | $key = preg_replace('/^an? +/', '', $set[1]); |
| 324 | 324 | $data[$key] = $set; |
| 325 | 325 | |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | |
| 425 | 425 | $object = $this->strategy->get($mock); |
| 426 | 426 | foreach ($fqcns as $fqcn) { |
| 427 | - if (!is_a($object, $fqcn)) { |
|
| 427 | + if ( ! is_a($object, $fqcn)) { |
|
| 428 | 428 | $this->markFeatureUnsupported( |
| 429 | 429 | sprintf( |
| 430 | 430 | 'getting a valid mock from %s', |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | protected static function doGenerate(\ReflectionParameter $parameter): string |
| 28 | 28 | { |
| 29 | 29 | try { |
| 30 | - $defaultValue = !$parameter->allowsNull() |
|
| 30 | + $defaultValue = ! $parameter->allowsNull() |
|
| 31 | 31 | ? var_export($parameter->getDefaultValue(), true) |
| 32 | 32 | : 'null'; |
| 33 | 33 | |
@@ -84,8 +84,8 @@ |
||
| 84 | 84 | |
| 85 | 85 | foreach ($methods as $method) { |
| 86 | 86 | if ( |
| 87 | - !$method->isFinal() && |
|
| 88 | - !\in_array($method->name, self::UNSAFE_METHODS, $strict = true) |
|
| 87 | + ! $method->isFinal() && |
|
| 88 | + ! \in_array($method->name, self::UNSAFE_METHODS, $strict = true) |
|
| 89 | 89 | ) { |
| 90 | 90 | $methodsCode[] = MethodTemplate::generate($method); |
| 91 | 91 | } |
@@ -21,8 +21,8 @@ |
||
| 21 | 21 | protected static function getVisibility(\Reflector $reflector): string |
| 22 | 22 | { |
| 23 | 23 | if ( |
| 24 | - !$reflector instanceof \ReflectionMethod && |
|
| 25 | - !$reflector instanceof \ReflectionProperty |
|
| 24 | + ! $reflector instanceof \ReflectionMethod && |
|
| 25 | + ! $reflector instanceof \ReflectionProperty |
|
| 26 | 26 | ) { |
| 27 | 27 | throw new InvalidArgumentException( |
| 28 | 28 | sprintf( |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | return $this->buildProxy($fqcnOrAlias); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if (!$this->container->has($alias)) { |
|
| 68 | + if ( ! $this->container->has($alias)) { |
|
| 69 | 69 | $this->container->set($alias, $this->buildProxy($fqcnOrAlias)); |
| 70 | 70 | } |
| 71 | 71 | |