| Conditions | 4 |
| Paths | 5 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 53 | public function addAnnotation( DIProperty $property, SemanticData $semanticData ) { |
||
| 54 | |||
| 55 | if ( !$this->hasShortUrlUtils() ) { |
||
| 56 | throw new RuntimeException( 'Class ShortUrlUtils is not available' ); |
||
| 57 | } |
||
| 58 | |||
| 59 | $dataItem = null; |
||
| 60 | $title = $semanticData->getSubject()->getTitle(); |
||
| 61 | |||
| 62 | if ( \ShortUrlUtils::needsShortUrl( $title ) ) { |
||
| 63 | $dataItem = new DIUri( 'http', $this->getUrlPrefix() . \ShortUrlUtils::encodeTitle( $title ), '', '' ); |
||
| 64 | } |
||
| 65 | |||
| 66 | if ( $dataItem instanceof DataItem ) { |
||
| 67 | $semanticData->addPropertyObjectValue( $property, $dataItem ); |
||
| 68 | } |
||
| 69 | } |
||
| 70 | |||
| 87 |
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: