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 |
||
46 | public function validatePasswordComplexityDataProvider() |
||
47 | { |
||
48 | return [ |
||
49 | 'no password given' => [ |
||
50 | '', |
||
51 | '', |
||
52 | true, |
||
53 | [], |
||
54 | ], |
||
55 | 'passwords not equal' => [ |
||
56 | 'password1', |
||
57 | 'password2', |
||
58 | true, |
||
59 | [], |
||
60 | ], |
||
61 | 'length below min length' => [ |
||
62 | 'password', |
||
63 | 'password', |
||
64 | true, |
||
65 | [ |
||
66 | 'passwordComplexity' => [ |
||
67 | 'minLength' => 9, |
||
68 | 'capitalCharCheck' => 0, |
||
69 | 'lowerCaseCharCheck' => 0, |
||
70 | 'digitCheck' => 0, |
||
71 | 'specialCharCheck' => 0, |
||
72 | ], |
||
73 | ], |
||
74 | ], |
||
75 | 'no capital char' => [ |
||
76 | 'password', |
||
77 | 'password', |
||
78 | true, |
||
79 | [ |
||
80 | 'passwordComplexity' => [ |
||
81 | 'minLength' => 7, |
||
82 | 'capitalCharCheck' => 1, |
||
83 | 'lowerCaseCharCheck' => 0, |
||
84 | 'digitCheck' => 0, |
||
85 | 'specialCharCheck' => 0, |
||
86 | ], |
||
87 | ], |
||
88 | ], |
||
89 | 'no lower case char' => [ |
||
90 | 'PASSWORD', |
||
91 | 'PASSWORD', |
||
92 | true, |
||
93 | [ |
||
94 | 'passwordComplexity' => [ |
||
95 | 'minLength' => 7, |
||
96 | 'capitalCharCheck' => 0, |
||
97 | 'lowerCaseCharCheck' => 1, |
||
98 | 'digitCheck' => 0, |
||
99 | 'specialCharCheck' => 0, |
||
100 | ], |
||
101 | ], |
||
102 | ], |
||
103 | 'no digit' => [ |
||
104 | 'password', |
||
105 | 'password', |
||
106 | true, |
||
107 | [ |
||
108 | 'passwordComplexity' => [ |
||
109 | 'minLength' => 7, |
||
110 | 'capitalCharCheck' => 0, |
||
111 | 'lowerCaseCharCheck' => 0, |
||
112 | 'digitCheck' => 1, |
||
113 | 'specialCharCheck' => 0, |
||
114 | ], |
||
115 | ], |
||
116 | ], |
||
117 | 'no special char' => [ |
||
118 | 'password', |
||
119 | 'password', |
||
120 | true, |
||
121 | [ |
||
122 | 'passwordComplexity' => [ |
||
123 | 'minLength' => 7, |
||
124 | 'capitalCharCheck' => 0, |
||
125 | 'lowerCaseCharCheck' => 0, |
||
126 | 'digitCheck' => 0, |
||
127 | 'specialCharCheck' => 1, |
||
128 | ], |
||
129 | ], |
||
130 | ], |
||
131 | 'strong password' => [ |
||
132 | 'Th!s_i$_a_$+r0ng_passw0rd#', |
||
133 | 'Th!s_i$_a_$+r0ng_passw0rd#', |
||
134 | false, |
||
135 | [ |
||
136 | 'passwordComplexity' => [ |
||
137 | 'minLength' => 20, |
||
138 | 'capitalCharCheck' => 1, |
||
139 | 'lowerCaseCharCheck' => 1, |
||
140 | 'digitCheck' => 1, |
||
141 | 'specialCharCheck' => 1, |
||
142 | ], |
||
276 |
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..