Conditions | 1 |
Paths | 1 |
Total Lines | 72 |
Code Lines | 43 |
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 |
||
69 | public function rules() |
||
70 | { |
||
71 | return [ |
||
72 | [ |
||
73 | [ |
||
74 | 'first_name', |
||
75 | 'login', |
||
76 | 'email', |
||
77 | 'password', |
||
78 | 'passwordRepeat', |
||
79 | ], |
||
80 | 'filter', |
||
81 | 'filter' => 'trim', |
||
82 | ], |
||
83 | [ |
||
84 | [ |
||
85 | 'first_name', |
||
86 | 'login', |
||
87 | 'email', |
||
88 | 'password', |
||
89 | 'passwordRepeat', |
||
90 | ], |
||
91 | 'required', |
||
92 | ], |
||
93 | [ |
||
94 | [ |
||
95 | 'first_name', |
||
96 | 'login' |
||
97 | ], |
||
98 | 'string', |
||
99 | 'min' => 2, |
||
100 | 'max' => 255, |
||
101 | ], |
||
102 | [ |
||
103 | [ |
||
104 | 'password', |
||
105 | 'passwordRepeat', |
||
106 | ], |
||
107 | 'string', |
||
108 | 'min' => 5, |
||
109 | 'max' => 255, |
||
110 | ], |
||
111 | [ |
||
112 | 'login', |
||
113 | 'unique', |
||
114 | 'targetClass' => User::class, |
||
115 | 'message' => 'This login already exists.', |
||
116 | ], |
||
117 | [ |
||
118 | 'email', |
||
119 | 'email', |
||
120 | ], |
||
121 | [ |
||
122 | 'email', |
||
123 | 'unique', |
||
124 | 'targetClass' => User::class, |
||
125 | 'message' => 'This email already exists.', |
||
126 | ], |
||
127 | [ |
||
128 | 'password', |
||
129 | 'compare', |
||
130 | 'compareAttribute' => 'passwordRepeat', |
||
131 | ], |
||
132 | [ |
||
133 | 'passwordRepeat', |
||
134 | 'compare', |
||
135 | 'compareAttribute' => 'password', |
||
136 | ], |
||
137 | [ |
||
138 | 'verifyCode', |
||
139 | 'captcha', |
||
140 | 'captchaAction' => 'site/captcha' |
||
141 | ], |
||
200 |
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..