Conditions | 1 |
Paths | 1 |
Total Lines | 51 |
Code Lines | 37 |
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 |
||
100 | public function testCommandHasCorrectParams() |
||
101 | { |
||
102 | $expectedArgumentCount = 2; |
||
103 | $expectedOptionCount = 2; |
||
104 | $expectedArgumentType = InputArgument::class; |
||
105 | $expectedOptionType = InputOption::class; |
||
106 | |||
107 | $commandDefinition = $this->command->getDefinition(); |
||
108 | |||
109 | $this->assertEquals($expectedArgumentCount, $commandDefinition->getArgumentCount()); |
||
110 | $this->assertInstanceOf( |
||
111 | $expectedArgumentType, |
||
112 | $commandDefinition->getArgument(GetModelDetailsCommand::MANUFACTURER_ARG_NAME) |
||
113 | ); |
||
114 | $this->assertInstanceOf( |
||
115 | $expectedArgumentType, |
||
116 | $commandDefinition->getArgument(GetModelDetailsCommand::MODEL_ARG_NAME) |
||
117 | ); |
||
118 | $this->assertEquals( |
||
119 | GetModelDetailsCommand::MANUFACTURER_ARG_DESC, |
||
120 | $commandDefinition->getArgument(GetModelDetailsCommand::MANUFACTURER_ARG_NAME)->getDescription() |
||
121 | ); |
||
122 | $this->assertEquals( |
||
123 | GetModelDetailsCommand::MODEL_ARG_DESC, |
||
124 | $commandDefinition->getArgument(GetModelDetailsCommand::MODEL_ARG_NAME)->getDescription() |
||
125 | ); |
||
126 | |||
127 | $this->assertEquals($expectedOptionCount, count($commandDefinition->getOptions())); |
||
128 | $this->assertInstanceOf( |
||
129 | $expectedOptionType, |
||
130 | $commandDefinition->getOption(GetModelDetailsCommand::FROM_YEAR_OPTION_NAME) |
||
131 | ); |
||
132 | $this->assertInstanceOf( |
||
133 | $expectedOptionType, |
||
134 | $commandDefinition->getOption(GetModelDetailsCommand::TO_YEAR_OPTION_NAME) |
||
135 | ); |
||
136 | $this->assertEquals( |
||
137 | GetModelDetailsCommand::FROM_YEAR_OPTION_DESC, |
||
138 | $commandDefinition->getOption(GetModelDetailsCommand::FROM_YEAR_OPTION_NAME)->getDescription() |
||
139 | ); |
||
140 | $this->assertEquals( |
||
141 | GetModelDetailsCommand::FROM_YEAR_OPTION_SHORTCUT, |
||
142 | $commandDefinition->getOption(GetModelDetailsCommand::FROM_YEAR_OPTION_NAME)->getShortcut() |
||
143 | ); |
||
144 | $this->assertEquals( |
||
145 | GetModelDetailsCommand::TO_YEAR_OPTION_DESC, |
||
146 | $commandDefinition->getOption(GetModelDetailsCommand::TO_YEAR_OPTION_NAME)->getDescription() |
||
147 | ); |
||
148 | $this->assertEquals( |
||
149 | GetModelDetailsCommand::TO_YEAR_OPTION_SHORTCUT, |
||
150 | $commandDefinition->getOption(GetModelDetailsCommand::TO_YEAR_OPTION_NAME)->getShortcut() |
||
151 | ); |
||
214 |
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.