| Conditions | 1 |
| Paths | 1 |
| Total Lines | 96 |
| Code 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 |
||
| 45 | public function validatePasswordComplexityDataProvider() |
||
| 46 | { |
||
| 47 | return [ |
||
| 48 | 'no password given' => [ |
||
| 49 | '', |
||
| 50 | '', |
||
| 51 | true, |
||
| 52 | [] |
||
| 53 | ], |
||
| 54 | 'passwords not equal' => [ |
||
| 55 | 'password1', |
||
| 56 | 'password2', |
||
| 57 | true, |
||
| 58 | [] |
||
| 59 | ], |
||
| 60 | 'length below min length' => [ |
||
| 61 | 'password', |
||
| 62 | 'password', |
||
| 63 | true, |
||
| 64 | [ |
||
| 65 | 'passwordComplexity' => [ |
||
| 66 | 'minLength' => 9, |
||
| 67 | 'capitalCharCheck' => 0, |
||
| 68 | 'lowerCaseCharCheck' => 0, |
||
| 69 | 'digitCheck' => 0, |
||
| 70 | 'specialCharCheck' => 0, |
||
| 71 | ] |
||
| 72 | ] |
||
| 73 | ], |
||
| 74 | 'no capital char' => [ |
||
| 75 | 'password', |
||
| 76 | 'password', |
||
| 77 | true, |
||
| 78 | [ |
||
| 79 | 'passwordComplexity' => [ |
||
| 80 | 'minLength' => 7, |
||
| 81 | 'capitalCharCheck' => 1, |
||
| 82 | 'lowerCaseCharCheck' => 0, |
||
| 83 | 'digitCheck' => 0, |
||
| 84 | 'specialCharCheck' => 0, |
||
| 85 | ] |
||
| 86 | ] |
||
| 87 | ], |
||
| 88 | 'no lower case char' => [ |
||
| 89 | 'PASSWORD', |
||
| 90 | 'PASSWORD', |
||
| 91 | true, |
||
| 92 | [ |
||
| 93 | 'passwordComplexity' => [ |
||
| 94 | 'minLength' => 7, |
||
| 95 | 'capitalCharCheck' => 0, |
||
| 96 | 'lowerCaseCharCheck' => 1, |
||
| 97 | 'digitCheck' => 0, |
||
| 98 | 'specialCharCheck' => 0, |
||
| 99 | ] |
||
| 100 | ] |
||
| 101 | ], |
||
| 102 | 'no digit' => [ |
||
| 103 | 'password', |
||
| 104 | 'password', |
||
| 105 | true, |
||
| 106 | [ |
||
| 107 | 'passwordComplexity' => [ |
||
| 108 | 'minLength' => 7, |
||
| 109 | 'capitalCharCheck' => 0, |
||
| 110 | 'lowerCaseCharCheck' => 0, |
||
| 111 | 'digitCheck' => 1, |
||
| 112 | 'specialCharCheck' => 0, |
||
| 113 | ] |
||
| 114 | ] |
||
| 115 | ], |
||
| 116 | 'no special char' => [ |
||
| 117 | 'password', |
||
| 118 | 'password', |
||
| 119 | true, |
||
| 120 | [ |
||
| 121 | 'passwordComplexity' => [ |
||
| 122 | 'minLength' => 7, |
||
| 123 | 'capitalCharCheck' => 0, |
||
| 124 | 'lowerCaseCharCheck' => 0, |
||
| 125 | 'digitCheck' => 0, |
||
| 126 | 'specialCharCheck' => 1, |
||
| 127 | ] |
||
| 128 | ] |
||
| 129 | ], |
||
| 130 | 'strong password' => [ |
||
| 131 | 'Th!s_i$_a_$+r0ng_passw0rd#', |
||
| 132 | 'Th!s_i$_a_$+r0ng_passw0rd#', |
||
| 133 | false, |
||
| 134 | [ |
||
| 135 | 'passwordComplexity' => [ |
||
| 136 | 'minLength' => 20, |
||
| 137 | 'capitalCharCheck' => 1, |
||
| 138 | 'lowerCaseCharCheck' => 1, |
||
| 139 | 'digitCheck' => 1, |
||
| 140 | 'specialCharCheck' => 1, |
||
| 141 | ] |
||
| 244 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..