| Conditions | 1 |
| Paths | 1 |
| Total Lines | 53 |
| Code Lines | 47 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php declare(strict_types=1); |
||
| 49 | private function getReflectionClassMocks(): array |
||
| 50 | { |
||
| 51 | $classes = []; |
||
| 52 | $reflectionClassMock = $this->getReflectionClassMock(); |
||
| 53 | $reflectionClassMock->method('isDocumented') |
||
| 54 | ->willReturn(true); |
||
| 55 | $reflectionClassMock->method('isInterface') |
||
| 56 | ->willReturn(false); |
||
| 57 | $reflectionClassMock->method('isTrait') |
||
| 58 | ->willReturn(false); |
||
| 59 | $reflectionClassMock->method('isException') |
||
| 60 | ->willReturn(false); |
||
| 61 | $classes[] = $reflectionClassMock; |
||
| 62 | |||
| 63 | $reflectionClassMock2 = $this->getReflectionClassMock(); |
||
| 64 | $reflectionClassMock2->method('isDocumented') |
||
| 65 | ->willReturn(false); |
||
| 66 | $classes[] = $reflectionClassMock2; |
||
| 67 | |||
| 68 | $reflectionClassMock3 = $this->getReflectionClassMock(); |
||
| 69 | $reflectionClassMock3->method('isDocumented') |
||
| 70 | ->willReturn(true); |
||
| 71 | $reflectionClassMock3->method('isInterface') |
||
| 72 | ->willReturn(true); |
||
| 73 | $reflectionClassMock3->method('isTrait') |
||
| 74 | ->willReturn(false); |
||
| 75 | $reflectionClassMock3->method('isException') |
||
| 76 | ->willReturn(false); |
||
| 77 | $classes[] = $reflectionClassMock3; |
||
| 78 | |||
| 79 | $reflectionClassMock4 = $this->getReflectionClassMock(); |
||
| 80 | $reflectionClassMock4->method('isDocumented') |
||
| 81 | ->willReturn(true); |
||
| 82 | $reflectionClassMock4->method('isInterface') |
||
| 83 | ->willReturn(false); |
||
| 84 | $reflectionClassMock4->method('isTrait') |
||
| 85 | ->willReturn(true); |
||
| 86 | $reflectionClassMock4->method('isException') |
||
| 87 | ->willReturn(false); |
||
| 88 | $classes[] = $reflectionClassMock4; |
||
| 89 | |||
| 90 | $reflectionClassMock5 = $this->getReflectionClassMock(); |
||
| 91 | $reflectionClassMock5->method('isDocumented') |
||
| 92 | ->willReturn(true); |
||
| 93 | $reflectionClassMock5->method('isInterface') |
||
| 94 | ->willReturn(false); |
||
| 95 | $reflectionClassMock5->method('isTrait') |
||
| 96 | ->willReturn(false); |
||
| 97 | $reflectionClassMock5->method('isException') |
||
| 98 | ->willReturn(true); |
||
| 99 | $classes[] = $reflectionClassMock5; |
||
| 100 | return $classes; |
||
| 101 | } |
||
| 102 | |||
| 156 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: