@@ -126,6 +126,9 @@ |
||
| 126 | 126 | ); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | + /** |
|
| 130 | + * @param string $methodName |
|
| 131 | + */ |
|
| 129 | 132 | private function createUnexpectedCallException(ObjectProphecy $prophecy, $methodName, |
| 130 | 133 | array $arguments) |
| 131 | 134 | { |
@@ -127,7 +127,7 @@ |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | private function createUnexpectedCallException(ObjectProphecy $prophecy, $methodName, |
| 130 | - array $arguments) |
|
| 130 | + array $arguments) |
|
| 131 | 131 | { |
| 132 | 132 | $classname = get_class($prophecy->reveal()); |
| 133 | 133 | $argstring = implode(', ', array_map(array($this->util, 'stringify'), $arguments)); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // Sort matches by their score value |
| 86 | - @usort($matches, function ($match1, $match2) { return $match2[0] - $match1[0]; }); |
|
| 86 | + @usort($matches, function($match1, $match2) { return $match2[0] - $match1[0]; }); |
|
| 87 | 87 | |
| 88 | 88 | // If Highest rated method prophecy has a promise - execute it or return null instead |
| 89 | 89 | $returnValue = null; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | public function findCalls($methodName, ArgumentsWildcard $wildcard) |
| 119 | 119 | { |
| 120 | 120 | return array_values( |
| 121 | - array_filter($this->recordedCalls, function (Call $call) use ($methodName, $wildcard) { |
|
| 121 | + array_filter($this->recordedCalls, function(Call $call) use ($methodName, $wildcard) { |
|
| 122 | 122 | return $methodName === $call->getMethodName() |
| 123 | 123 | && 0 < $wildcard->scoreArguments($call->getArguments()) |
| 124 | 124 | ; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | { |
| 132 | 132 | $classname = get_class($prophecy->reveal()); |
| 133 | 133 | $argstring = implode(', ', array_map(array($this->util, 'stringify'), $arguments)); |
| 134 | - $expected = implode("\n", array_map(function (MethodProphecy $methodProphecy) { |
|
| 134 | + $expected = implode("\n", array_map(function(MethodProphecy $methodProphecy) { |
|
| 135 | 135 | return sprintf(' - %s(%s)', |
| 136 | 136 | $methodProphecy->getMethodName(), |
| 137 | 137 | $methodProphecy->getArgumentsWildcard() |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | return new UnexpectedCallException( |
| 142 | 142 | sprintf( |
| 143 | - "Method call:\n". |
|
| 144 | - " - %s(%s)\n". |
|
| 143 | + "Method call:\n" . |
|
| 144 | + " - %s(%s)\n" . |
|
| 145 | 145 | "on %s was not expected, expected calls were:\n%s", |
| 146 | 146 | |
| 147 | 147 | $methodName, $argstring, $classname, $expected |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @param ObjectProphecy $objectProphecy |
| 41 | 41 | * @param string $methodName |
| 42 | - * @param null|Argument\ArgumentsWildcard|array $arguments |
|
| 42 | + * @param Argument\ArgumentsWildcard $arguments |
|
| 43 | 43 | * |
| 44 | 44 | * @throws \Prophecy\Exception\Doubler\MethodNotFoundException If method not found |
| 45 | 45 | */ |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | /** |
| 263 | 263 | * Checks provided prediction immediately. |
| 264 | 264 | * |
| 265 | - * @param callable|Prediction\PredictionInterface $prediction |
|
| 265 | + * @param Prediction\PredictionInterface $prediction |
|
| 266 | 266 | * |
| 267 | 267 | * @return $this |
| 268 | 268 | * |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | /** |
| 369 | 369 | * Returns currently registered promise. |
| 370 | 370 | * |
| 371 | - * @return null|Promise\PromiseInterface |
|
| 371 | + * @return Promise\PromiseInterface |
|
| 372 | 372 | */ |
| 373 | 373 | public function getPromise() |
| 374 | 374 | { |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | /** |
| 379 | 379 | * Returns currently registered prediction. |
| 380 | 380 | * |
| 381 | - * @return null|Prediction\PredictionInterface |
|
| 381 | + * @return Prediction\PredictionInterface |
|
| 382 | 382 | */ |
| 383 | 383 | public function getPrediction() |
| 384 | 384 | { |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $reflectedMethod = new \ReflectionMethod($double, $methodName); |
| 59 | 59 | if ($reflectedMethod->isFinal()) { |
| 60 | 60 | throw new MethodProphecyException(sprintf( |
| 61 | - "Can not add prophecy for a method `%s::%s()`\n". |
|
| 61 | + "Can not add prophecy for a method `%s::%s()`\n" . |
|
| 62 | 62 | "as it is a final method.", |
| 63 | 63 | get_class($double), |
| 64 | 64 | $methodName |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | if (version_compare(PHP_VERSION, '7.0', '>=') && true === $reflectedMethod->hasReturnType()) { |
| 73 | 73 | $type = (string) $reflectedMethod->getReturnType(); |
| 74 | - $this->will(function () use ($type) { |
|
| 74 | + $this->will(function() use ($type) { |
|
| 75 | 75 | switch ($type) { |
| 76 | 76 | case 'string': return ''; |
| 77 | 77 | case 'float': return 0.0; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | case 'callable': |
| 83 | 83 | case 'Closure': |
| 84 | - return function () {}; |
|
| 84 | + return function() {}; |
|
| 85 | 85 | |
| 86 | 86 | case 'Traversable': |
| 87 | 87 | case 'Generator': |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | if (!$arguments instanceof Argument\ArgumentsWildcard) { |
| 116 | 116 | throw new InvalidArgumentException(sprintf( |
| 117 | - "Either an array or an instance of ArgumentsWildcard expected as\n". |
|
| 117 | + "Either an array or an instance of ArgumentsWildcard expected as\n" . |
|
| 118 | 118 | 'a `MethodProphecy::withArguments()` argument, but got %s.', |
| 119 | 119 | gettype($arguments) |
| 120 | 120 | )); |
@@ -259,7 +259,7 @@ |
||
| 259 | 259 | * Appends code coverage data. |
| 260 | 260 | * |
| 261 | 261 | * @param array $data |
| 262 | - * @param mixed $id |
|
| 262 | + * @param null|string $id |
|
| 263 | 263 | * @param bool $append |
| 264 | 264 | * @param mixed $linesToBeCovered |
| 265 | 265 | * @param array $linesToBeUsed |
@@ -751,8 +751,8 @@ discard block |
||
| 751 | 751 | $token instanceof PHP_Token_CLASS) { |
| 752 | 752 | if (empty($classes[$token->getName()]['methods'])) { |
| 753 | 753 | for ($i = $token->getLine(); |
| 754 | - $i <= $token->getEndLine(); |
|
| 755 | - $i++) { |
|
| 754 | + $i <= $token->getEndLine(); |
|
| 755 | + $i++) { |
|
| 756 | 756 | $this->ignoredLines[$filename][] = $i; |
| 757 | 757 | } |
| 758 | 758 | } else { |
@@ -772,14 +772,14 @@ discard block |
||
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | for ($i = $token->getLine(); |
| 775 | - $i < $firstMethod['startLine']; |
|
| 776 | - $i++) { |
|
| 775 | + $i < $firstMethod['startLine']; |
|
| 776 | + $i++) { |
|
| 777 | 777 | $this->ignoredLines[$filename][] = $i; |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | for ($i = $token->getEndLine(); |
| 781 | - $i > $lastMethod['endLine']; |
|
| 782 | - $i--) { |
|
| 781 | + $i > $lastMethod['endLine']; |
|
| 782 | + $i--) { |
|
| 783 | 783 | $this->ignoredLines[$filename][] = $i; |
| 784 | 784 | } |
| 785 | 785 | } |
@@ -726,7 +726,7 @@ |
||
| 726 | 726 | |
| 727 | 727 | // A DOC_COMMENT token or a COMMENT token starting with "/*" |
| 728 | 728 | // does not contain the final \n character in its text |
| 729 | - if (isset($lines[$i-1]) && 0 === strpos($_token, '/*') && '*/' === substr(trim($lines[$i-1]), -2)) { |
|
| 729 | + if (isset($lines[$i - 1]) && 0 === strpos($_token, '/*') && '*/' === substr(trim($lines[$i - 1]), -2)) { |
|
| 730 | 730 | $this->ignoredLines[$filename][] = $i; |
| 731 | 731 | } |
| 732 | 732 | } |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | /** |
| 67 | 67 | * Returns the current element. |
| 68 | 68 | * |
| 69 | - * @return PHPUnit_Framework_Test |
|
| 69 | + * @return PHP_CodeCoverage_Report_Node|null |
|
| 70 | 70 | */ |
| 71 | 71 | public function current() |
| 72 | 72 | { |
@@ -13,6 +13,9 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | class PHP_CodeCoverage_Report_XML_File_Report extends PHP_CodeCoverage_Report_XML_File |
| 15 | 15 | { |
| 16 | + /** |
|
| 17 | + * @param string $name |
|
| 18 | + */ |
|
| 16 | 19 | public function __construct($name) |
| 17 | 20 | { |
| 18 | 21 | $this->dom = new DOMDocument; |
@@ -58,6 +61,9 @@ discard block |
||
| 58 | 61 | return $this->getUnitObject('trait', $name); |
| 59 | 62 | } |
| 60 | 63 | |
| 64 | + /** |
|
| 65 | + * @param string $tagName |
|
| 66 | + */ |
|
| 61 | 67 | private function getUnitObject($tagName, $name) |
| 62 | 68 | { |
| 63 | 69 | $node = $this->contextNode->appendChild( |
@@ -60,6 +60,9 @@ discard block |
||
| 60 | 60 | return new PHP_CodeCoverage_Report_XML_Totals($totalsContainer); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | + /** |
|
| 64 | + * @param string $name |
|
| 65 | + */ |
|
| 63 | 66 | public function addDirectory($name) |
| 64 | 67 | { |
| 65 | 68 | $dirNode = $this->getDom()->createElementNS( |
@@ -73,6 +76,10 @@ discard block |
||
| 73 | 76 | return new PHP_CodeCoverage_Report_XML_Directory($dirNode); |
| 74 | 77 | } |
| 75 | 78 | |
| 79 | + /** |
|
| 80 | + * @param string $name |
|
| 81 | + * @param string $href |
|
| 82 | + */ |
|
| 76 | 83 | public function addFile($name, $href) |
| 77 | 84 | { |
| 78 | 85 | $fileNode = $this->getDom()->createElementNS( |
@@ -13,6 +13,9 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class PHP_CodeCoverage_Report_XML_Project extends PHP_CodeCoverage_Report_XML_Node |
| 15 | 15 | { |
| 16 | + /** |
|
| 17 | + * @param string $name |
|
| 18 | + */ |
|
| 16 | 19 | public function __construct($name) |
| 17 | 20 | { |
| 18 | 21 | $this->init(); |
@@ -131,7 +131,7 @@ |
||
| 131 | 131 | |
| 132 | 132 | /** |
| 133 | 133 | * @param string $filename |
| 134 | - * @param array $subString |
|
| 134 | + * @param array $subStrings |
|
| 135 | 135 | * @param int $type |
| 136 | 136 | * @return bool |
| 137 | 137 | * @since Method available since Release 1.1.0 |
@@ -530,7 +530,7 @@ |
||
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | /** |
| 533 | - * @return boolean|string |
|
| 533 | + * @return false|string |
|
| 534 | 534 | */ |
| 535 | 535 | public function getParent() |
| 536 | 536 | { |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | break; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - return (string)$tokens[$i]; |
|
| 123 | + return (string) $tokens[$i]; |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
@@ -268,8 +268,8 @@ discard block |
||
| 268 | 268 | { |
| 269 | 269 | $tokens = $this->tokenStream->tokens(); |
| 270 | 270 | |
| 271 | - if ($tokens[$this->id+2] instanceof PHP_Token_CONSTANT_ENCAPSED_STRING) { |
|
| 272 | - $this->name = trim($tokens[$this->id+2], "'\""); |
|
| 271 | + if ($tokens[$this->id + 2] instanceof PHP_Token_CONSTANT_ENCAPSED_STRING) { |
|
| 272 | + $this->name = trim($tokens[$this->id + 2], "'\""); |
|
| 273 | 273 | $this->type = strtolower( |
| 274 | 274 | str_replace('PHP_Token_', '', get_class($tokens[$this->id])) |
| 275 | 275 | ); |
@@ -316,15 +316,15 @@ discard block |
||
| 316 | 316 | // Search for first token inside brackets |
| 317 | 317 | $i = $this->id + 2; |
| 318 | 318 | |
| 319 | - while (!$tokens[$i-1] instanceof PHP_Token_OPEN_BRACKET) { |
|
| 319 | + while (!$tokens[$i - 1] instanceof PHP_Token_OPEN_BRACKET) { |
|
| 320 | 320 | $i++; |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | while (!$tokens[$i] instanceof PHP_Token_CLOSE_BRACKET) { |
| 324 | 324 | if ($tokens[$i] instanceof PHP_Token_STRING) { |
| 325 | - $typeDeclaration = (string)$tokens[$i]; |
|
| 325 | + $typeDeclaration = (string) $tokens[$i]; |
|
| 326 | 326 | } elseif ($tokens[$i] instanceof PHP_Token_VARIABLE) { |
| 327 | - $this->arguments[(string)$tokens[$i]] = $typeDeclaration; |
|
| 327 | + $this->arguments[(string) $tokens[$i]] = $typeDeclaration; |
|
| 328 | 328 | $typeDeclaration = null; |
| 329 | 329 | } |
| 330 | 330 | |
@@ -347,11 +347,11 @@ discard block |
||
| 347 | 347 | |
| 348 | 348 | for ($i = $this->id + 1; $i < count($tokens); $i++) { |
| 349 | 349 | if ($tokens[$i] instanceof PHP_Token_STRING) { |
| 350 | - $this->name = (string)$tokens[$i]; |
|
| 350 | + $this->name = (string) $tokens[$i]; |
|
| 351 | 351 | break; |
| 352 | 352 | } elseif ($tokens[$i] instanceof PHP_Token_AMPERSAND && |
| 353 | - $tokens[$i+1] instanceof PHP_Token_STRING) { |
|
| 354 | - $this->name = (string)$tokens[$i+1]; |
|
| 353 | + $tokens[$i + 1] instanceof PHP_Token_STRING) { |
|
| 354 | + $this->name = (string) $tokens[$i + 1]; |
|
| 355 | 355 | break; |
| 356 | 356 | } elseif ($tokens[$i] instanceof PHP_Token_OPEN_BRACKET) { |
| 357 | 357 | $this->name = 'anonymous function'; |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | */ |
| 454 | 454 | public function getName() |
| 455 | 455 | { |
| 456 | - return (string)$this->tokenStream[$this->id + 2]; |
|
| 456 | + return (string) $this->tokenStream[$this->id + 2]; |
|
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | /** |
@@ -540,11 +540,11 @@ discard block |
||
| 540 | 540 | |
| 541 | 541 | $i = $this->id + 6; |
| 542 | 542 | $tokens = $this->tokenStream->tokens(); |
| 543 | - $className = (string)$tokens[$i]; |
|
| 543 | + $className = (string) $tokens[$i]; |
|
| 544 | 544 | |
| 545 | - while (isset($tokens[$i+1]) && |
|
| 546 | - !$tokens[$i+1] instanceof PHP_Token_WHITESPACE) { |
|
| 547 | - $className .= (string)$tokens[++$i]; |
|
| 545 | + while (isset($tokens[$i + 1]) && |
|
| 546 | + !$tokens[$i + 1] instanceof PHP_Token_WHITESPACE) { |
|
| 547 | + $className .= (string) $tokens[++$i]; |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | return $className; |
@@ -582,11 +582,11 @@ discard block |
||
| 582 | 582 | |
| 583 | 583 | $tokens = $this->tokenStream->tokens(); |
| 584 | 584 | |
| 585 | - while (!$tokens[$i+1] instanceof PHP_Token_OPEN_CURLY) { |
|
| 585 | + while (!$tokens[$i + 1] instanceof PHP_Token_OPEN_CURLY) { |
|
| 586 | 586 | $i++; |
| 587 | 587 | |
| 588 | 588 | if ($tokens[$i] instanceof PHP_Token_STRING) { |
| 589 | - $this->interfaces[] = (string)$tokens[$i]; |
|
| 589 | + $this->interfaces[] = (string) $tokens[$i]; |
|
| 590 | 590 | } |
| 591 | 591 | } |
| 592 | 592 | |
@@ -780,12 +780,12 @@ discard block |
||
| 780 | 780 | public function getName() |
| 781 | 781 | { |
| 782 | 782 | $tokens = $this->tokenStream->tokens(); |
| 783 | - $namespace = (string)$tokens[$this->id+2]; |
|
| 783 | + $namespace = (string) $tokens[$this->id + 2]; |
|
| 784 | 784 | |
| 785 | - for ($i = $this->id + 3;; $i += 2) { |
|
| 785 | + for ($i = $this->id + 3; ; $i += 2) { |
|
| 786 | 786 | if (isset($tokens[$i]) && |
| 787 | 787 | $tokens[$i] instanceof PHP_Token_NS_SEPARATOR) { |
| 788 | - $namespace .= '\\' . $tokens[$i+1]; |
|
| 788 | + $namespace .= '\\' . $tokens[$i + 1]; |
|
| 789 | 789 | } else { |
| 790 | 790 | break; |
| 791 | 791 | } |