| 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 |
||
| 91 | private function createMockMessage(): Message |
||
| 92 | { |
||
| 93 | return new class() implements Message { |
||
| 94 | private ?Chronos $dateSent = null; |
||
| 95 | |||
| 96 | public function getSubject(): string |
||
| 97 | { |
||
| 98 | return 'my subject'; |
||
| 99 | } |
||
| 100 | |||
| 101 | public function getBody(): string |
||
| 102 | { |
||
| 103 | return 'my body'; |
||
| 104 | } |
||
| 105 | |||
| 106 | public function setDateSent(?Chronos $dateSent): void |
||
| 107 | { |
||
| 108 | $this->dateSent = $dateSent; |
||
| 109 | } |
||
| 110 | |||
| 111 | public function getEmail(): string |
||
| 112 | { |
||
| 113 | return '[email protected]'; |
||
| 114 | } |
||
| 115 | |||
| 116 | public function getRecipient(): ?User |
||
| 117 | { |
||
| 118 | return null; |
||
| 119 | } |
||
| 120 | |||
| 121 | public function getId(): ?int |
||
| 122 | { |
||
| 123 | return null; |
||
| 124 | } |
||
| 125 | |||
| 126 | public function setSubject(string $subject): void |
||
| 127 | { |
||
| 128 | } |
||
| 129 | |||
| 130 | public function setBody(string $body): void |
||
| 131 | { |
||
| 132 | } |
||
| 133 | |||
| 134 | public function getDateSent(): ?Chronos |
||
| 135 | { |
||
| 136 | return $this->dateSent; |
||
| 137 | } |
||
| 138 | |||
| 139 | public function setEmail(string $email): void |
||
| 140 | { |
||
| 141 | } |
||
| 142 | |||
| 143 | public function getType(): string |
||
| 144 | { |
||
| 145 | return 'my_type'; |
||
| 146 | } |
||
| 150 |
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