SemanticMediaWiki /
SemanticApprovedRevs
| 1 | <?php |
||
| 2 | |||
| 3 | namespace SMW\ApprovedRevs\PropertyAnnotators; |
||
| 4 | |||
| 5 | use SMW\DIProperty; |
||
| 6 | use SMW\SemanticData; |
||
| 7 | use SMW\DIWikiPage; |
||
| 8 | use SMW\ApprovedRevs\DatabaseLogReader; |
||
| 9 | use SMW\ApprovedRevs\PropertyRegistry; |
||
| 10 | use User; |
||
|
0 ignored issues
–
show
|
|||
| 11 | use Title; |
||
|
0 ignored issues
–
show
The type
Title was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 12 | |||
| 13 | /** |
||
| 14 | * @private |
||
| 15 | * |
||
| 16 | * @license GNU GPL v2+ |
||
| 17 | */ |
||
| 18 | class ApprovedByPropertyAnnotator { |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var DatabaseLogReader |
||
| 22 | */ |
||
| 23 | private $databaseLogReader; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var Integer|null |
||
| 27 | */ |
||
| 28 | private $approvedBy; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param DatabaseLogReader $databaseLogReader |
||
| 32 | */ |
||
| 33 | 3 | public function __construct( DatabaseLogReader $databaseLogReader ) { |
|
| 34 | 3 | $this->databaseLogReader = $databaseLogReader; |
|
| 35 | 3 | } |
|
| 36 | |||
| 37 | /** |
||
| 38 | * @since 1.0 |
||
| 39 | * |
||
| 40 | * @param string $approvedBy |
||
| 41 | */ |
||
| 42 | 2 | public function setApprovedBy( $approvedBy ) { |
|
| 43 | 2 | $this->approvedBy = $approvedBy; |
|
|
0 ignored issues
–
show
It seems like
$approvedBy of type string is incompatible with the declared type integer|null of property $approvedBy.
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...
|
|||
| 44 | 2 | } |
|
| 45 | |||
| 46 | /** |
||
| 47 | * @since 1.0 |
||
| 48 | * |
||
| 49 | * @return DIProperty |
||
| 50 | */ |
||
| 51 | 2 | public function newDIProperty() { |
|
| 52 | 2 | return new DIProperty( PropertyRegistry::SAR_PROP_APPROVED_BY ); |
|
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @since 1.0 |
||
| 57 | * |
||
| 58 | * @param SemanticData $semanticData |
||
| 59 | */ |
||
| 60 | 2 | public function addAnnotation( SemanticData $semanticData ) { |
|
| 61 | |||
| 62 | 2 | if ( $this->approvedBy === null ) { |
|
| 63 | $this->approvedBy = $this->databaseLogReader->getUserForLogEntry( |
||
|
0 ignored issues
–
show
It seems like
$this->databaseLogReader...getTitle(), 'approval') of type User is incompatible with the declared type integer|null of property $approvedBy.
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...
|
|||
| 64 | $semanticData->getSubject()->getTitle(), |
||
| 65 | 'approval' |
||
| 66 | ); |
||
| 67 | } |
||
| 68 | |||
| 69 | 2 | $property = $this->newDIProperty(); |
|
| 70 | 2 | $dataItem = $this->newDIWikiPage(); |
|
| 71 | 2 | $semanticData->removeProperty( $property ); |
|
| 72 | |||
| 73 | 2 | if ( $dataItem ) { |
|
| 74 | 1 | $semanticData->addPropertyObjectValue( $property, $dataItem ); |
|
| 75 | } |
||
| 76 | 2 | } |
|
| 77 | |||
| 78 | 2 | private function newDIWikiPage() { |
|
| 79 | |||
| 80 | 2 | if ( !$this->approvedBy instanceof User ) { |
|
| 81 | 1 | return; |
|
| 82 | } |
||
| 83 | |||
| 84 | 1 | $userPage = $this->approvedBy->getUserPage(); |
|
| 85 | |||
| 86 | 1 | if ( $userPage instanceof Title ) { |
|
| 87 | 1 | return DIWikiPage::newFromTitle( $userPage ); |
|
| 88 | } |
||
| 89 | } |
||
| 90 | |||
| 91 | } |
||
| 92 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths