Skip to content

Commit

Permalink
Merge pull request #108 from Flowpack/bugfix/wrong-return-values-in-d…
Browse files Browse the repository at this point in the history
…ocument

BUGFIX: Return values can be null, tests should work
  • Loading branch information
kitsunet authored Jan 25, 2023
2 parents 28237c7 + d53a5ac commit 9d4544b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
19 changes: 9 additions & 10 deletions Classes/Domain/Model/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ class Document
/**
* The actual data to store to the document
*
* @var array
* @var array|null
*/
protected $data;

/**
* The version that has been assigned to this document.
*
* @var int
* @var int|null
*/
protected $version;

/**
* @var string
* @var string|null
*/
protected $id;

Expand Down Expand Up @@ -115,9 +115,9 @@ public function isDirty(): bool
}

/**
* @return int
* @return int|nulll
*/
public function getVersion(): int
public function getVersion(): ?int
{
return $this->version;
}
Expand All @@ -144,9 +144,9 @@ public function setData(array $data): void
}

/**
* @return string
* @return string|null
*/
public function getId(): string
public function getId(): ?string
{
return $this->id;
}
Expand Down Expand Up @@ -178,9 +178,9 @@ public function getType(): AbstractType

/**
* @param string $method
* @param string $path
* @param string|null $path
* @param array $arguments
* @param string $content
* @param string|null $content
* @return Response
* @throws ElasticSearchException
* @throws \Neos\Flow\Http\Exception
Expand All @@ -198,5 +198,4 @@ protected function setDirty(bool $dirty = true): void
{
$this->dirty = $dirty;
}

}
2 changes: 1 addition & 1 deletion Tests/Functional/Domain/DocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function idOfFreshNewDocumentIsPopulatedAfterStoring(array $data = null)
$document = new Document(new TwitterType($this->testingIndex), $data);
static::assertNull($document->getId());
$document->store();
static::assertRegExp('/\w+/', $document->getId());
static::assertMatchesRegularExpression('/\w+/', $document->getId());
}

/**
Expand Down

0 comments on commit 9d4544b

Please sign in to comment.