From d53a5ac21ebdf645ddf683bd20996141b8b30334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Mu=CC=88ller?= Date: Wed, 25 Jan 2023 10:54:14 +0100 Subject: [PATCH] BUGFIX: Return values can be null, tests should work --- Classes/Domain/Model/Document.php | 19 +++++++++---------- Tests/Functional/Domain/DocumentTest.php | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Classes/Domain/Model/Document.php b/Classes/Domain/Model/Document.php index 0361f3a..0246b00 100644 --- a/Classes/Domain/Model/Document.php +++ b/Classes/Domain/Model/Document.php @@ -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; @@ -115,9 +115,9 @@ public function isDirty(): bool } /** - * @return int + * @return int|nulll */ - public function getVersion(): int + public function getVersion(): ?int { return $this->version; } @@ -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; } @@ -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 @@ -198,5 +198,4 @@ protected function setDirty(bool $dirty = true): void { $this->dirty = $dirty; } - } diff --git a/Tests/Functional/Domain/DocumentTest.php b/Tests/Functional/Domain/DocumentTest.php index e25c34b..9a3d1fc 100644 --- a/Tests/Functional/Domain/DocumentTest.php +++ b/Tests/Functional/Domain/DocumentTest.php @@ -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()); } /**