| Total Lines | 55 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 93 | private function createMockMessage(): Message |
||
| 94 | { |
||
| 95 | return new class() implements Message { |
||
| 96 | private ?Chronos $dateSent = null; |
||
| 97 | |||
| 98 | public function getSubject(): string |
||
| 99 | { |
||
| 100 | return 'my subject'; |
||
| 101 | } |
||
| 102 | |||
| 103 | public function getBody(): string |
||
| 104 | { |
||
| 105 | return 'my body'; |
||
| 106 | } |
||
| 107 | |||
| 108 | public function setDateSent(?Chronos $dateSent): void |
||
| 109 | { |
||
| 110 | $this->dateSent = $dateSent; |
||
| 111 | } |
||
| 112 | |||
| 113 | public function getEmail(): string |
||
| 114 | { |
||
| 115 | return '[email protected]'; |
||
| 116 | } |
||
| 117 | |||
| 118 | public function getRecipient(): ?User |
||
| 119 | { |
||
| 120 | return null; |
||
| 121 | } |
||
| 122 | |||
| 123 | public function getId(): ?int |
||
| 124 | { |
||
| 125 | return null; |
||
| 126 | } |
||
| 127 | |||
| 128 | public function setSubject(string $subject): void |
||
| 129 | { |
||
| 130 | } |
||
| 131 | |||
| 132 | public function setBody(string $body): void |
||
| 133 | { |
||
| 134 | } |
||
| 135 | |||
| 136 | public function getDateSent(): ?Chronos |
||
| 137 | { |
||
| 138 | return $this->dateSent; |
||
| 139 | } |
||
| 140 | |||
| 141 | public function setEmail(string $email): void |
||
| 142 | { |
||
| 143 | } |
||
| 144 | |||
| 145 | public function getType(): string |
||
| 146 | { |
||
| 147 | return 'my_type'; |
||
| 148 | } |
||
| 152 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths