Skip to content

Commit 0c89cfe

Browse files
committed
IBX-8534: Dropped deprecated context and getIndexData from Storage
phpstan fix
1 parent 1418e73 commit 0c89cfe

File tree

3 files changed

+7
-57
lines changed

3 files changed

+7
-57
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -415,11 +415,6 @@ parameters:
415415
count: 1
416416
path: src/lib/FieldType/RichText/RichTextStorage.php
417417

418-
-
419-
message: "#^Method Ibexa\\\\FieldTypeRichText\\\\FieldType\\\\RichText\\\\RichTextStorage\\:\\:deleteFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#"
420-
count: 1
421-
path: src/lib/FieldType/RichText/RichTextStorage.php
422-
423418
-
424419
message: "#^Method Ibexa\\\\FieldTypeRichText\\\\FieldType\\\\RichText\\\\RichTextStorage\\:\\:deleteFieldData\\(\\) has parameter \\$fieldIds with no value type specified in iterable type array\\.$#"
425420
count: 1
@@ -435,26 +430,6 @@ parameters:
435430
count: 1
436431
path: src/lib/FieldType/RichText/RichTextStorage.php
437432

438-
-
439-
message: "#^Method Ibexa\\\\FieldTypeRichText\\\\FieldType\\\\RichText\\\\RichTextStorage\\:\\:getFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#"
440-
count: 1
441-
path: src/lib/FieldType/RichText/RichTextStorage.php
442-
443-
-
444-
message: "#^Method Ibexa\\\\FieldTypeRichText\\\\FieldType\\\\RichText\\\\RichTextStorage\\:\\:getIndexData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#"
445-
count: 1
446-
path: src/lib/FieldType/RichText/RichTextStorage.php
447-
448-
-
449-
message: "#^Method Ibexa\\\\FieldTypeRichText\\\\FieldType\\\\RichText\\\\RichTextStorage\\:\\:getIndexData\\(\\) should return array\\<Ibexa\\\\Contracts\\\\Core\\\\Search\\\\Field\\> but return statement is missing\\.$#"
450-
count: 1
451-
path: src/lib/FieldType/RichText/RichTextStorage.php
452-
453-
-
454-
message: "#^Method Ibexa\\\\FieldTypeRichText\\\\FieldType\\\\RichText\\\\RichTextStorage\\:\\:storeFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#"
455-
count: 1
456-
path: src/lib/FieldType/RichText/RichTextStorage.php
457-
458433
-
459434
message: "#^Offset 1 does not exist on array\\{0\\?\\: string, 1\\?\\: ''\\|'ezremote\\://', 2\\?\\: string, 3\\?\\: string\\}\\.$#"
460435
count: 1
@@ -1705,11 +1680,6 @@ parameters:
17051680
count: 1
17061681
path: tests/lib/FieldType/RichText/Gateway/DoctrineStorageTest.php
17071682

1708-
-
1709-
message: "#^Method Ibexa\\\\Tests\\\\FieldTypeRichText\\\\FieldType\\\\RichText\\\\RichTextStorageTest\\:\\:getContext\\(\\) return type has no value type specified in iterable type array\\.$#"
1710-
count: 1
1711-
path: tests/lib/FieldType/RichText/RichTextStorageTest.php
1712-
17131683
-
17141684
message: "#^Method Ibexa\\\\Tests\\\\FieldTypeRichText\\\\FieldType\\\\RichText\\\\RichTextStorageTest\\:\\:groupLinksData\\(\\) return type has no value type specified in iterable type array\\.$#"
17151685
count: 1

src/lib/FieldType/RichText/RichTextStorage.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(StorageGateway $gateway, LoggerInterface $logger = n
4242
/**
4343
* @see \Ibexa\Contracts\Core\FieldType\FieldStorage
4444
*/
45-
public function storeFieldData(VersionInfo $versionInfo, Field $field, array $context)
45+
public function storeFieldData(VersionInfo $versionInfo, Field $field)
4646
{
4747
$document = new DOMDocument();
4848
$document->loadXML($field->value->data);
@@ -128,12 +128,8 @@ public function storeFieldData(VersionInfo $versionInfo, Field $field, array $co
128128

129129
/**
130130
* Modifies $field if needed, using external data (like for Urls).
131-
*
132-
* @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo
133-
* @param \Ibexa\Contracts\Core\Persistence\Content\Field $field
134-
* @param array $context
135131
*/
136-
public function getFieldData(VersionInfo $versionInfo, Field $field, array $context)
132+
public function getFieldData(VersionInfo $versionInfo, Field $field)
137133
{
138134
$document = new DOMDocument();
139135
$document->loadXML($field->value->data);
@@ -186,7 +182,7 @@ public function getFieldData(VersionInfo $versionInfo, Field $field, array $cont
186182
$field->value->data = $document->saveXML();
187183
}
188184

189-
public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array $context)
185+
public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds)
190186
{
191187
foreach ($fieldIds as $fieldId) {
192188
$this->gateway->unlinkUrl($fieldId, $versionInfo->versionNo);
@@ -202,8 +198,4 @@ public function hasFieldData()
202198
{
203199
return true;
204200
}
205-
206-
public function getIndexData(VersionInfo $versionInfo, Field $field, array $context)
207-
{
208-
}
209201
}

tests/lib/FieldType/RichText/RichTextStorageTest.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ public function testGetFieldData($xmlString, $updatedXmlString, $linkIds, $linkU
9595
$storage = $this->getPartlyMockedStorage($gateway);
9696
$storage->getFieldData(
9797
$versionInfo,
98-
$field,
99-
$this->getContext()
98+
$field
10099
);
101100

102101
self::assertEquals(
@@ -238,8 +237,7 @@ public function testStoreFieldData(
238237
$storage = $this->getPartlyMockedStorage($gateway);
239238
$result = $storage->storeFieldData(
240239
$versionInfo,
241-
$field,
242-
$this->getContext()
240+
$field
243241
);
244242

245243
self::assertEquals(
@@ -345,8 +343,7 @@ public function testStoreFieldDataThrowsNotFoundException(
345343
$storage = $this->getPartlyMockedStorage($gateway);
346344
$storage->storeFieldData(
347345
$versionInfo,
348-
$field,
349-
$this->getContext()
346+
$field
350347
);
351348
}
352349

@@ -366,8 +363,7 @@ public function testDeleteFieldData(): void
366363

367364
$storage->deleteFieldData(
368365
$versionInfo,
369-
$fieldIds,
370-
$this->getContext()
366+
$fieldIds
371367
);
372368
}
373369

@@ -389,14 +385,6 @@ protected function getPartlyMockedStorage(StorageGateway $gateway)
389385
->getMock();
390386
}
391387

392-
/**
393-
* @return array
394-
*/
395-
protected function getContext()
396-
{
397-
return ['context'];
398-
}
399-
400388
/**
401389
* @var \Psr\Log\LoggerInterface|\PHPUnit\Framework\MockObject\MockObject
402390
*/

0 commit comments

Comments
 (0)