public function testGivenInvalidGuid_getFirstStatementWithGuidReturnsNull() { $statements = new StatementList(); $this->assertNull($statements->getFirstStatementWithGuid(false)); }
/** * @param StatementList $statements * @param Summary|null $summary * * @throws ChangeOpException */ private function setStatement(StatementList $statements, Summary $summary = null) { $statement = $statements->getFirstStatementWithGuid($this->statementGuid); if ($statement === null) { throw new ChangeOpException("Entity does not have a statement with GUID " . $this->statementGuid); } $propertyId = $statement->getMainSnak()->getPropertyId(); if (!$propertyId->equals($this->snak->getPropertyId())) { throw new ChangeOpException("Claim with GUID " . $this->statementGuid . " uses property " . $propertyId . ", can't change to " . $this->snak->getPropertyId()); } $statement->setMainSnak($this->snak); $this->updateSummary($summary, null, '', $this->getClaimSummaryArgs($this->snak)); }