SemanticMediaWiki /
SemanticApprovedRevs
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace SMW\ApprovedRevs\PropertyAnnotators; |
||
| 4 | |||
| 5 | use SMW\DIProperty; |
||
| 6 | use SMW\SemanticData; |
||
| 7 | use SMWDIBlob as DIBlob; |
||
| 8 | use SMW\ApprovedRevs\DatabaseLogReader; |
||
| 9 | use SMW\ApprovedRevs\PropertyRegistry; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @private |
||
| 13 | * |
||
| 14 | * @license GNU GPL v2+ |
||
| 15 | */ |
||
| 16 | class ApprovedStatusPropertyAnnotator { |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var DatabaseLogReader |
||
| 20 | */ |
||
| 21 | private $databaseLogReader; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var Integer|null |
||
| 25 | */ |
||
| 26 | private $approvedStatus; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param DatabaseLogReader $databaseLogReader |
||
| 30 | */ |
||
| 31 | 3 | public function __construct( DatabaseLogReader $databaseLogReader ) { |
|
| 32 | 3 | $this->databaseLogReader = $databaseLogReader; |
|
| 33 | 3 | } |
|
| 34 | |||
| 35 | /** |
||
| 36 | * @since 1.0 |
||
| 37 | * |
||
| 38 | * @param string $approvedStatus |
||
| 39 | */ |
||
| 40 | 2 | public function setApprovedStatus( $approvedStatus ) { |
|
| 41 | 2 | $this->approvedStatus = $approvedStatus; |
|
|
0 ignored issues
–
show
|
|||
| 42 | 2 | } |
|
| 43 | |||
| 44 | /** |
||
| 45 | * @since 1.0 |
||
| 46 | * |
||
| 47 | * @return DIProperty |
||
| 48 | */ |
||
| 49 | 2 | public function newDIProperty() { |
|
| 50 | 2 | return new DIProperty( PropertyRegistry::SAR_PROP_APPROVED_STATUS ); |
|
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @since 1.0 |
||
| 55 | * |
||
| 56 | * @param SemanticData $semanticData |
||
| 57 | */ |
||
| 58 | 2 | public function addAnnotation( SemanticData $semanticData ) { |
|
| 59 | |||
| 60 | 2 | if ( $this->approvedStatus === null ) { |
|
| 61 | $this->approvedStatus = $this->databaseLogReader->getStatusOfLogEntry( |
||
|
0 ignored issues
–
show
It seems like
$this->databaseLogReader...getTitle(), 'approval') of type string is incompatible with the declared type integer|null of property $approvedStatus.
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. Loading history...
|
|||
| 62 | $semanticData->getSubject()->getTitle(), |
||
| 63 | 'approval' |
||
| 64 | ); |
||
| 65 | } |
||
| 66 | |||
| 67 | 2 | $property = $this->newDIProperty(); |
|
| 68 | 2 | $semanticData->removeProperty( $property ); |
|
| 69 | |||
| 70 | 2 | if ( is_string( $this->approvedStatus ) && $this->approvedStatus !== '' ) { |
|
| 71 | 1 | $semanticData->addPropertyObjectValue( |
|
| 72 | 1 | $property, |
|
| 73 | 1 | new DIBlob( $this->approvedStatus ) |
|
| 74 | ); |
||
| 75 | } |
||
| 76 | 2 | } |
|
| 77 | |||
| 78 | } |
||
| 79 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..