| Conditions | 1 |
| Paths | 1 |
| Total Lines | 114 |
| 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 |
||
| 88 | public function expectedMethods() : array |
||
| 89 | { |
||
| 90 | return [ |
||
| 91 | [ |
||
| 92 | new ReflectionClass(BaseClass::class), |
||
| 93 | null, |
||
| 94 | [ |
||
| 95 | 'privatePropertyGetter', |
||
| 96 | 'protectedPropertyGetter', |
||
| 97 | 'publicArrayHintedMethod', |
||
| 98 | 'publicByReferenceMethod', |
||
| 99 | 'publicByReferenceParameterMethod', |
||
| 100 | 'publicMethod', |
||
| 101 | 'publicPropertyGetter', |
||
| 102 | 'publicTypeHintedMethod', |
||
| 103 | ], |
||
| 104 | ], |
||
| 105 | [ |
||
| 106 | new ReflectionClass(EmptyClass::class), |
||
| 107 | null, |
||
| 108 | [], |
||
| 109 | ], |
||
| 110 | [ |
||
| 111 | new ReflectionClass(LazyLoadingMock::class), |
||
| 112 | null, |
||
| 113 | [ |
||
| 114 | 'getProxyInitializer', |
||
| 115 | 'getWrappedValueHolderValue', |
||
| 116 | 'initializeProxy', |
||
| 117 | 'isProxyInitialized', |
||
| 118 | 'setProxyInitializer', |
||
| 119 | ], |
||
| 120 | ], |
||
| 121 | [ |
||
| 122 | new ReflectionClass(LazyLoadingMock::class), |
||
| 123 | [], |
||
| 124 | [ |
||
| 125 | 'getProxyInitializer', |
||
| 126 | 'getWrappedValueHolderValue', |
||
| 127 | 'initializeProxy', |
||
| 128 | 'isProxyInitialized', |
||
| 129 | 'setProxyInitializer', |
||
| 130 | ], |
||
| 131 | ], |
||
| 132 | [ |
||
| 133 | new ReflectionClass(HydratedObject::class), |
||
| 134 | ['doFoo'], |
||
| 135 | ['__get'], |
||
| 136 | ], |
||
| 137 | [ |
||
| 138 | new ReflectionClass(HydratedObject::class), |
||
| 139 | ['Dofoo'], |
||
| 140 | ['__get'], |
||
| 141 | ], |
||
| 142 | [ |
||
| 143 | new ReflectionClass(HydratedObject::class), |
||
| 144 | [], |
||
| 145 | ['doFoo', '__get'], |
||
| 146 | ], |
||
| 147 | [ |
||
| 148 | new ReflectionClass(ClassWithAbstractProtectedMethod::class), |
||
| 149 | null, |
||
| 150 | [], |
||
| 151 | ], |
||
| 152 | [ |
||
| 153 | new ReflectionClass(ClassWithAbstractPublicMethod::class), |
||
| 154 | null, |
||
| 155 | ['publicAbstractMethod'], |
||
| 156 | ], |
||
| 157 | [ |
||
| 158 | new ReflectionClass(ClassWithAbstractPublicMethod::class), |
||
| 159 | ['publicAbstractMethod'], |
||
| 160 | [], |
||
| 161 | ], |
||
| 162 | [ |
||
| 163 | new ReflectionClass(ClassWithAbstractMagicMethods::class), |
||
| 164 | null, |
||
| 165 | [], |
||
| 166 | ], |
||
| 167 | [ |
||
| 168 | new ReflectionClass(ClassWithAbstractMagicMethods::class), |
||
| 169 | [], |
||
| 170 | [ |
||
| 171 | '__clone', |
||
| 172 | '__get', |
||
| 173 | '__isset', |
||
| 174 | '__set', |
||
| 175 | '__sleep', |
||
| 176 | '__unset', |
||
| 177 | '__wakeup', |
||
| 178 | ], |
||
| 179 | ], |
||
| 180 | [ |
||
| 181 | new ReflectionClass(ClassWithMethodWithVariadicFunction::class), |
||
| 182 | null, |
||
| 183 | ['foo', 'buz'], |
||
| 184 | ], |
||
| 185 | [ |
||
| 186 | new ReflectionClass(ClassWithMethodWithByRefVariadicFunction::class), |
||
| 187 | null, |
||
| 188 | ['tuz'], |
||
| 189 | ], |
||
| 190 | 'final magic methods' => [ |
||
| 191 | new ReflectionClass(ClassWithFinalMagicMethods::class), |
||
| 192 | null, |
||
| 193 | [], |
||
| 194 | ], |
||
| 195 | 'non-final constructor is to be skipped' => [ |
||
| 196 | new ReflectionClass(ClassWithCounterConstructor::class), |
||
| 197 | null, |
||
| 198 | ['getAmount'], |
||
| 199 | ], |
||
| 200 | ]; |
||
| 201 | } |
||
| 202 | |||
| 262 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.