Skip to content

Commit 9d4544b

Browse files
authored
Merge pull request #108 from Flowpack/bugfix/wrong-return-values-in-document
BUGFIX: Return values can be null, tests should work
2 parents 28237c7 + d53a5ac commit 9d4544b

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

Classes/Domain/Model/Document.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ class Document
2929
/**
3030
* The actual data to store to the document
3131
*
32-
* @var array
32+
* @var array|null
3333
*/
3434
protected $data;
3535

3636
/**
3737
* The version that has been assigned to this document.
3838
*
39-
* @var int
39+
* @var int|null
4040
*/
4141
protected $version;
4242

4343
/**
44-
* @var string
44+
* @var string|null
4545
*/
4646
protected $id;
4747

@@ -115,9 +115,9 @@ public function isDirty(): bool
115115
}
116116

117117
/**
118-
* @return int
118+
* @return int|nulll
119119
*/
120-
public function getVersion(): int
120+
public function getVersion(): ?int
121121
{
122122
return $this->version;
123123
}
@@ -144,9 +144,9 @@ public function setData(array $data): void
144144
}
145145

146146
/**
147-
* @return string
147+
* @return string|null
148148
*/
149-
public function getId(): string
149+
public function getId(): ?string
150150
{
151151
return $this->id;
152152
}
@@ -178,9 +178,9 @@ public function getType(): AbstractType
178178

179179
/**
180180
* @param string $method
181-
* @param string $path
181+
* @param string|null $path
182182
* @param array $arguments
183-
* @param string $content
183+
* @param string|null $content
184184
* @return Response
185185
* @throws ElasticSearchException
186186
* @throws \Neos\Flow\Http\Exception
@@ -198,5 +198,4 @@ protected function setDirty(bool $dirty = true): void
198198
{
199199
$this->dirty = $dirty;
200200
}
201-
202201
}

Tests/Functional/Domain/DocumentTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function idOfFreshNewDocumentIsPopulatedAfterStoring(array $data = null)
4242
$document = new Document(new TwitterType($this->testingIndex), $data);
4343
static::assertNull($document->getId());
4444
$document->store();
45-
static::assertRegExp('/\w+/', $document->getId());
45+
static::assertMatchesRegularExpression('/\w+/', $document->getId());
4646
}
4747

4848
/**

0 commit comments

Comments
 (0)