| Conditions | 2 |
| Total Lines | 106 |
| 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); |
||
| 36 | public function setup() |
||
| 37 | { |
||
| 38 | try { |
||
| 39 | $this->errors = new ConstraintViolationList(); |
||
| 40 | $this->entity = new class implements EntityInterface |
||
| 41 | { |
||
| 42 | public function getId() |
||
| 43 | { |
||
| 44 | return; |
||
| 45 | } |
||
| 46 | |||
| 47 | public static function loadMetadata(DoctrineClassMetaData $metadata): void |
||
| 48 | { |
||
| 49 | return; |
||
| 50 | } |
||
| 51 | |||
| 52 | public static function getPlural(): string |
||
| 53 | { |
||
| 54 | return ''; |
||
| 55 | } |
||
| 56 | |||
| 57 | public static function getSingular(): string |
||
| 58 | { |
||
| 59 | return ''; |
||
| 60 | } |
||
| 61 | |||
| 62 | public static function getIdField(): string |
||
| 63 | { |
||
| 64 | return ''; |
||
| 65 | } |
||
| 66 | |||
| 67 | public function getShortName(): string |
||
| 68 | { |
||
| 69 | return ''; |
||
| 70 | } |
||
| 71 | |||
| 72 | public function debug(int $level = 0): string |
||
|
|
|||
| 73 | { |
||
| 74 | return ''; |
||
| 75 | } |
||
| 76 | |||
| 77 | public static function loadValidatorMetaData(ValidatorClassMetaData $metadata): void |
||
| 78 | { |
||
| 79 | return; |
||
| 80 | } |
||
| 81 | |||
| 82 | public function injectValidator(EntityValidatorInterface $validator) |
||
| 83 | { |
||
| 84 | return; |
||
| 85 | } |
||
| 86 | |||
| 87 | public function isValid(): bool |
||
| 88 | { |
||
| 89 | return false; |
||
| 90 | } |
||
| 91 | |||
| 92 | public function validate() |
||
| 93 | { |
||
| 94 | return; |
||
| 95 | } |
||
| 96 | |||
| 97 | public function validateProperty(string $propertyName) |
||
| 98 | { |
||
| 99 | return; |
||
| 100 | } |
||
| 101 | |||
| 102 | |||
| 103 | /** |
||
| 104 | * Adds a listener that wants to be notified about property changes. |
||
| 105 | * |
||
| 106 | * @param PropertyChangedListener $listener |
||
| 107 | * |
||
| 108 | * @return void |
||
| 109 | */ |
||
| 110 | public function addPropertyChangedListener(PropertyChangedListener $listener): void |
||
| 111 | { |
||
| 112 | return; |
||
| 113 | } |
||
| 114 | |||
| 115 | public function getGetters(): array |
||
| 116 | { |
||
| 117 | return []; |
||
| 118 | } |
||
| 119 | |||
| 120 | public function getSetters(): array |
||
| 121 | { |
||
| 122 | return []; |
||
| 123 | } |
||
| 124 | |||
| 125 | public function notifyEmbeddablePrefixedProperties( |
||
| 126 | string $embeddablePropertyName, |
||
| 127 | ?string $propName = null, |
||
| 128 | $oldValue = null, |
||
| 129 | $newValue = null |
||
| 130 | ): void { |
||
| 131 | return; |
||
| 132 | } |
||
| 133 | |||
| 134 | public function ensureMetaDataIsSet(EntityManagerInterface $entityManager): void |
||
| 135 | { |
||
| 136 | return; |
||
| 137 | } |
||
| 138 | }; |
||
| 139 | throw new ValidationException($this->errors, $this->entity); |
||
| 140 | } catch (ValidationException $e) { |
||
| 141 | $this->exception = $e; |
||
| 142 | } |
||
| 169 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.