|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Wikibase\Repo\ChangeOp; |
|
4
|
|
|
|
|
5
|
|
|
use ValueValidators\Result; |
|
6
|
|
|
use Wikibase\Repo\Validators\TermValidatorFactory; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Decorator on ChangeOpsResult for collecting and distinguishing a collection |
|
10
|
|
|
* of ChangeOpResult instances on entity fingerprint parts. |
|
11
|
|
|
* |
|
12
|
|
|
* @license GPL-2.0-or-later |
|
13
|
|
|
*/ |
|
14
|
|
|
class ChangeOpFingerprintResult extends ChangeOpsResult { |
|
15
|
|
|
|
|
16
|
|
|
/** @var ChangeOpsResult */ |
|
17
|
|
|
private $innerChangeOpsResult; |
|
18
|
|
|
|
|
19
|
|
|
/** @var TermValidatorFactory */ |
|
20
|
|
|
private $termValidatorFactory; |
|
21
|
|
|
|
|
22
|
|
|
public function __construct( ChangeOpsResult $changeOpsResult, TermValidatorFactory $termValidatorFactory ) { |
|
23
|
|
|
$this->innerChangeOpsResult = $changeOpsResult; |
|
24
|
|
|
$this->termValidatorFactory = $termValidatorFactory; |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
public function getChangeOpsResults() { |
|
28
|
|
|
return $this->innerChangeOpsResult->getChangeOpsResults(); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function getEntityId() { |
|
32
|
|
|
return $this->innerChangeOpsResult->getEntityId(); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function isEntityChanged() { |
|
36
|
|
|
return $this->innerChangeOpsResult->isEntityChanged(); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function validate(): Result { |
|
40
|
|
|
$result = $this->innerChangeOpsResult->validate(); |
|
41
|
|
|
|
|
42
|
|
|
$fingerprintUniquenessValidator = $this->termValidatorFactory->getFingerprintUniquenessValidator( |
|
43
|
|
|
$this->getEntityId()->getEntityType() |
|
44
|
|
|
); |
|
45
|
|
|
|
|
46
|
|
|
if ( $fingerprintUniquenessValidator !== null ) { |
|
47
|
|
|
$result = Result::merge( |
|
48
|
|
|
$result, |
|
|
|
|
|
|
49
|
|
|
$fingerprintUniquenessValidator->validate( $this ) |
|
|
|
|
|
|
50
|
|
|
); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
return $result; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
} |
|
57
|
|
|
|
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: