| Conditions | 1 |
| Paths | 1 |
| Total Lines | 69 |
| 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 |
||
| 101 | public function getIsGrantedTests(): array |
||
| 102 | { |
||
| 103 | return [ |
||
| 104 | //empty |
||
| 105 | [false, [''], 'foo.bar', ''], |
||
| 106 | [false, [''], 'foo.bar', ['']], |
||
| 107 | [false, [''], 'foo.bar.abc', ['']], |
||
| 108 | [false, [''], 'foo.bar.def', ['']], |
||
| 109 | [false, [''], 'foo.bar.baz.xyz', ''], |
||
| 110 | [false, [''], 'foo.bar.baz.xyz', ['']], |
||
| 111 | |||
| 112 | //superadmins |
||
| 113 | [true, ['ROLE_BATMAN', 'ROLE_IRONMAN'], 'foo.bar', 'BAZ'], |
||
| 114 | [true, ['ROLE_BATMAN', 'ROLE_IRONMAN'], 'foo.bar', 'ANYTHING'], |
||
| 115 | [true, ['ROLE_BATMAN', 'ROLE_IRONMAN'], 'foo.bar', ['BAZ', 'ANYTHING']], |
||
| 116 | [true, ['ROLE_IRONMAN'], 'foo.bar', 'BAZ'], |
||
| 117 | [true, ['ROLE_IRONMAN'], 'foo.bar', 'ANYTHING'], |
||
| 118 | [true, ['ROLE_IRONMAN'], 'foo.bar.baz.xyz', 'ANYTHING'], |
||
| 119 | [true, ['ROLE_IRONMAN'], 'foo.bar', ''], |
||
| 120 | [true, ['ROLE_IRONMAN'], 'foo.bar', ['']], |
||
| 121 | |||
| 122 | //operations |
||
| 123 | [true, ['ROLE_SPIDERMAN'], 'foo.bar', 'ABC'], |
||
| 124 | [true, ['ROLE_SPIDERMAN'], 'foo.bar', ['ABC']], |
||
| 125 | [true, ['ROLE_SPIDERMAN'], 'foo.bar', ['ABC', 'DEF']], |
||
| 126 | [true, ['ROLE_SPIDERMAN'], 'foo.bar', ['BAZ', 'ABC']], |
||
| 127 | [false, ['ROLE_SPIDERMAN'], 'foo.bar', 'DEF'], |
||
| 128 | [false, ['ROLE_SPIDERMAN'], 'foo.bar', ['DEF']], |
||
| 129 | [false, ['ROLE_SPIDERMAN'], 'foo.bar', 'BAZ'], |
||
| 130 | [false, ['ROLE_SPIDERMAN'], 'foo.bar', ['BAZ']], |
||
| 131 | [true, [], 'foo.bar', 'ABC'], |
||
| 132 | [true, [], 'foo.bar', ['ABC']], |
||
| 133 | [false, [], 'foo.bar', 'DEF'], |
||
| 134 | [false, [], 'foo.bar', ['DEF']], |
||
| 135 | [false, [], 'foo.bar', 'BAZ'], |
||
| 136 | [false, [], 'foo.bar', ['BAZ']], |
||
| 137 | [false, [], 'foo.bar.baz.xyz', 'ABC'], |
||
| 138 | [false, [], 'foo.bar.baz.xyz', ['ABC']], |
||
| 139 | [false, [], 'foo.bar.baz.xyz', ['ABC', 'DEF']], |
||
| 140 | [false, [], 'foo.bar.baz.xyz', 'DEF'], |
||
| 141 | [false, [], 'foo.bar.baz.xyz', ['DEF']], |
||
| 142 | [false, [], 'foo.bar.baz.xyz', 'BAZ'], |
||
| 143 | [false, [], 'foo.bar.baz.xyz', ['BAZ']], |
||
| 144 | |||
| 145 | //objects |
||
| 146 | [true, ['ROLE_SPIDERMAN'], 'foo.bar', ['DEF'], new \stdClass()], |
||
| 147 | [true, ['ROLE_SPIDERMAN'], 'foo.bar', ['ABC'], new \stdClass()], |
||
| 148 | [true, ['ROLE_SPIDERMAN'], 'foo.bar', ['ABC', 'DEF'], new \stdClass()], |
||
| 149 | [true, ['ROLE_SPIDERMAN'], 'foo.bar', ['BAZ', 'DEF'], new \stdClass()], |
||
| 150 | [true, ['ROLE_SPIDERMAN'], 'foo.bar', 'DEF', new \stdClass()], |
||
| 151 | [true, ['ROLE_SPIDERMAN'], 'foo.bar', 'ABC', new \stdClass()], |
||
| 152 | [false, ['ROLE_SPIDERMAN'], 'foo.bar', 'BAZ', new \stdClass()], |
||
| 153 | [false, ['ROLE_SPIDERMAN'], 'foo.bar.baz.xyz', 'DEF', new \stdClass()], |
||
| 154 | [false, ['ROLE_SPIDERMAN'], 'foo.bar.baz.xyz', 'ABC', new \stdClass()], |
||
| 155 | [true, [], 'foo.bar', ['ABC'], new \stdClass()], |
||
| 156 | [true, [], 'foo.bar', 'ABC', new \stdClass()], |
||
| 157 | [true, [], 'foo.bar', ['DEF'], new \stdClass()], |
||
| 158 | [true, [], 'foo.bar', 'DEF', new \stdClass()], |
||
| 159 | [false, [], 'foo.bar', ['BAZ'], new \stdClass()], |
||
| 160 | [false, [], 'foo.bar', 'BAZ', new \stdClass()], |
||
| 161 | [false, [], 'foo.bar.baz.xyz', 'BAZ', new \stdClass()], |
||
| 162 | [false, [], 'foo.bar.baz.xyz', ['BAZ'], new \stdClass()], |
||
| 163 | [false, ['ROLE_AUTH_EXCEPTION'], 'foo.bar.baz.xyz', ['BAZ'], new \stdClass()], |
||
| 164 | |||
| 165 | // ALL role |
||
| 166 | [true, [], 'foo.bar.baz', 'LIST'], |
||
| 167 | [true, [], 'foo.bar.baz', ['LIST', 'EDIT']], |
||
| 168 | ]; |
||
| 169 | } |
||
| 170 | |||
| 224 |
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.