Conditions | 1 |
Paths | 1 |
Total Lines | 57 |
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 |
||
123 | protected function bootGrammar(): GrammarInterface |
||
124 | { |
||
125 | return new Grammar([ |
||
126 | new Concatenation(0, ['DocBlock'], 'Document'), |
||
127 | new Concatenation(1, ['__any'], 'Document'), |
||
128 | new Alternation(2, [0, 1], null), |
||
129 | (new Repetition('Document', 0, -1, 2, null))->setDefaultId('Document'), |
||
130 | new Terminal(4, 'T_WORD', false), |
||
131 | new Terminal(5, 'T_DOC_DEFINITION', false), |
||
132 | new Terminal(6, 'T_VARIABLE', false), |
||
133 | new Terminal(7, 'T_SUFFIX_ARRAY', false), |
||
134 | new Terminal(8, 'T_NAMESPACE', false), |
||
135 | new Terminal(9, 'T_AND', false), |
||
136 | new Terminal(10, 'T_OR', false), |
||
137 | new Terminal(11, 'T_ANGLE_LEFT', false), |
||
138 | new Terminal(12, 'T_ANGLE_RIGHT', false), |
||
139 | new Terminal(13, 'T_COMMA', false), |
||
140 | new Alternation('__any', [4, 5, 6, 7, 8, 9, 10, 11, 12, 13], null), |
||
141 | new Concatenation(15, ['DocBlockVariable'], null), |
||
142 | (new Concatenation('DocBlock', ['DocBlockTitle', 'TypeHint', 15], 'DocBlock'))->setDefaultId('DocBlock'), |
||
143 | new Terminal(17, 'T_DOC_DEFINITION', true), |
||
144 | (new Concatenation('DocBlockTitle', [17], 'DocBlockTitle'))->setDefaultId('DocBlockTitle'), |
||
145 | new Terminal(19, 'T_VARIABLE', true), |
||
146 | (new Concatenation('DocBlockVariable', [19], 'DocBlockVariable'))->setDefaultId('DocBlockVariable'), |
||
147 | new Concatenation(21, ['__arrayTypeHint'], 'TypeHint'), |
||
148 | new Concatenation(22, ['__genericTypeHint'], 'TypeHint'), |
||
149 | new Concatenation(23, ['__scalarTypeHint'], 'TypeHint'), |
||
150 | new Alternation(24, [21, 22, 23], null), |
||
151 | new Repetition(25, 0, 1, '__typeHintContinuation', null), |
||
152 | (new Concatenation('TypeHint', [24, 25], null))->setDefaultId('TypeHint'), |
||
153 | new Concatenation(27, ['__typeHintDisjunction'], null), |
||
154 | new Alternation('__typeHintContinuation', ['__typeHintConjunction', 27], null), |
||
155 | new Terminal(29, 'T_OR', false), |
||
156 | new Concatenation('__typeHintDisjunction', [29, 'TypeHint'], 'Disjunction'), |
||
157 | new Terminal(31, 'T_AND', false), |
||
158 | new Concatenation('__typeHintConjunction', [31, 'TypeHint'], 'Conjunction'), |
||
159 | new Terminal(33, 'T_SUFFIX_ARRAY', false), |
||
160 | new Concatenation('__arrayTypeHint', ['__typeDefinition', 33], 'Array'), |
||
161 | new Terminal(35, 'T_ANGLE_LEFT', false), |
||
162 | new Repetition(36, 0, 1, '__genericArguments', null), |
||
163 | new Terminal(37, 'T_ANGLE_RIGHT', false), |
||
164 | new Concatenation('__genericTypeHint', ['__typeDefinition', 35, 36, 37], 'Generic'), |
||
165 | new Terminal(39, 'T_COMMA', false), |
||
166 | new Concatenation(40, [39, '__scalarTypeHint'], null), |
||
167 | new Repetition(41, 0, 1, 40, null), |
||
168 | new Concatenation('__genericArguments', ['__scalarTypeHint', 41], 'GenericArguments'), |
||
169 | new Concatenation('__scalarTypeHint', ['__typeDefinition'], 'Scalar'), |
||
170 | new Terminal(44, 'T_NAMESPACE', false), |
||
171 | new Repetition(45, 0, 1, 44, null), |
||
172 | new Terminal(46, 'T_WORD', true), |
||
173 | new Terminal(47, 'T_NAMESPACE', false), |
||
174 | new Terminal(48, 'T_WORD', true), |
||
175 | new Concatenation(49, [47, 48], null), |
||
176 | new Repetition(50, 0, -1, 49, null), |
||
177 | new Concatenation('__typeDefinition', [45, 46, 50], 'Type') |
||
178 | ], static::PARSER_ROOT_RULE, static::PARSER_DELEGATES); |
||
179 | } |
||
180 | } |
||
181 |