Conditions | 4 |
Paths | 8 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
29 | protected function handlePolygonParams( array &$params, Polygon &$polygon ) { |
||
30 | if ( $fillColor = array_shift( $params ) ) { |
||
31 | $polygon->setFillColor( $fillColor ); |
||
32 | } |
||
33 | |||
34 | if ( $fillOpacity = array_shift( $params ) ) { |
||
35 | $polygon->setFillOpacity( $fillOpacity ); |
||
36 | } |
||
37 | |||
38 | if ( $showOnlyOnHover = array_shift( $params ) ) { |
||
39 | $polygon->setOnlyVisibleOnHover( strtolower( trim( $showOnlyOnHover ) ) === 'on' ); |
||
40 | } |
||
41 | } |
||
42 | |||
44 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.