diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index de22585388..023f1c9570 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -7070,11 +7070,6 @@ parameters: count: 1 path: src/contracts/Repository/Validator/ContentValidator.php - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Validator\\\\ContentValidator\\:\\:validate\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/contracts/Repository/Validator/ContentValidator.php - - message: "#^Class Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Bookmark\\\\BookmarkList implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" count: 1 @@ -7500,11 +7495,6 @@ parameters: count: 1 path: src/contracts/Repository/Values/ContentType/FieldDefinitionCollection.php - - - message: "#^Interface Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ContentType\\\\FieldDefinitionCollection extends generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" - count: 1 - path: src/contracts/Repository/Values/ContentType/FieldDefinitionCollection.php - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ContentType\\\\FieldDefinitionCollection\\:\\:map\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -21405,11 +21395,6 @@ parameters: count: 1 path: src/lib/Repository/Strategy/ContentValidator/ContentValidatorStrategy.php - - - message: "#^Method Ibexa\\\\Core\\\\Repository\\\\Strategy\\\\ContentValidator\\\\ContentValidatorStrategy\\:\\:validate\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Repository/Strategy/ContentValidator/ContentValidatorStrategy.php - - message: "#^Property Ibexa\\\\Core\\\\Repository\\\\Strategy\\\\ContentValidator\\\\ContentValidatorStrategy\\:\\:\\$contentValidators \\(array\\\\) does not accept iterable\\.$#" count: 1 @@ -21670,11 +21655,6 @@ parameters: count: 1 path: src/lib/Repository/Validator/ContentCreateStructValidator.php - - - message: "#^Method Ibexa\\\\Core\\\\Repository\\\\Validator\\\\ContentCreateStructValidator\\:\\:validate\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Repository/Validator/ContentCreateStructValidator.php - - message: "#^Cannot access property \\$value on Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Field\\|null\\.$#" count: 2 @@ -21685,11 +21665,6 @@ parameters: count: 1 path: src/lib/Repository/Validator/ContentUpdateStructValidator.php - - - message: "#^Method Ibexa\\\\Core\\\\Repository\\\\Validator\\\\ContentUpdateStructValidator\\:\\:validate\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Repository/Validator/ContentUpdateStructValidator.php - - message: "#^Property Ibexa\\\\Core\\\\Repository\\\\Validator\\\\ContentUpdateStructValidator\\:\\:\\$contentLanguageHandler \\(Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\Language\\\\Handler\\) does not accept Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\Language\\\\Handler\\.$#" count: 1 @@ -21720,16 +21695,6 @@ parameters: count: 1 path: src/lib/Repository/Validator/UserPasswordValidator.php - - - message: "#^Method Ibexa\\\\Core\\\\Repository\\\\Validator\\\\VersionValidator\\:\\:validate\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Repository/Validator/VersionValidator.php - - - - message: "#^Method Ibexa\\\\Core\\\\Repository\\\\Validator\\\\VersionValidator\\:\\:validate\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Repository/Validator/VersionValidator.php - - message: "#^Call to method getValue\\(\\) on an unknown class eZ\\\\Publish\\\\API\\\\Repository\\\\Values\\\\Content\\\\Field\\.$#" count: 1 @@ -56730,11 +56695,6 @@ parameters: count: 1 path: tests/lib/Repository/ContentValidator/ContentValidatorStrategyTest.php - - - message: "#^Method class@anonymous/tests/lib/Repository/ContentValidator/ContentValidatorStrategyTest\\.php\\:87\\:\\:validate\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/lib/Repository/ContentValidator/ContentValidatorStrategyTest.php - - message: "#^Property class@anonymous/tests/lib/Repository/ContentValidator/ContentValidatorStrategyTest\\.php\\:87\\:\\:\\$validationReturn type has no value type specified in iterable type array\\.$#" count: 1 diff --git a/src/contracts/Repository/Validator/ContentValidator.php b/src/contracts/Repository/Validator/ContentValidator.php index e8303da534..333a0cae08 100644 --- a/src/contracts/Repository/Validator/ContentValidator.php +++ b/src/contracts/Repository/Validator/ContentValidator.php @@ -21,7 +21,15 @@ public function supports(ValueObject $object): bool; * @param string[]|null $fieldIdentifiers List of field identifiers for partial validation or null for * case of full validation. Empty identifiers array is equal to no validation. * - * @return array Grouped validation errors by field definition and language code, in format: + * @phpstan-return array< + * int|string, + * array< + * string, + * \Ibexa\Contracts\Core\FieldType\ValidationError|\Ibexa\Contracts\Core\FieldType\ValidationError[] + * > + * > + * + * @return array Grouped validation errors by field definition ID and language code, in format: * $returnValue[string|int $fieldDefinitionId][string $languageCode] = $fieldErrors; * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException diff --git a/src/contracts/Repository/Values/ContentType/FieldDefinitionCollection.php b/src/contracts/Repository/Values/ContentType/FieldDefinitionCollection.php index 30417f23e9..f43b4c749d 100644 --- a/src/contracts/Repository/Values/ContentType/FieldDefinitionCollection.php +++ b/src/contracts/Repository/Values/ContentType/FieldDefinitionCollection.php @@ -13,6 +13,9 @@ use Countable; use IteratorAggregate; +/** + * @phpstan-extends \IteratorAggregate<\Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition> + */ interface FieldDefinitionCollection extends Countable, IteratorAggregate, ArrayAccess { /** diff --git a/src/lib/Repository/Validator/VersionValidator.php b/src/lib/Repository/Validator/VersionValidator.php index c9e5580209..7057780bc1 100644 --- a/src/lib/Repository/Validator/VersionValidator.php +++ b/src/lib/Repository/Validator/VersionValidator.php @@ -35,6 +35,12 @@ public function supports(ValueObject $object): bool return $object instanceof VersionInfo; } + /** + * @phpstan-param array{ + * content?: \Ibexa\Contracts\Core\Repository\Values\Content\Content, + * translations?: string[], + * } $context + */ public function validate( ValueObject $object, array $context = [],