| Conditions | 18 | 
| Paths | 82 | 
| Total Lines | 71 | 
| 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  | 
            ||
| 141 | public function evaluateUsingStack(ScriptInterface $script, array $path)  | 
            ||
| 142 |     { | 
            ||
| 143 | $mainStack = new Stack();  | 
            ||
| 144 |         foreach (array_reverse($path) as $setting) { | 
            ||
| 145 | $mainStack->push($setting);  | 
            ||
| 146 | }  | 
            ||
| 147 | |||
| 148 | $vfStack = new Stack();  | 
            ||
| 149 | $parser = $script->getScriptParser();  | 
            ||
| 150 | $tracer = new PathTracer();  | 
            ||
| 151 | |||
| 152 |         foreach ($parser as $i => $operation) { | 
            ||
| 153 | $opCode = $operation->getOp();  | 
            ||
| 154 | $fExec = !$this->checkExec($vfStack, false);  | 
            ||
| 155 | |||
| 156 |             if (in_array($opCode, $this->disabledOps, true)) { | 
            ||
| 157 |                 throw new \RuntimeException('Disabled Opcode'); | 
            ||
| 158 | }  | 
            ||
| 159 | |||
| 160 |             if (Opcodes::OP_IF <= $opCode && $opCode <= Opcodes::OP_ENDIF) { | 
            ||
| 161 |                 switch ($opCode) { | 
            ||
| 162 | case Opcodes::OP_IF:  | 
            ||
| 163 | case Opcodes::OP_NOTIF:  | 
            ||
| 164 | // <expression> if [statements] [else [statements]] endif  | 
            ||
| 165 | $value = false;  | 
            ||
| 166 |                         if ($fExec) { | 
            ||
| 167 |                             if ($mainStack->isEmpty()) { | 
            ||
| 168 |                                 throw new \RuntimeException('Unbalanced conditional'); | 
            ||
| 169 | }  | 
            ||
| 170 | |||
| 171 | $value = $mainStack->pop();  | 
            ||
| 172 |                             if ($opCode === Opcodes::OP_NOTIF) { | 
            ||
| 173 | $value = !$value;  | 
            ||
| 174 | }  | 
            ||
| 175 | }  | 
            ||
| 176 | $vfStack->push($value);  | 
            ||
| 177 | break;  | 
            ||
| 178 | |||
| 179 | case Opcodes::OP_ELSE:  | 
            ||
| 180 |                         if ($vfStack->isEmpty()) { | 
            ||
| 181 |                             throw new \RuntimeException('Unbalanced conditional'); | 
            ||
| 182 | }  | 
            ||
| 183 | $vfStack->push(!$vfStack->pop());  | 
            ||
| 184 | break;  | 
            ||
| 185 | |||
| 186 | case Opcodes::OP_ENDIF:  | 
            ||
| 187 |                         if ($vfStack->isEmpty()) { | 
            ||
| 188 |                             throw new \RuntimeException('Unbalanced conditional'); | 
            ||
| 189 | }  | 
            ||
| 190 | $vfStack->pop();  | 
            ||
| 191 | |||
| 192 | break;  | 
            ||
| 193 | }  | 
            ||
| 194 | |||
| 195 | $tracer->operation($operation);  | 
            ||
| 196 |             } else if ($fExec) { | 
            ||
| 197 | // Fill up trace with executed opcodes  | 
            ||
| 198 | $tracer->operation($operation);  | 
            ||
| 199 | }  | 
            ||
| 200 | }  | 
            ||
| 201 | |||
| 202 |         if (count($vfStack) !== 0) { | 
            ||
| 203 |             throw new \RuntimeException('Unbalanced conditional at script end'); | 
            ||
| 204 | }  | 
            ||
| 205 | |||
| 206 |         if (count($mainStack) !== 0) { | 
            ||
| 207 |             throw new \RuntimeException('Values remaining after script execution - invalid branch data'); | 
            ||
| 208 | }  | 
            ||
| 209 | |||
| 210 | return $tracer->done();  | 
            ||
| 211 | }  | 
            ||
| 212 | }  | 
            ||
| 213 | 
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: