Skip to content

Commit e45fcea

Browse files
authored
[CI] Fixed newly reported phpstan errors (#624)
* [CI] Fixed newly reported phpstan errors * Added errors to baseline as there are fixed on php8+
1 parent 2618149 commit e45fcea

File tree

5 files changed

+20
-9
lines changed

5 files changed

+20
-9
lines changed

phpstan-baseline-7.4.neon

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,18 @@ parameters:
528528
count: 3
529529
path: tests/integration/Core/Repository/RoleServiceTest.php
530530

531+
-
532+
message: '#^Parameter \#1 \$class of class ReflectionProperty constructor expects object\|string, class\-string\|false given\.$#'
533+
identifier: argument.type
534+
count: 4
535+
path: tests/integration/Core/Repository/SearchServiceLocationTest.php
536+
537+
-
538+
message: '#^Parameter \#1 \$class of class ReflectionProperty constructor expects object\|string, class\-string\|false given\.$#'
539+
identifier: argument.type
540+
count: 4
541+
path: tests/integration/Core/Repository/SearchServiceTest.php
542+
531543
-
532544
message: '#^Parameter \#1 \$str of function md5 expects string, int\<1, max\> given\.$#'
533545
identifier: argument.type

phpstan-baseline.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,6 @@ parameters:
342342
count: 1
343343
path: src/bundle/Core/Command/ReindexCommand.php
344344

345-
-
346-
message: '#^Parameter \#2 \$subject of function preg_match expects string, string\|false given\.$#'
347-
identifier: argument.type
348-
count: 1
349-
path: src/bundle/Core/Command/ReindexCommand.php
350-
351345
-
352346
message: '#^Parameter \#2 \$subject of function preg_match_all expects string, string\|false given\.$#'
353347
identifier: argument.type

src/lib/FieldType/MapLocation/MapLocationStorage/Gateway/DoctrineStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function getFieldData(VersionInfo $versionInfo, Field $field)
146146
* @param int $fieldId
147147
* @param int $versionNo
148148
*
149-
* @return array|null
149+
* @return array|\ArrayAccess<string, float>|null
150150
*/
151151
protected function loadFieldData($fieldId, $versionNo)
152152
{

src/lib/Repository/Helper/RelationProcessor.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,11 @@ public function processFieldRelations(
145145
if ($relationType === Relation::FIELD || $relationType === Relation::ASSET) {
146146
foreach ($relationData as $fieldDefinitionId => $contentIds) {
147147
foreach (array_keys($contentIds) as $destinationContentId) {
148-
if (isset($mappedRelations[$relationType][$fieldDefinitionId][$destinationContentId])) {
148+
if (
149+
isset($mappedRelations[$relationType][$fieldDefinitionId]) &&
150+
is_array($mappedRelations[$relationType][$fieldDefinitionId]) &&
151+
isset($mappedRelations[$relationType][$fieldDefinitionId][$destinationContentId])
152+
) {
149153
unset($mappedRelations[$relationType][$fieldDefinitionId][$destinationContentId]);
150154
} else {
151155
$this->persistenceHandler->contentHandler()->addRelation(

tests/lib/Validation/ValidationFailedExceptionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function testEmptyErrorList(): void
5555
'Cannot create %s with empty validation error list.',
5656
ValidationFailedException::class,
5757
));
58-
new ValidationFailedException('__argument_name__', $errors);
58+
$exception = new ValidationFailedException('__argument_name__', $errors);
59+
self::assertSame($errors, $exception->getErrors());
5960
}
6061
}

0 commit comments

Comments
 (0)