diff --git a/composer.json b/composer.json index 340243fe97..37bb9796d3 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,7 @@ "ext-fileinfo": "*", "ext-intl": "*", "ext-json": "*", + "ext-libxml": "*", "ext-mbstring": "*", "ext-xsl": "*", "composer/package-versions-deprecated": "^1.11", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 3946b38411..d9ff6c988c 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -30,11 +30,6 @@ parameters: count: 1 path: src/bundle/Core/Cache/Warmer/ProxyCacheWarmer.php - - - message: "#^Return type \\(void\\) of method Ibexa\\\\Bundle\\\\Core\\\\Cache\\\\Warmer\\\\ProxyCacheWarmer\\:\\:warmUp\\(\\) should be compatible with return type \\(array\\\\) of method Symfony\\\\Component\\\\HttpKernel\\\\CacheWarmer\\\\WarmableInterface\\:\\:warmUp\\(\\)$#" - count: 2 - path: src/bundle/Core/Cache/Warmer/ProxyCacheWarmer.php - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\Command\\\\CheckURLsCommand\\:\\:getTotalCount\\(\\) should return int but returns int\\|null\\.$#" count: 1 @@ -365,21 +360,11 @@ parameters: count: 1 path: src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php - - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\Converter\\\\ContentParamConverter\\:\\:getSupportedClass\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/Core/Converter/ContentParamConverter.php - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\Converter\\\\ContentParamConverter\\:\\:loadValueObject\\(\\) has parameter \\$id with no type specified\\.$#" count: 1 path: src/bundle/Core/Converter/ContentParamConverter.php - - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\Converter\\\\LocationParamConverter\\:\\:getSupportedClass\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/Core/Converter/LocationParamConverter.php - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\Converter\\\\LocationParamConverter\\:\\:loadValueObject\\(\\) has parameter \\$id with no type specified\\.$#" count: 1 @@ -1720,11 +1705,6 @@ parameters: count: 1 path: src/bundle/Core/DependencyInjection/IbexaCoreExtension.php - - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\DependencyInjection\\\\IbexaCoreExtension\\:\\:getConfiguration\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#" - count: 1 - path: src/bundle/Core/DependencyInjection/IbexaCoreExtension.php - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\DependencyInjection\\\\IbexaCoreExtension\\:\\:handleCache\\(\\) has no return type specified\\.$#" count: 1 @@ -2265,11 +2245,6 @@ parameters: count: 1 path: src/bundle/Core/Features/Context/BasicContentContext.php - - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\Features\\\\Context\\\\BasicContentContext\\:\\:getTitleFromPath\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/Core/Features/Context/BasicContentContext.php - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\Features\\\\Context\\\\BasicContentContext\\:\\:getTitleFromPath\\(\\) has parameter \\$path with no type specified\\.$#" count: 1 @@ -3310,11 +3285,6 @@ parameters: count: 1 path: src/bundle/Core/Imagine/AliasGenerator.php - - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\Imagine\\\\AliasGenerator\\:\\:supportsValue\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/Core/Imagine/AliasGenerator.php - - message: "#^Parameter \\#1 \\$image of method Ibexa\\\\Bundle\\\\Core\\\\Imagine\\\\AliasGenerator\\:\\:applyFilter\\(\\) expects Liip\\\\ImagineBundle\\\\Binary\\\\BinaryInterface, Liip\\\\ImagineBundle\\\\Binary\\\\BinaryInterface\\|string given\\.$#" count: 1 @@ -3965,11 +3935,6 @@ parameters: count: 1 path: src/bundle/Core/URLChecker/Handler/HTTPHandler.php - - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\URLChecker\\\\Handler\\\\HTTPHandler\\:\\:isSuccessful\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/Core/URLChecker/Handler/HTTPHandler.php - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\URLChecker\\\\Handler\\\\HTTPHandler\\:\\:isSuccessful\\(\\) has parameter \\$statusCode with no type specified\\.$#" count: 1 @@ -4795,11 +4760,6 @@ parameters: count: 1 path: src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php - - - message: "#^Method Ibexa\\\\Bundle\\\\RepositoryInstaller\\\\Command\\\\ValidatePasswordHashesCommand\\:\\:configure\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/RepositoryInstaller/Command/ValidatePasswordHashesCommand.php - - message: "#^Method Ibexa\\\\Bundle\\\\RepositoryInstaller\\\\DependencyInjection\\\\Compiler\\\\InstallerTagPass\\:\\:process\\(\\) has no return type specified\\.$#" count: 1 @@ -8725,11 +8685,6 @@ parameters: count: 1 path: src/lib/FieldType/BinaryBase/BinaryBaseStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\BinaryBase\\\\BinaryBaseStorage\\:\\:getIndexData\\(\\) should return array\\ but return statement is missing\\.$#" - count: 1 - path: src/lib/FieldType/BinaryBase/BinaryBaseStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\BinaryBase\\\\BinaryBaseStorage\\:\\:removeOldFile\\(\\) has no return type specified\\.$#" count: 1 @@ -8895,11 +8850,6 @@ parameters: count: 1 path: src/lib/FieldType/BinaryBase/BinaryBaseStorage/Gateway/DoctrineStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\BinaryBase\\\\PathGenerator\\\\LegacyPathGenerator\\:\\:getStoragePathForField\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/FieldType/BinaryBase/PathGenerator/LegacyPathGenerator.php - - message: "#^Parameter \\#3 \\$length of function substr expects int\\|null, int\\<0, max\\>\\|false given\\.$#" count: 1 @@ -9370,11 +9320,6 @@ parameters: count: 1 path: src/lib/FieldType/Image/ImageStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Image\\\\ImageStorage\\:\\:getIndexData\\(\\) should return array\\ but returns null\\.$#" - count: 1 - path: src/lib/FieldType/Image/ImageStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Image\\\\ImageStorage\\:\\:storeFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" count: 1 @@ -9990,11 +9935,6 @@ parameters: count: 1 path: src/lib/FieldType/NullStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\NullStorage\\:\\:getIndexData\\(\\) should return array\\ but returns false\\.$#" - count: 1 - path: src/lib/FieldType/NullStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\NullStorage\\:\\:storeFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" count: 1 @@ -10195,11 +10135,6 @@ parameters: count: 1 path: src/lib/FieldType/Url/UrlStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Url\\\\UrlStorage\\:\\:getIndexData\\(\\) should return array\\ but return statement is missing\\.$#" - count: 1 - path: src/lib/FieldType/Url/UrlStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Url\\\\UrlStorage\\:\\:storeFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" count: 1 @@ -10255,11 +10190,6 @@ parameters: count: 1 path: src/lib/FieldType/Url/UrlStorage/Gateway/DoctrineStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Url\\\\UrlStorage\\\\Gateway\\\\DoctrineStorage\\:\\:insertUrl\\(\\) should return string but returns int\\.$#" - count: 1 - path: src/lib/FieldType/Url/UrlStorage/Gateway/DoctrineStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Url\\\\UrlStorage\\\\Gateway\\\\DoctrineStorage\\:\\:linkUrl\\(\\) has no return type specified\\.$#" count: 1 @@ -10370,11 +10300,6 @@ parameters: count: 1 path: src/lib/FieldType/User/UserStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\User\\\\UserStorage\\:\\:getIndexData\\(\\) should return array\\ but return statement is missing\\.$#" - count: 1 - path: src/lib/FieldType/User/UserStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\User\\\\UserStorage\\:\\:storeFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" count: 1 @@ -11000,16 +10925,6 @@ parameters: count: 1 path: src/lib/IO/MetadataHandler/ImageSize.php - - - message: "#^Method Ibexa\\\\Core\\\\IO\\\\MimeTypeDetector\\\\FileInfo\\:\\:getFromBuffer\\(\\) should return string but returns string\\|false\\.$#" - count: 1 - path: src/lib/IO/MimeTypeDetector/FileInfo.php - - - - message: "#^Method Ibexa\\\\Core\\\\IO\\\\MimeTypeDetector\\\\FileInfo\\:\\:getFromPath\\(\\) should return string but returns string\\|false\\.$#" - count: 1 - path: src/lib/IO/MimeTypeDetector/FileInfo.php - - message: "#^Property Ibexa\\\\Core\\\\IO\\\\MimeTypeDetector\\\\FileInfo\\:\\:\\$fileInfo \\(finfo\\) in isset\\(\\) is not nullable\\.$#" count: 1 @@ -11295,16 +11210,6 @@ parameters: count: 1 path: src/lib/MVC/RepositoryAwareInterface.php - - - message: "#^Parameter \\#1 \\$array of function array_keys expects array, array\\|ArrayObject\\<\\(int\\|string\\), mixed\\>\\|bool\\|float\\|int\\|string\\|null given\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Component/Serializer/AbstractPropertyWhitelistNormalizer.php - - - - message: "#^Cannot access offset 'config' on array\\|ArrayObject\\<\\(int\\|string\\), mixed\\>\\|bool\\|float\\|int\\|string\\|null\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Component/Serializer/CompoundMatcherNormalizer.php - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Component\\\\Serializer\\\\SimplifiedRequestNormalizer\\:\\:supportsNormalization\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" count: 1 @@ -11575,11 +11480,6 @@ parameters: count: 1 path: src/lib/MVC/Symfony/FieldType/BinaryBase/ContentDownloadUrlGenerator.php - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\FieldType\\\\BinaryBase\\\\ContentDownloadUrlGenerator\\:\\:getStoragePathForField\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/MVC/Symfony/FieldType/BinaryBase/ContentDownloadUrlGenerator.php - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\FieldType\\\\ImageAsset\\\\ParameterProvider\\:\\:getViewParameters\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -12185,21 +12085,11 @@ parameters: count: 1 path: src/lib/MVC/Symfony/Security/Authorization/Voter/CoreVoter.php - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Security\\\\Authorization\\\\Voter\\\\ValueObjectVoter\\:\\:supportsAttribute\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Security/Authorization/Voter/ValueObjectVoter.php - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Security\\\\Authorization\\\\Voter\\\\ValueObjectVoter\\:\\:supportsAttribute\\(\\) has parameter \\$attribute with no type specified\\.$#" count: 1 path: src/lib/MVC/Symfony/Security/Authorization/Voter/ValueObjectVoter.php - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Security\\\\Authorization\\\\Voter\\\\ValueObjectVoter\\:\\:supportsClass\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Security/Authorization/Voter/ValueObjectVoter.php - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Security\\\\Authorization\\\\Voter\\\\ValueObjectVoter\\:\\:supportsClass\\(\\) has parameter \\$class with no type specified\\.$#" count: 1 @@ -12915,11 +12805,6 @@ parameters: count: 1 path: src/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtension.php - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Templating\\\\Twig\\\\Extension\\\\FileSizeExtension\\:\\:sizeFilter\\(\\) should return string but returns string\\|false\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtension.php - - message: "#^Property Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Templating\\\\Twig\\\\Extension\\\\FileSizeExtension\\:\\:\\$configResolver has no type specified\\.$#" count: 1 @@ -13065,16 +12950,6 @@ parameters: count: 1 path: src/lib/MVC/Symfony/Templating/Twig/FieldBlockRenderer.php - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Translation\\\\CatalogueMapperFileWriter\\:\\:getEnglishFilePath\\(\\) has parameter \\$filePath with no type specified\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Translation/CatalogueMapperFileWriter.php - - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Translation\\\\CatalogueMapperFileWriter\\:\\:hasEnglishCatalogue\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Translation/CatalogueMapperFileWriter.php - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Translation\\\\CatalogueMapperFileWriter\\:\\:hasEnglishCatalogue\\(\\) has parameter \\$foreignFilePath with no type specified\\.$#" count: 1 @@ -14835,11 +14710,6 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/AuthorConverter.php - - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\FieldValue\\\\Converter\\\\AuthorConverter\\:\\:generateXmlString\\(\\) should return string but returns string\\|false\\.$#" - count: 1 - path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/AuthorConverter.php - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\FieldValue\\\\Converter\\\\AuthorConverter\\:\\:restoreValueFromXmlString\\(\\) should return array\\ but returns array\\, array\\\\>\\.$#" count: 1 @@ -14960,11 +14830,6 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeConverter.php - - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\FieldValue\\\\Converter\\\\DateAndTimeConverter\\:\\:generateDateIntervalXML\\(\\) should return string but returns string\\|false\\.$#" - count: 1 - path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeConverter.php - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\FieldValue\\\\Converter\\\\DateAndTimeConverter\\:\\:getDateIntervalFromXML\\(\\) should return DateInterval but empty return statement found\\.$#" count: 1 @@ -15325,11 +15190,6 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/MapLocationConverter.php - - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\FieldValue\\\\Converter\\\\MediaConverter\\:\\:getIndexColumn\\(\\) should return string but returns false\\.$#" - count: 1 - path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/MediaConverter.php - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\FieldValue\\\\Converter\\\\MediaConverter\\:\\:toFieldDefinition\\(\\) has no return type specified\\.$#" count: 1 @@ -15340,11 +15200,6 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/MediaConverter.php - - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\FieldValue\\\\Converter\\\\NullConverter\\:\\:getIndexColumn\\(\\) should return string but returns false\\.$#" - count: 1 - path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/NullConverter.php - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\FieldValue\\\\Converter\\\\NullConverter\\:\\:toFieldDefinition\\(\\) has no return type specified\\.$#" count: 1 @@ -16035,11 +15890,6 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/Content/Handler.php - - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\Handler\\:\\:loadVersionInfo\\(\\) should return Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\VersionInfo but returns Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\VersionInfo\\|false\\.$#" - count: 1 - path: src/lib/Persistence/Legacy/Content/Handler.php - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\Handler\\:\\:removeRawContent\\(\\) has no return type specified\\.$#" count: 1 @@ -16055,11 +15905,6 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/Content/Handler.php - - - message: "#^Parameter \\#1 \\$contentId of method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\Gateway\\:\\:loadVersionInfo\\(\\) expects int, int\\|string given\\.$#" - count: 1 - path: src/lib/Persistence/Legacy/Content/Handler.php - - message: "#^Property Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\MetadataUpdateStruct\\:\\:\\$mainLanguageId \\(int\\) in isset\\(\\) is not nullable\\.$#" count: 1 @@ -17205,11 +17050,6 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/Content/Type/Handler.php - - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\Type\\\\Handler\\:\\:link\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Persistence/Legacy/Content/Type/Handler.php - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\Type\\\\Handler\\:\\:loadContentTypeList\\(\\) has parameter \\$contentTypeIds with no value type specified in iterable type array\\.$#" count: 1 @@ -17230,11 +17070,6 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/Content/Type/Handler.php - - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\Type\\\\Handler\\:\\:unlink\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Persistence/Legacy/Content/Type/Handler.php - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\Type\\\\Handler\\:\\:updateFieldDefinition\\(\\) has no return type specified\\.$#" count: 1 @@ -21890,16 +21725,6 @@ parameters: count: 1 path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FullText.php - - - message: "#^Method Ibexa\\\\Core\\\\Search\\\\Legacy\\\\Content\\\\Common\\\\Gateway\\\\CriterionHandler\\\\FullText\\:\\:tokenizeString\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FullText.php - - - - message: "#^Method Ibexa\\\\Core\\\\Search\\\\Legacy\\\\Content\\\\Common\\\\Gateway\\\\CriterionHandler\\\\FullText\\:\\:tokenizeString\\(\\) should return array but returns array\\\\|false\\.$#" - count: 1 - path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FullText.php - - message: "#^Parameter \\#2 \\$string of method Ibexa\\\\Core\\\\Search\\\\Legacy\\\\Content\\\\Common\\\\Gateway\\\\CriterionHandler\\\\FullText\\:\\:getWordIdSubquery\\(\\) expects string, array\\\\|bool\\|float\\|int\\|string given\\.$#" count: 1 @@ -22020,11 +21845,6 @@ parameters: count: 1 path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MapLocationDistance.php - - - message: "#^Method Ibexa\\\\Core\\\\Search\\\\Legacy\\\\Content\\\\Common\\\\Gateway\\\\CriterionHandler\\\\MapLocationDistance\\:\\:kilometersToDegrees\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MapLocationDistance.php - - message: "#^Method Ibexa\\\\Core\\\\Search\\\\Legacy\\\\Content\\\\Common\\\\Gateway\\\\CriterionHandler\\\\MapLocationDistance\\:\\:kilometersToDegrees\\(\\) has parameter \\$kilometers with no type specified\\.$#" count: 1 @@ -23260,11 +23080,6 @@ parameters: count: 1 path: tests/bundle/Core/DependencyInjection/Compiler/SlugConverterConfigurationPassTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\DependencyInjection\\\\Compiler\\\\TranslationCollectorPassTest\\:\\:normalizePath\\(\\) has parameter \\$path with no type specified\\.$#" - count: 1 - path: tests/bundle/Core/DependencyInjection/Compiler/TranslationCollectorPassTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\DependencyInjection\\\\Compiler\\\\TranslationCollectorPassTest\\:\\:testTranslationCollector\\(\\) has parameter \\$availableTranslations with no value type specified in iterable type array\\.$#" count: 1 @@ -26035,21 +25850,6 @@ parameters: count: 1 path: tests/bundle/IO/DependencyInjection/ConfigurationFactory/BaseFlysystemTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\IO\\\\DependencyInjection\\\\ConfigurationFactory\\\\BinarydataHandler\\\\FlysystemTest\\:\\:provideExpectedParentServiceId\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/IO/DependencyInjection/ConfigurationFactory/BinarydataHandler/FlysystemTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\IO\\\\DependencyInjection\\\\ConfigurationFactory\\\\MetadataHandler\\\\FlysystemTest\\:\\:provideExpectedParentServiceId\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/FlysystemTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\IO\\\\DependencyInjection\\\\ConfigurationFactory\\\\MetadataHandler\\\\LegacyDFSClusterTest\\:\\:provideExpectedParentServiceId\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/LegacyDFSClusterTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\IO\\\\DependencyInjection\\\\ConfigurationFactory\\\\MetadataHandler\\\\LegacyDFSClusterTest\\:\\:provideHandlerConfiguration\\(\\) has no return type specified\\.$#" count: 1 @@ -26075,11 +25875,6 @@ parameters: count: 1 path: tests/bundle/IO/DependencyInjection/ConfigurationFactoryTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\IO\\\\DependencyInjection\\\\ConfigurationFactoryTest\\:\\:registerHandler\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/IO/DependencyInjection/ConfigurationFactoryTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\IO\\\\DependencyInjection\\\\ConfigurationFactoryTest\\:\\:registerHandler\\(\\) has parameter \\$name with no type specified\\.$#" count: 1 @@ -34955,11 +34750,6 @@ parameters: count: 1 path: tests/integration/Core/Repository/Regression/EZP22408DeleteRelatedObjectTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\Regression\\\\EZP22408DeleteRelatedObjectTest\\:\\:getMainLanguageCode\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/integration/Core/Repository/Regression/EZP22408DeleteRelatedObjectTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\Regression\\\\EZP22408DeleteRelatedObjectTest\\:\\:testRelationListIsUpdatedWhenRelatedObjectIsDeleted\\(\\) has no return type specified\\.$#" count: 1 @@ -39780,11 +39570,6 @@ parameters: count: 1 path: tests/lib/Base/Container/Compiler/Stubs/GatewayBasedStorageHandler.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Base\\\\Container\\\\Compiler\\\\Stubs\\\\GatewayBasedStorageHandler\\:\\:getIndexData\\(\\) should return array\\ but return statement is missing\\.$#" - count: 1 - path: tests/lib/Base/Container/Compiler/Stubs/GatewayBasedStorageHandler.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Base\\\\Container\\\\Compiler\\\\Stubs\\\\GatewayBasedStorageHandler\\:\\:hasFieldData\\(\\) should return bool but return statement is missing\\.$#" count: 1 @@ -42615,11 +42400,6 @@ parameters: count: 1 path: tests/lib/FieldType/ImageTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\FieldType\\\\ImageTest\\:\\:getImageInputPath\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/FieldType/ImageTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\FieldType\\\\ImageTest\\:\\:getImageValidatorMock\\(\\) has no return type specified\\.$#" count: 1 @@ -43740,11 +43520,6 @@ parameters: count: 1 path: tests/lib/IO/MetadataHandler/ImageSizeTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\IO\\\\MimeTypeDetector\\\\FileInfoTest\\:\\:getFixture\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/IO/MimeTypeDetector/FileInfoTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\IO\\\\MimeTypeDetector\\\\FileInfoTest\\:\\:testGetFromBuffer\\(\\) has no return type specified\\.$#" count: 1 @@ -47130,11 +46905,6 @@ parameters: count: 1 path: tests/lib/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtensionIntegrationTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\Templating\\\\Twig\\\\Extension\\\\FieldRenderingExtensionIntegrationTest\\:\\:getTemplatePath\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtensionIntegrationTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\Templating\\\\Twig\\\\Extension\\\\FieldRenderingExtensionIntegrationTest\\:\\:getTemplatePath\\(\\) has parameter \\$tpl with no type specified\\.$#" count: 1 @@ -54360,11 +54130,6 @@ parameters: count: 1 path: tests/lib/Persistence/Limitation/Target/Builder/VersionBuilderTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Persistence\\\\TransformationProcessor\\\\TransformationProcessorDefinitionBasedParserTest\\:\\:getTestFiles\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Persistence/TransformationProcessor/TransformationProcessorDefinitionBasedParserTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Persistence\\\\TransformationProcessor\\\\TransformationProcessorDefinitionBasedParserTest\\:\\:testParse\\(\\) has no return type specified\\.$#" count: 1 @@ -54375,11 +54140,6 @@ parameters: count: 1 path: tests/lib/Persistence/TransformationProcessor/TransformationProcessorDefinitionBasedParserTest.php - - - message: "#^Parameter \\#2 \\$array of function array_map expects array, array\\\\|false given\\.$#" - count: 1 - path: tests/lib/Persistence/TransformationProcessor/TransformationProcessorDefinitionBasedParserTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Persistence\\\\TransformationProcessor\\\\TransformationProcessorDefinitionBasedTest\\:\\:getProcessor\\(\\) has no return type specified\\.$#" count: 1 @@ -59435,16 +59195,6 @@ parameters: count: 1 path: tests/lib/Repository/SiteAccessAware/AbstractServiceTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\ContentServiceTest\\:\\:getAPIServiceClassName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/SiteAccessAware/ContentServiceTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\ContentServiceTest\\:\\:getSiteAccessAwareServiceClassName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/SiteAccessAware/ContentServiceTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\ContentServiceTest\\:\\:providerForLanguagesLookupMethods\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -59455,16 +59205,6 @@ parameters: count: 1 path: tests/lib/Repository/SiteAccessAware/ContentServiceTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\ContentTypeServiceTest\\:\\:getAPIServiceClassName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/SiteAccessAware/ContentTypeServiceTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\ContentTypeServiceTest\\:\\:getSiteAccessAwareServiceClassName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/SiteAccessAware/ContentTypeServiceTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\ContentTypeServiceTest\\:\\:providerForLanguagesLookupMethods\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -59500,16 +59240,6 @@ parameters: count: 1 path: tests/lib/Repository/SiteAccessAware/Language/LanguageResolverTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\LanguageServiceTest\\:\\:getAPIServiceClassName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/SiteAccessAware/LanguageServiceTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\LanguageServiceTest\\:\\:getSiteAccessAwareServiceClassName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/SiteAccessAware/LanguageServiceTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\LanguageServiceTest\\:\\:providerForLanguagesLookupMethods\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -59520,16 +59250,6 @@ parameters: count: 1 path: tests/lib/Repository/SiteAccessAware/LanguageServiceTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\LocationServiceTest\\:\\:getAPIServiceClassName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/SiteAccessAware/LocationServiceTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\LocationServiceTest\\:\\:getSiteAccessAwareServiceClassName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/SiteAccessAware/LocationServiceTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\LocationServiceTest\\:\\:providerForLanguagesLookupMethods\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -59540,16 +59260,6 @@ parameters: count: 1 path: tests/lib/Repository/SiteAccessAware/LocationServiceTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\ObjectStateServiceTest\\:\\:getAPIServiceClassName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/SiteAccessAware/ObjectStateServiceTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\ObjectStateServiceTest\\:\\:getSiteAccessAwareServiceClassName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/SiteAccessAware/ObjectStateServiceTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\ObjectStateServiceTest\\:\\:providerForLanguagesLookupMethods\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -59560,16 +59270,6 @@ parameters: count: 1 path: tests/lib/Repository/SiteAccessAware/ObjectStateServiceTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\SearchServiceTest\\:\\:getAPIServiceClassName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/SiteAccessAware/SearchServiceTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\SearchServiceTest\\:\\:getSiteAccessAwareServiceClassName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/SiteAccessAware/SearchServiceTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\SearchServiceTest\\:\\:providerForLanguagesLookupMethods\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -59620,16 +59320,6 @@ parameters: count: 1 path: tests/lib/Repository/SiteAccessAware/SearchServiceTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\TrashServiceTest\\:\\:getAPIServiceClassName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/SiteAccessAware/TrashServiceTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\TrashServiceTest\\:\\:getSiteAccessAwareServiceClassName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/SiteAccessAware/TrashServiceTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\TrashServiceTest\\:\\:providerForLanguagesLookupMethods\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -59640,16 +59330,6 @@ parameters: count: 1 path: tests/lib/Repository/SiteAccessAware/TrashServiceTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\UrlAliasServiceTest\\:\\:getAPIServiceClassName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/SiteAccessAware/UrlAliasServiceTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\UrlAliasServiceTest\\:\\:getSiteAccessAwareServiceClassName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/SiteAccessAware/UrlAliasServiceTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\UrlAliasServiceTest\\:\\:providerForLanguagesLookupMethods\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -59690,16 +59370,6 @@ parameters: count: 1 path: tests/lib/Repository/SiteAccessAware/UrlAliasServiceTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\UserServiceTest\\:\\:getAPIServiceClassName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/SiteAccessAware/UserServiceTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\UserServiceTest\\:\\:getSiteAccessAwareServiceClassName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/SiteAccessAware/UserServiceTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\SiteAccessAware\\\\UserServiceTest\\:\\:providerForLanguagesLookupMethods\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 diff --git a/src/bundle/Core/Cache/Warmer/ProxyCacheWarmer.php b/src/bundle/Core/Cache/Warmer/ProxyCacheWarmer.php index 12d74a0be4..58f4b054ea 100644 --- a/src/bundle/Core/Cache/Warmer/ProxyCacheWarmer.php +++ b/src/bundle/Core/Cache/Warmer/ProxyCacheWarmer.php @@ -47,8 +47,10 @@ public function isOptional(): bool return false; } - public function warmUp($cacheDir): void + public function warmUp($cacheDir): array { $this->proxyGenerator->warmUp(self::PROXY_CLASSES); + + return []; } } diff --git a/src/bundle/Core/Command/CheckURLsCommand.php b/src/bundle/Core/Command/CheckURLsCommand.php index 2589dde7cb..c1a4fc357d 100644 --- a/src/bundle/Core/Command/CheckURLsCommand.php +++ b/src/bundle/Core/Command/CheckURLsCommand.php @@ -106,7 +106,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $progress->finish(); - return 0; + return self::SUCCESS; } private function getTotalCount(): int diff --git a/src/bundle/Core/Command/CleanupVersionsCommand.php b/src/bundle/Core/Command/CleanupVersionsCommand.php index e964b237c1..67efa6bbbe 100644 --- a/src/bundle/Core/Command/CleanupVersionsCommand.php +++ b/src/bundle/Core/Command/CleanupVersionsCommand.php @@ -31,15 +31,21 @@ class CleanupVersionsCommand extends Command - Run this command in production environment using --env=prod EOT; public const VERSION_DRAFT = 'draft'; + public const VERSION_ARCHIVED = 'archived'; public const VERSION_PUBLISHED = 'published'; public const VERSION_ALL = 'all'; + public const VERSION_STATUS = [ self::VERSION_DRAFT => VersionInfo::STATUS_DRAFT, self::VERSION_ARCHIVED => VersionInfo::STATUS_ARCHIVED, self::VERSION_PUBLISHED => VersionInfo::STATUS_PUBLISHED, ]; + protected static $defaultName = 'ibexa:content:cleanup-versions'; + + protected static $defaultDescription = 'Removes unwanted content versions. Keeps the published version untouched. By default, also keeps the last archived/draft version.'; + private readonly Repository $repository; private readonly RepositoryConfigurationProviderInterface $repositoryConfigurationProvider; @@ -62,8 +68,6 @@ protected function configure() { $beforeRunningHints = self::BEFORE_RUNNING_HINTS; $this - ->setName('ibexa:content:cleanup-versions') - ->setDescription('Removes unwanted content versions. Keeps the published version untouched. By default, also keeps the last archived/draft version.') ->addOption( 'status', 't', @@ -144,7 +148,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($contentIdsCount === 0) { $output->writeln('There is no content matching the given Criteria.'); - return 0; + return self::SUCCESS; } $output->writeln(sprintf( @@ -182,7 +186,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ), OutputInterface::VERBOSITY_VERBOSE); if ($removeAll) { - $versions = array_filter($versions, static function (VersionInfo $version) { + $versions = array_filter($versions, static function (VersionInfo $version): bool { return $version->status !== VersionInfo::STATUS_PUBLISHED; }); } @@ -225,7 +229,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $contentIdsCount )); - return 0; + return self::SUCCESS; } /** diff --git a/src/bundle/Core/Command/CopySubtreeCommand.php b/src/bundle/Core/Command/CopySubtreeCommand.php index c2033da4b8..a8270b1d55 100644 --- a/src/bundle/Core/Command/CopySubtreeCommand.php +++ b/src/bundle/Core/Command/CopySubtreeCommand.php @@ -28,6 +28,10 @@ */ class CopySubtreeCommand extends Command { + protected static $defaultName = 'ibexa:copy-subtree'; + + protected static $defaultDescription = 'Copies a subtree from one Location to another'; + /** @var \Ibexa\Contracts\Core\Repository\LocationService */ private $locationService; @@ -68,7 +72,6 @@ public function __construct( protected function configure() { $this - ->setName('ibexa:copy-subtree') ->addArgument( 'source-location-id', InputArgument::REQUIRED, @@ -85,8 +88,7 @@ protected function configure() InputOption::VALUE_OPTIONAL, 'Ibexa username (with Role containing at least content policies: create, read)', 'admin' - ) - ->setDescription('Copies a subtree from one Location to another'); + ); } /** @@ -150,7 +152,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ); if (!$input->getOption('no-interaction') && !$questionHelper->ask($input, $output, $question)) { - return 0; + return self::SUCCESS; } $this->locationService->copySubtree( @@ -162,7 +164,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int 'Finished' ); - return 0; + return self::SUCCESS; } /** diff --git a/src/bundle/Core/Command/DebugConfigResolverCommand.php b/src/bundle/Core/Command/DebugConfigResolverCommand.php index 53fa71216f..a796f9b4c6 100644 --- a/src/bundle/Core/Command/DebugConfigResolverCommand.php +++ b/src/bundle/Core/Command/DebugConfigResolverCommand.php @@ -19,6 +19,8 @@ class DebugConfigResolverCommand extends Command { + protected static $defaultName = 'ibexa:debug:config-resolver'; + /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ private $configResolver; @@ -40,7 +42,6 @@ public function __construct( */ public function configure() { - $this->setName('ibexa:debug:config-resolver'); $this->setAliases(['ibexa:debug:config']); $this->setDescription('Debugs / Retrieves a parameter from the Config Resolver'); $this->addArgument( @@ -96,7 +97,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($input->getOption('json')) { $output->write(json_encode($parameterData)); - return 0; + return self::SUCCESS; } $output->writeln('SiteAccess name: ' . $this->siteAccess->name); @@ -111,6 +112,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int ) ); - return 0; + return self::SUCCESS; } } diff --git a/src/bundle/Core/Command/DeleteContentTranslationCommand.php b/src/bundle/Core/Command/DeleteContentTranslationCommand.php index fc18aca841..9514113014 100644 --- a/src/bundle/Core/Command/DeleteContentTranslationCommand.php +++ b/src/bundle/Core/Command/DeleteContentTranslationCommand.php @@ -24,6 +24,10 @@ */ class DeleteContentTranslationCommand extends Command { + protected static $defaultName = 'ibexa:delete-content-translation'; + + protected static $defaultDescription = 'Deletes a translation from all versions of a Content item'; + /** @var \Ibexa\Contracts\Core\Repository\Repository */ private $repository; @@ -51,7 +55,6 @@ public function __construct(Repository $repository) protected function configure() { $this - ->setName('ibexa:delete-content-translation') ->addArgument('content-id', InputArgument::REQUIRED, 'Content Object Id') ->addArgument( 'language-code', @@ -64,8 +67,7 @@ protected function configure() InputOption::VALUE_OPTIONAL, 'Ibexa username (with Role containing at least content Policies: read, versionread, edit, remove, versionremove)', 'admin' - ) - ->setDescription('Deletes a translation from all versions of a Content item'); + ); } protected function initialize(InputInterface $input, OutputInterface $output) @@ -125,7 +127,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->repository->rollback(); $this->output->writeln('Reverting and aborting.'); - return 0; + return self::SUCCESS; } // Delete Translation @@ -142,7 +144,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int throw $e; } - return 0; + return self::SUCCESS; } /** @@ -167,7 +169,7 @@ private function promptUserForMainLanguageChange( // get main Translation candidates w/o Translation being removed $mainTranslationCandidates = array_filter( $lastVersionLanguageCodes, - static function ($versionLanguageCode) use ($languageCode) { + static function ($versionLanguageCode) use ($languageCode): bool { return $versionLanguageCode !== $languageCode; } ); diff --git a/src/bundle/Core/Command/ExpireUserPasswordsCommand.php b/src/bundle/Core/Command/ExpireUserPasswordsCommand.php index b6062f6165..ca29407ea1 100644 --- a/src/bundle/Core/Command/ExpireUserPasswordsCommand.php +++ b/src/bundle/Core/Command/ExpireUserPasswordsCommand.php @@ -29,6 +29,8 @@ final class ExpireUserPasswordsCommand extends Command { protected static $defaultName = 'ibexa:user:expire-password'; + protected static $defaultDescription = 'Expire passwords for selected users.'; + public const REQUIRE_NEW_PASSWORD_VALUE = true; public const DEFAULT_BATCH_SIZE = 50; @@ -71,7 +73,6 @@ protected function configure(): void { $beforeRunningHints = self::BEFORE_RUNNING_HINTS; $this - ->setDescription('Expire passwords for selected users.') ->addOption( 'user-id', 'u', @@ -147,7 +148,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($totalCount === 0) { $output->writeln('There are no users matching given criteria'); - return Command::SUCCESS; + return self::SUCCESS; } $output->writeln(sprintf( @@ -212,7 +213,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ); } - return Command::SUCCESS; + return self::SUCCESS; } /** diff --git a/src/bundle/Core/Command/NormalizeImagesPathsCommand.php b/src/bundle/Core/Command/NormalizeImagesPathsCommand.php index 85c2704379..e5eeceed8c 100644 --- a/src/bundle/Core/Command/NormalizeImagesPathsCommand.php +++ b/src/bundle/Core/Command/NormalizeImagesPathsCommand.php @@ -39,6 +39,8 @@ final class NormalizeImagesPathsCommand extends Command protected static $defaultName = 'ibexa:images:normalize-paths'; + protected static $defaultDescription = 'Normalizes stored paths for images.'; + /** @var \Ibexa\Core\FieldType\Image\ImageStorage\Gateway */ private $imageGateway; @@ -73,7 +75,6 @@ protected function configure() $beforeRunningHints = self::BEFORE_RUNNING_HINTS; $this - ->setDescription('Normalizes stored paths for images.') ->addOption( self::SKIP_HASHING_COMMAND_PARAMETER, null, @@ -112,11 +113,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($imagePathsToNormalizeCount === 0) { $io->success('No paths to normalize.'); - return 0; + return self::SUCCESS; } if (!$io->confirm('Do you want to continue?')) { - return 0; + return self::SUCCESS; } $io->writeln('Normalizing image paths. Please wait...'); @@ -135,7 +136,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $io->progressFinish(); $io->success('Done!'); - return 0; + return self::SUCCESS; } /** @@ -232,7 +233,7 @@ private function getFinalNormalizedPath( $processedPaths = array_values( array_filter( $imagePathsToNormalize, - static function (array $data) use ($filePath) { + static function (array $data) use ($filePath): bool { return $data['oldPath'] === $filePath; } ) diff --git a/src/bundle/Core/Command/RegenerateUrlAliasesCommand.php b/src/bundle/Core/Command/RegenerateUrlAliasesCommand.php index 6591bfa265..4a59fde16b 100644 --- a/src/bundle/Core/Command/RegenerateUrlAliasesCommand.php +++ b/src/bundle/Core/Command/RegenerateUrlAliasesCommand.php @@ -21,7 +21,7 @@ use Symfony\Component\Console\Question\ConfirmationQuestion; /** - * The ezplatform:urls:regenerate-aliases Symfony command implementation. + * The ibexa:urls:regenerate-aliases Symfony command implementation. * Recreates system URL aliases for all existing Locations and cleanups corrupted URL alias nodes. */ class RegenerateUrlAliasesCommand extends Command @@ -36,6 +36,8 @@ class RegenerateUrlAliasesCommand extends Command - Manually clear HTTP cache after running this command. EOT; + protected static $defaultName = 'ibexa:urls:regenerate-aliases'; + /** @var \Ibexa\Contracts\Core\Repository\Repository */ private $repository; @@ -61,7 +63,6 @@ protected function configure() { $beforeRunningHints = self::BEFORE_RUNNING_HINTS; $this - ->setName('ibexa:urls:regenerate-aliases') ->setDescription( 'Regenerates Location URL aliases (autogenerated) and cleans up custom Location ' . 'and global URL aliases stored in the Legacy Storage Engine' @@ -116,7 +117,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $locationsCount = count($locationIds); } else { $locationsCount = $this->repository->sudo( - static function (Repository $repository) { + static function (Repository $repository): int { return $repository->getLocationService()->getAllLocationsCount(); } ); @@ -125,7 +126,7 @@ static function (Repository $repository) { if ($locationsCount === 0) { $output->writeln('No location was found. Exiting.'); - return 0; + return self::SUCCESS; } if (!$input->getOption('no-interaction')) { @@ -139,24 +140,24 @@ static function (Repository $repository) { false ); if (!$helper->ask($input, $output, $question)) { - return 0; + return self::SUCCESS; } } elseif (!$input->getOption('force')) { - return 1; + return self::FAILURE; } $this->regenerateSystemUrlAliases($output, $locationsCount, $locationIds, $iterationCount); $output->writeln('Cleaning up corrupted URL aliases...'); $corruptedAliasesCount = $this->repository->sudo( - static function (Repository $repository) { + static function (Repository $repository): int { return $repository->getURLAliasService()->deleteCorruptedUrlAliases(); } ); $output->writeln("Done. Deleted {$corruptedAliasesCount} entries."); $output->writeln('Make sure to clear HTTP cache.'); - return 0; + return self::SUCCESS; } /** diff --git a/src/bundle/Core/Command/ReindexCommand.php b/src/bundle/Core/Command/ReindexCommand.php index 68f8437310..6481e83fe9 100644 --- a/src/bundle/Core/Command/ReindexCommand.php +++ b/src/bundle/Core/Command/ReindexCommand.php @@ -29,6 +29,10 @@ class ReindexCommand extends Command { + protected static $defaultName = 'ibexa:reindex'; + + protected static $defaultDescription = 'Recreates or refreshes the search engine index'; + /** @var \Ibexa\Core\Search\Common\Indexer|\Ibexa\Core\Search\Common\IncrementalIndexer */ private $searchIndexer; @@ -109,8 +113,6 @@ public function initialize(InputInterface $input, OutputInterface $output) protected function configure() { $this - ->setName('ibexa:reindex') - ->setDescription('Recreates or refreshes the search engine index') ->addOption( 'iteration-count', 'c', @@ -220,7 +222,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int EOT); if (!$io->confirm('Continue?', true)) { - return 0; + return self::SUCCESS; } } @@ -230,7 +232,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return $this->indexIncrementally($input, $output, $iterationCount, $commit); } - return 0; + return self::SUCCESS; } /** @@ -447,7 +449,7 @@ private function getPhpPath() /** * @return int */ - private function getNumberOfCPUCores() + private function getNumberOfCPUCores(): int { $cores = 1; if (is_file('/proc/cpuinfo')) { diff --git a/src/bundle/Core/Command/ResizeOriginalImagesCommand.php b/src/bundle/Core/Command/ResizeOriginalImagesCommand.php index c0ee18b9eb..649beac29c 100644 --- a/src/bundle/Core/Command/ResizeOriginalImagesCommand.php +++ b/src/bundle/Core/Command/ResizeOriginalImagesCommand.php @@ -41,6 +41,8 @@ class ResizeOriginalImagesCommand extends Command public const DEFAULT_ITERATION_COUNT = 25; public const DEFAULT_REPOSITORY_USER = 'admin'; + protected static $defaultName = 'ibexa:images:resize-original'; + /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ private $permissionResolver; @@ -104,7 +106,6 @@ protected function initialize(InputInterface $input, OutputInterface $output) protected function configure() { $this - ->setName('ibexa:images:resize-original') ->addArgument( 'imageFieldIdentifier', InputArgument::REQUIRED, @@ -156,7 +157,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ) ); - return 0; + return self::SUCCESS; } try { @@ -169,7 +170,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ) ); - return 0; + return self::SUCCESS; } $query = new Query(); @@ -194,13 +195,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int ) ); - return 0; + return self::SUCCESS; } $helper = $this->getHelper('question'); $question = new ConfirmationQuestion('The changes you are going to perform cannot be undone. Remember to do a proper backup before. Would you like to continue? ', false); if (!$helper->ask($input, $output, $question)) { - return 0; + return self::SUCCESS; } $progressBar = new ProgressBar($output, $totalCount); @@ -227,7 +228,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ) ); - return 0; + return self::SUCCESS; } /** diff --git a/src/bundle/Core/Command/SetSystemContentTypeGroupCommand.php b/src/bundle/Core/Command/SetSystemContentTypeGroupCommand.php index 4e5d901898..a97c3f6554 100644 --- a/src/bundle/Core/Command/SetSystemContentTypeGroupCommand.php +++ b/src/bundle/Core/Command/SetSystemContentTypeGroupCommand.php @@ -28,6 +28,8 @@ final class SetSystemContentTypeGroupCommand extends Command protected static $defaultName = 'ibexa:content-type-group:set-system'; + protected static $defaultDescription = 'Sets information if ContentTypeGroup is a system group'; + /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ private $contentTypeService; @@ -66,7 +68,6 @@ protected function configure() 'Ibexa username (with Role containing at least content policies: remove, read, versionread)', self::DEFAULT_REPOSITORY_USER ) - ->setDescription('Sets information if ContentTypeGroup is a system group') ->setHelp( <<%command.name% sets `is_system` flag for ContentTypeGroup which determines if ContentTypeGroup is a system group. diff --git a/src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php b/src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php index babbe4e9cd..d317f520f0 100644 --- a/src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php +++ b/src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php @@ -26,6 +26,7 @@ class UpdateTimestampsToUTCCommand extends Command { public const MAX_TIMESTAMP_VALUE = 2147483647; + public const DEFAULT_ITERATION_COUNT = 100; public const MODES = [ 'date' => ['ezdate'], @@ -33,6 +34,10 @@ class UpdateTimestampsToUTCCommand extends Command 'all' => ['ezdate', 'ezdatetime'], ]; + protected static $defaultName = 'ibexa:timestamps:to-utc'; + + protected static $defaultDescription = 'Updates ezdate and ezdatetime timestamps to UTC'; + /** @var int */ protected $done = 0; @@ -66,8 +71,6 @@ public function __construct(Connection $connection) protected function configure() { $this - ->setName('ibexa:timestamps:to-utc') - ->setDescription('Updates ezdate and ezdatetime timestamps to UTC') ->addArgument( 'timezone', InputArgument::OPTIONAL, @@ -150,17 +153,17 @@ protected function execute(InputInterface $input, OutputInterface $output): int sprintf('The selected mode is not supported. Use one of the following modes: %s', implode(', ', array_keys(self::MODES))) ); - return 0; + return self::SUCCESS; } $from = $input->getOption('from'); $to = $input->getOption('to'); if ($from && !$this->validateDateTimeString($from, $output)) { - return 0; + return self::SUCCESS; } if ($to && !$this->validateDateTimeString($to, $output)) { - return 0; + return self::SUCCESS; } if ($from) { $this->from = $this->dateStringToTimestamp($from); @@ -192,7 +195,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($count == 0) { $output->writeln('Nothing to process, exiting.'); - return 0; + return self::SUCCESS; } $helper = $this->getHelper('question'); @@ -204,7 +207,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (!$helper->ask($input, $output, $question)) { $output->writeln(''); - return 0; + return self::SUCCESS; } $progressBar = $this->getProgressBar($count, $output); @@ -253,7 +256,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ]); } - return 0; + return self::SUCCESS; } /** @@ -327,7 +330,7 @@ protected function getTimestampBasedFields($offset, $limit) * * @return int */ - protected function countTimestampBasedFields() + protected function countTimestampBasedFields(): int { $query = $this->connection->createQueryBuilder(); $query @@ -365,7 +368,7 @@ protected function countTimestampBasedFields() * * @return int */ - protected function convertToUtcTimestamp($timestamp) + protected function convertToUtcTimestamp($timestamp): int { $dateTimeZone = new DateTimeZone($this->timezone); $dateTimeZoneUTC = new DateTimeZone('UTC'); @@ -383,10 +386,10 @@ protected function convertToUtcTimestamp($timestamp) * * @return bool */ - protected function validateDateTimeString($dateTimeString, OutputInterface $output) + protected function validateDateTimeString($dateTimeString, OutputInterface $output): bool { try { - new \DateTime($dateTimeString); + new DateTime($dateTimeString); } catch (\Exception $exception) { $output->writeln('The --from and --to options must be a valid Date string.'); @@ -496,9 +499,9 @@ private function getPhpPath() * * @return int */ - private function dateStringToTimestamp($dateString) + private function dateStringToTimestamp($dateString): int { - $date = new \DateTime($dateString); + $date = new DateTime($dateString); return $date->getTimestamp(); } diff --git a/src/bundle/Core/Converter/ContentParamConverter.php b/src/bundle/Core/Converter/ContentParamConverter.php index 1bdcf082a9..51082caab5 100644 --- a/src/bundle/Core/Converter/ContentParamConverter.php +++ b/src/bundle/Core/Converter/ContentParamConverter.php @@ -20,12 +20,12 @@ public function __construct(ContentService $contentService) $this->contentService = $contentService; } - protected function getSupportedClass() + protected function getSupportedClass(): string { return Content::class; } - protected function getPropertyName() + protected function getPropertyName(): string { return 'contentId'; } diff --git a/src/bundle/Core/Converter/LocationParamConverter.php b/src/bundle/Core/Converter/LocationParamConverter.php index 85db939580..d2e74e0889 100644 --- a/src/bundle/Core/Converter/LocationParamConverter.php +++ b/src/bundle/Core/Converter/LocationParamConverter.php @@ -27,12 +27,12 @@ public function __construct( $this->contentPreviewHelper = $contentPreviewHelper; } - protected function getSupportedClass() + protected function getSupportedClass(): string { return Location::class; } - protected function getPropertyName() + protected function getPropertyName(): string { return 'locationId'; } diff --git a/src/bundle/Core/DependencyInjection/Configuration.php b/src/bundle/Core/DependencyInjection/Configuration.php index a577754db4..57dc11ae77 100644 --- a/src/bundle/Core/DependencyInjection/Configuration.php +++ b/src/bundle/Core/DependencyInjection/Configuration.php @@ -50,7 +50,7 @@ public function setSiteAccessConfigurationFilters(array $filters) * * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder */ - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('ibexa'); @@ -276,7 +276,7 @@ private function addImageMagickSection(ArrayNodeDefinition $rootNode) ->info('Absolute path of ImageMagick / GraphicsMagick "convert" binary.') ->beforeNormalization() ->ifTrue( - static function ($v) { + static function ($v): bool { $basename = basename($v); // If there is a space in the basename, just drop it and everything after it. if (($wsPos = strpos($basename, ' ')) !== false) { @@ -330,14 +330,14 @@ private function addHttpCacheSection(ArrayNodeDefinition $rootNode) ->defaultValue('local') ->beforeNormalization() ->ifTrue( - static function ($v) { + static function ($v): bool { $http = ['multiple_http' => true, 'single_http' => true]; return isset($http[$v]); } ) ->then( - static function () { + static function (): string { return 'http'; } ) diff --git a/src/bundle/Core/DependencyInjection/Configuration/ComplexSettings/ComplexSettingParser.php b/src/bundle/Core/DependencyInjection/Configuration/ComplexSettings/ComplexSettingParser.php index 9183bb8f41..29f5380c6f 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/ComplexSettings/ComplexSettingParser.php +++ b/src/bundle/Core/DependencyInjection/Configuration/ComplexSettings/ComplexSettingParser.php @@ -35,7 +35,7 @@ public function __construct() * * {@inheritdoc} */ - public function isDynamicSetting($setting) + public function isDynamicSetting($setting): bool { if (parent::isDynamicSetting($setting) === false) { return false; @@ -44,7 +44,7 @@ public function isDynamicSetting($setting) return (bool)preg_match('/^' . $this->dynamicSettingRegex . '$/', $setting); } - public function containsDynamicSettings($string) + public function containsDynamicSettings($string): bool { return count($this->matchDynamicSettings($string)) > 0; } diff --git a/src/bundle/Core/DependencyInjection/Configuration/Parser/Image.php b/src/bundle/Core/DependencyInjection/Configuration/Parser/Image.php index 769ac4b1db..e3b62a3fb2 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/Parser/Image.php +++ b/src/bundle/Core/DependencyInjection/Configuration/Parser/Image.php @@ -87,7 +87,7 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) ->useAttributeAsKey('options') ->beforeNormalization() ->ifTrue( - static function ($v) { + static function ($v): bool { // Check if passed array only contains a "params" key (BC with <=5.3). return is_array($v) && count($v) === 1 && isset($v['params']); } diff --git a/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/DynamicSettingParser.php b/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/DynamicSettingParser.php index 3c4a4403db..cc8a5d3cb2 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/DynamicSettingParser.php +++ b/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/DynamicSettingParser.php @@ -41,7 +41,7 @@ public function parseDynamicSetting($setting) * * @return string */ - private function removeBoundaryDelimiter($setting) + private function removeBoundaryDelimiter($setting): string { return substr($setting, 1, -1); } diff --git a/src/bundle/Core/DependencyInjection/Configuration/Suggestion/Collector/SuggestionCollector.php b/src/bundle/Core/DependencyInjection/Configuration/Suggestion/Collector/SuggestionCollector.php index e03723c8e9..c6c98e949d 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/Suggestion/Collector/SuggestionCollector.php +++ b/src/bundle/Core/DependencyInjection/Configuration/Suggestion/Collector/SuggestionCollector.php @@ -37,7 +37,7 @@ public function getSuggestions() /** * @return bool */ - public function hasSuggestions() + public function hasSuggestions(): bool { return !empty($this->suggestions); } diff --git a/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php b/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php index e03d76950c..c12b9024a7 100644 --- a/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php +++ b/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php @@ -28,6 +28,7 @@ use Ibexa\Core\MVC\Symfony\Routing\ChainRouter; use Ibexa\Core\QueryType\QueryType; use InvalidArgumentException; +use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -85,7 +86,7 @@ public function __construct(array $siteAccessConfigParsers = [], array $reposito $this->suggestionCollector = new SuggestionCollector(); } - public function getAlias() + public function getAlias(): string { return self::EXTENSION_NAME; } @@ -168,12 +169,9 @@ public function load(array $configs, ContainerBuilder $container) } /** - * @param array $config - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container - * - * @return \Ibexa\Bundle\Core\DependencyInjection\Configuration + * @param array $config */ - public function getConfiguration(array $config, ContainerBuilder $container) + public function getConfiguration(array $config, ContainerBuilder $container): ConfigurationInterface { $configuration = new Configuration( $this->getMainConfigParser(), diff --git a/src/bundle/Core/DependencyInjection/Security/PolicyProvider/PoliciesConfigBuilder.php b/src/bundle/Core/DependencyInjection/Security/PolicyProvider/PoliciesConfigBuilder.php index d06af61da2..3cff590d2a 100644 --- a/src/bundle/Core/DependencyInjection/Security/PolicyProvider/PoliciesConfigBuilder.php +++ b/src/bundle/Core/DependencyInjection/Security/PolicyProvider/PoliciesConfigBuilder.php @@ -53,7 +53,7 @@ public function addResource(ResourceInterface $resource) * * @return bool */ - private function policyExists(array $policyMap, $module, $function) + private function policyExists(array $policyMap, $module, $function): bool { return array_key_exists($module, $policyMap) && array_key_exists($function, $policyMap[$module]); } diff --git a/src/bundle/Core/EventListener/BackgroundIndexingTerminateListener.php b/src/bundle/Core/EventListener/BackgroundIndexingTerminateListener.php index 3751246259..515d0cad0a 100644 --- a/src/bundle/Core/EventListener/BackgroundIndexingTerminateListener.php +++ b/src/bundle/Core/EventListener/BackgroundIndexingTerminateListener.php @@ -44,7 +44,7 @@ public function __construct(PersistenceHandler $persistenceHandler, SearchHandle $this->searchHandler = $searchHandler; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::TERMINATE => 'reindex', diff --git a/src/bundle/Core/EventListener/CacheViewResponseListener.php b/src/bundle/Core/EventListener/CacheViewResponseListener.php index ba3584f668..07104ce4a7 100644 --- a/src/bundle/Core/EventListener/CacheViewResponseListener.php +++ b/src/bundle/Core/EventListener/CacheViewResponseListener.php @@ -28,7 +28,7 @@ public function __construct(ConfigResolverInterface $configResolver) $this->configResolver = $configResolver; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [KernelEvents::RESPONSE => 'configureCache']; } diff --git a/src/bundle/Core/EventListener/ConfigScopeListener.php b/src/bundle/Core/EventListener/ConfigScopeListener.php index 728c96fc3a..f9c9088a47 100644 --- a/src/bundle/Core/EventListener/ConfigScopeListener.php +++ b/src/bundle/Core/EventListener/ConfigScopeListener.php @@ -34,7 +34,7 @@ public function __construct( $this->viewManager = $viewManager; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ MVCEvents::CONFIG_SCOPE_CHANGE => ['onConfigScopeChange', 100], diff --git a/src/bundle/Core/EventListener/ConsoleCommandListener.php b/src/bundle/Core/EventListener/ConsoleCommandListener.php index 3bb7bd5db9..a1b4cfba7b 100644 --- a/src/bundle/Core/EventListener/ConsoleCommandListener.php +++ b/src/bundle/Core/EventListener/ConsoleCommandListener.php @@ -46,7 +46,7 @@ public function __construct( $this->debug = $debug; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ ConsoleEvents::COMMAND => [ diff --git a/src/bundle/Core/EventListener/ContentDownloadRouteReferenceListener.php b/src/bundle/Core/EventListener/ContentDownloadRouteReferenceListener.php index 749f94d93b..16e269c4f1 100644 --- a/src/bundle/Core/EventListener/ContentDownloadRouteReferenceListener.php +++ b/src/bundle/Core/EventListener/ContentDownloadRouteReferenceListener.php @@ -37,7 +37,7 @@ public function __construct(TranslationHelper $translationHelper) $this->translationHelper = $translationHelper; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ MVCEvents::ROUTE_REFERENCE_GENERATION => 'onRouteReferenceGeneration', diff --git a/src/bundle/Core/EventListener/ExceptionListener.php b/src/bundle/Core/EventListener/ExceptionListener.php index 9664b5b562..9691d314c7 100644 --- a/src/bundle/Core/EventListener/ExceptionListener.php +++ b/src/bundle/Core/EventListener/ExceptionListener.php @@ -34,7 +34,7 @@ public function __construct(TranslatorInterface $translator) $this->translator = $translator; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::EXCEPTION => ['onKernelException', 10], diff --git a/src/bundle/Core/EventListener/IndexRequestListener.php b/src/bundle/Core/EventListener/IndexRequestListener.php index c76fca8211..3b76b42207 100644 --- a/src/bundle/Core/EventListener/IndexRequestListener.php +++ b/src/bundle/Core/EventListener/IndexRequestListener.php @@ -23,7 +23,7 @@ public function __construct(ConfigResolverInterface $configResolver) $this->configResolver = $configResolver; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::REQUEST => [ @@ -43,7 +43,7 @@ public function onKernelRequestIndex(RequestEvent $event) $request = $event->getRequest(); $semanticPathinfo = $request->attributes->get('semanticPathinfo') ?: '/'; if ( - $event->getRequestType() === HttpKernelInterface::MASTER_REQUEST + $event->getRequestType() === HttpKernelInterface::MAIN_REQUEST && $semanticPathinfo === '/' ) { $indexPage = $this->configResolver->getParameter('index_page'); diff --git a/src/bundle/Core/EventListener/OriginalRequestListener.php b/src/bundle/Core/EventListener/OriginalRequestListener.php index 9581201495..1dc2f5b5fe 100644 --- a/src/bundle/Core/EventListener/OriginalRequestListener.php +++ b/src/bundle/Core/EventListener/OriginalRequestListener.php @@ -19,7 +19,7 @@ */ class OriginalRequestListener implements EventSubscriberInterface { - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::REQUEST => ['onKernelRequest', 200], @@ -28,7 +28,7 @@ public static function getSubscribedEvents() public function onKernelRequest(RequestEvent $event) { - if ($event->getRequestType() !== HttpKernelInterface::MASTER_REQUEST) { + if ($event->getRequestType() !== HttpKernelInterface::MAIN_REQUEST) { return; } @@ -39,7 +39,7 @@ public function onKernelRequest(RequestEvent $event) $originalRequest = Request::create( $request->getSchemeAndHttpHost() . $request->headers->get('x-fos-original-url'), - 'GET', + Request::METHOD_GET, [], [], [], diff --git a/src/bundle/Core/EventListener/PreviewRequestListener.php b/src/bundle/Core/EventListener/PreviewRequestListener.php index 6698c1b171..2b752f1dd8 100644 --- a/src/bundle/Core/EventListener/PreviewRequestListener.php +++ b/src/bundle/Core/EventListener/PreviewRequestListener.php @@ -36,7 +36,7 @@ public static function getSubscribedEvents(): array */ public function onKernelRequest(RequestEvent $event): void { - if ($event->getRequestType() === HttpKernelInterface::MASTER_REQUEST) { + if ($event->getRequestType() === HttpKernelInterface::MAIN_REQUEST) { return; } diff --git a/src/bundle/Core/EventListener/RejectExplicitFrontControllerRequestsListener.php b/src/bundle/Core/EventListener/RejectExplicitFrontControllerRequestsListener.php index 530d545589..e16dc3c4b1 100644 --- a/src/bundle/Core/EventListener/RejectExplicitFrontControllerRequestsListener.php +++ b/src/bundle/Core/EventListener/RejectExplicitFrontControllerRequestsListener.php @@ -31,7 +31,7 @@ public static function getSubscribedEvents(): array public function onKernelRequest(RequestEvent $event) { - if ($event->getRequestType() !== HttpKernelInterface::MASTER_REQUEST) { + if ($event->getRequestType() !== HttpKernelInterface::MAIN_REQUEST) { return; } diff --git a/src/bundle/Core/EventListener/RequestEventListener.php b/src/bundle/Core/EventListener/RequestEventListener.php index 265c5a6211..2e9b1ca58a 100644 --- a/src/bundle/Core/EventListener/RequestEventListener.php +++ b/src/bundle/Core/EventListener/RequestEventListener.php @@ -14,6 +14,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; @@ -41,7 +42,7 @@ public function __construct(ConfigResolverInterface $configResolver, RouterInter $this->logger = $logger; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::REQUEST => [ @@ -56,7 +57,7 @@ public static function getSubscribedEvents() */ public function onKernelRequestForward(RequestEvent $event) { - if ($event->getRequestType() === HttpKernelInterface::MASTER_REQUEST) { + if ($event->getRequestType() === HttpKernelInterface::MAIN_REQUEST) { $request = $event->getRequest(); if ($request->attributes->get('needsForward') && $request->attributes->has('semanticPathinfo')) { $semanticPathinfo = $request->attributes->get('semanticPathinfo'); @@ -107,7 +108,7 @@ public function onKernelRequestForward(RequestEvent $event) */ public function onKernelRequestRedirect(RequestEvent $event) { - if ($event->getRequestType() == HttpKernelInterface::MASTER_REQUEST) { + if ($event->getRequestType() == HttpKernelInterface::MAIN_REQUEST) { $request = $event->getRequest(); if ($request->attributes->get('needsRedirect') && $request->attributes->has('semanticPathinfo')) { $siteaccess = $request->attributes->get('siteaccess'); @@ -128,7 +129,7 @@ public function onKernelRequestRedirect(RequestEvent $event) $event->setResponse( new RedirectResponse( $semanticPathinfo . ($queryString ? "?$queryString" : ''), - 301, + Response::HTTP_MOVED_PERMANENTLY, $headers ) ); diff --git a/src/bundle/Core/EventListener/RoutingListener.php b/src/bundle/Core/EventListener/RoutingListener.php index 87d391ca01..4bd5f241de 100644 --- a/src/bundle/Core/EventListener/RoutingListener.php +++ b/src/bundle/Core/EventListener/RoutingListener.php @@ -35,7 +35,7 @@ public function __construct(ConfigResolverInterface $configResolver, RouterInter $this->urlAliasGenerator = $urlAliasGenerator; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ MVCEvents::SITEACCESS => ['onSiteAccessMatch', 200], diff --git a/src/bundle/Core/EventListener/SessionInitByPostListener.php b/src/bundle/Core/EventListener/SessionInitByPostListener.php index d62615c5ec..590e9c40d6 100644 --- a/src/bundle/Core/EventListener/SessionInitByPostListener.php +++ b/src/bundle/Core/EventListener/SessionInitByPostListener.php @@ -18,7 +18,7 @@ */ class SessionInitByPostListener implements EventSubscriberInterface { - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ MVCEvents::SITEACCESS => ['onSiteAccessMatch', 249], diff --git a/src/bundle/Core/EventListener/SessionSetDynamicNameListener.php b/src/bundle/Core/EventListener/SessionSetDynamicNameListener.php index 6bc0ebf5c1..156596c995 100644 --- a/src/bundle/Core/EventListener/SessionSetDynamicNameListener.php +++ b/src/bundle/Core/EventListener/SessionSetDynamicNameListener.php @@ -44,7 +44,7 @@ public function __construct( $this->sessionStorageFactory = $sessionStorageFactory; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ MVCEvents::SITEACCESS => ['onSiteAccessMatch', 250], diff --git a/src/bundle/Core/EventListener/ViewControllerListener.php b/src/bundle/Core/EventListener/ViewControllerListener.php index c3437c5459..35a7d5a2a9 100644 --- a/src/bundle/Core/EventListener/ViewControllerListener.php +++ b/src/bundle/Core/EventListener/ViewControllerListener.php @@ -45,7 +45,7 @@ public function __construct( $this->logger = $logger; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [KernelEvents::CONTROLLER => ['getController', 10]]; } diff --git a/src/bundle/Core/EventListener/ViewRendererListener.php b/src/bundle/Core/EventListener/ViewRendererListener.php index 53b95658aa..0693f9082b 100644 --- a/src/bundle/Core/EventListener/ViewRendererListener.php +++ b/src/bundle/Core/EventListener/ViewRendererListener.php @@ -24,7 +24,7 @@ public function __construct(ViewRenderer $viewRenderer) $this->viewRenderer = $viewRenderer; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [KernelEvents::VIEW => 'renderView']; } diff --git a/src/bundle/Core/EventSubscriber/CrowdinRequestLocaleSubscriber.php b/src/bundle/Core/EventSubscriber/CrowdinRequestLocaleSubscriber.php index 5ca68d08d2..de2e7ce860 100644 --- a/src/bundle/Core/EventSubscriber/CrowdinRequestLocaleSubscriber.php +++ b/src/bundle/Core/EventSubscriber/CrowdinRequestLocaleSubscriber.php @@ -17,7 +17,7 @@ */ class CrowdinRequestLocaleSubscriber implements EventSubscriberInterface { - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::REQUEST => [ diff --git a/src/bundle/Core/Features/Context/BasicContentContext.php b/src/bundle/Core/Features/Context/BasicContentContext.php index f114182562..162b001192 100644 --- a/src/bundle/Core/Features/Context/BasicContentContext.php +++ b/src/bundle/Core/Features/Context/BasicContentContext.php @@ -179,7 +179,7 @@ public function createArticleDraft($path) return $this->createContentDraft(2, 'article', $fields); } - private function getTitleFromPath($path) + private function getTitleFromPath($path): string { $parts = explode('/', rtrim($path, '/')); @@ -189,7 +189,7 @@ private function getTitleFromPath($path) /** * @return string */ - private function getDummyXmlText() + private function getDummyXmlText(): string { return '
This is a paragraph.
'; } diff --git a/src/bundle/Core/Features/Context/ContentPreviewContext.php b/src/bundle/Core/Features/Context/ContentPreviewContext.php index 398adf72ca..3cca9f2984 100644 --- a/src/bundle/Core/Features/Context/ContentPreviewContext.php +++ b/src/bundle/Core/Features/Context/ContentPreviewContext.php @@ -50,7 +50,7 @@ public function iPreviewThisDraft() /** * @return string */ - private function mapToVersionViewUri(VersionInfo $version) + private function mapToVersionViewUri(VersionInfo $version): string { return sprintf( '/content/versionview/%s/%s/%s', diff --git a/src/bundle/Core/Features/Context/ContentTypeContext.php b/src/bundle/Core/Features/Context/ContentTypeContext.php index 7d0b3328ad..7d3dda7fef 100644 --- a/src/bundle/Core/Features/Context/ContentTypeContext.php +++ b/src/bundle/Core/Features/Context/ContentTypeContext.php @@ -224,7 +224,7 @@ protected function assignContentGroupTypeToContentType($contentType, $contentTyp * * @return bool */ - protected function checkContentTypeExistenceByIdentifier($identifier, $groupIdentifier = null) + protected function checkContentTypeExistenceByIdentifier($identifier, $groupIdentifier = null): bool { $contentType = $this->loadContentTypeByIdentifier($identifier, false); if ($contentType && $groupIdentifier) { diff --git a/src/bundle/Core/Features/Context/UserContext.php b/src/bundle/Core/Features/Context/UserContext.php index 8bb1659968..3d2bc860a6 100644 --- a/src/bundle/Core/Features/Context/UserContext.php +++ b/src/bundle/Core/Features/Context/UserContext.php @@ -260,7 +260,7 @@ public function ensureUserDoesntExist($username, $parentGroupName = null) * * @return bool true if it exists, false if user or group don't exist */ - public function checkUserExistenceByUsername($username, $parentGroupName = null) + public function checkUserExistenceByUsername($username, $parentGroupName = null): bool { if ($parentGroupName) { // find parent group name @@ -286,7 +286,7 @@ public function checkUserExistenceByUsername($username, $parentGroupName = null) * * @return bool true if it exists, false if not */ - public function checkUserExistenceByEmail($email, $parentGroupName = null) + public function checkUserExistenceByEmail($email, $parentGroupName = null): bool { $existingUsers = $this->userService->loadUsersByEmail($email); if (count($existingUsers) == 0) { diff --git a/src/bundle/Core/Imagine/AliasGenerator.php b/src/bundle/Core/Imagine/AliasGenerator.php index 5f8d3c2e0e..41f51896ec 100644 --- a/src/bundle/Core/Imagine/AliasGenerator.php +++ b/src/bundle/Core/Imagine/AliasGenerator.php @@ -161,7 +161,7 @@ private function applyFilter(BinaryInterface $image, $variationName) return $this->filterManager->applyFilter($image, $variationName); } - public function supportsValue(Value $value) + public function supportsValue(Value $value): bool { return $value instanceof ImageValue; } diff --git a/src/bundle/Core/Imagine/Cache/AliasGeneratorDecorator.php b/src/bundle/Core/Imagine/Cache/AliasGeneratorDecorator.php index 9421529e86..f786489239 100644 --- a/src/bundle/Core/Imagine/Cache/AliasGeneratorDecorator.php +++ b/src/bundle/Core/Imagine/Cache/AliasGeneratorDecorator.php @@ -101,7 +101,7 @@ public function setSiteAccess(SiteAccess $siteAccess = null) * * @return string */ - private function getCacheKey(Field $field, VersionInfo $versionInfo, $variationName) + private function getCacheKey(Field $field, VersionInfo $versionInfo, $variationName): string { return sprintf( $this->cacheIdentifierGenerator->generateKey(self::IMAGE_VARIATION_IDENTIFIER, [], true) . '-%s-%s-%s-%d-%d-%d-%s-%s', diff --git a/src/bundle/Core/Imagine/VariationPathGenerator/AliasDirectoryVariationPathGenerator.php b/src/bundle/Core/Imagine/VariationPathGenerator/AliasDirectoryVariationPathGenerator.php index 9f58757065..7d2bfcc99a 100644 --- a/src/bundle/Core/Imagine/VariationPathGenerator/AliasDirectoryVariationPathGenerator.php +++ b/src/bundle/Core/Imagine/VariationPathGenerator/AliasDirectoryVariationPathGenerator.php @@ -17,7 +17,7 @@ */ class AliasDirectoryVariationPathGenerator implements VariationPathGenerator { - public function getVariationPath($originalPath, $filter) + public function getVariationPath($originalPath, $filter): string { $info = pathinfo($originalPath); diff --git a/src/bundle/Core/Imagine/VariationPathGenerator/OriginalDirectoryVariationPathGenerator.php b/src/bundle/Core/Imagine/VariationPathGenerator/OriginalDirectoryVariationPathGenerator.php index 702f34dff0..739ca950d1 100644 --- a/src/bundle/Core/Imagine/VariationPathGenerator/OriginalDirectoryVariationPathGenerator.php +++ b/src/bundle/Core/Imagine/VariationPathGenerator/OriginalDirectoryVariationPathGenerator.php @@ -17,7 +17,7 @@ */ class OriginalDirectoryVariationPathGenerator implements VariationPathGenerator { - public function getVariationPath($originalPath, $filter) + public function getVariationPath($originalPath, $filter): string { $info = pathinfo($originalPath); diff --git a/src/bundle/Core/Routing/DefaultRouter.php b/src/bundle/Core/Routing/DefaultRouter.php index 3b081ebc4c..a10f2dea5b 100644 --- a/src/bundle/Core/Routing/DefaultRouter.php +++ b/src/bundle/Core/Routing/DefaultRouter.php @@ -139,7 +139,7 @@ public function generate($name, $parameters = [], $referenceType = self::ABSOLUT * * @return bool */ - protected function isSiteAccessAwareRoute($routeName) + protected function isSiteAccessAwareRoute($routeName): bool { foreach ($this->nonSiteAccessAwareRoutes as $ignoredPrefix) { if (strpos($routeName, $ignoredPrefix) === 0) { diff --git a/src/bundle/Core/URLChecker/Handler/HTTPHandler.php b/src/bundle/Core/URLChecker/Handler/HTTPHandler.php index f8b91b1fac..34e6ddd5f2 100644 --- a/src/bundle/Core/URLChecker/Handler/HTTPHandler.php +++ b/src/bundle/Core/URLChecker/Handler/HTTPHandler.php @@ -153,7 +153,7 @@ private function doValidate(URL $url, $handler) $this->setUrlStatus($url, $this->isSuccessful(curl_getinfo($handler, CURLINFO_HTTP_CODE))); } - private function isSuccessful($statusCode) + private function isSuccessful($statusCode): bool { return $statusCode >= 200 && $statusCode < 300; } diff --git a/src/bundle/Core/URLChecker/URLHandlerRegistry.php b/src/bundle/Core/URLChecker/URLHandlerRegistry.php index 4a256eab0a..b34b6e98aa 100644 --- a/src/bundle/Core/URLChecker/URLHandlerRegistry.php +++ b/src/bundle/Core/URLChecker/URLHandlerRegistry.php @@ -33,7 +33,7 @@ public function addHandler($scheme, URLHandlerInterface $handler) /** * {@inheritdoc} */ - public function supported($scheme) + public function supported($scheme): bool { return isset($this->handlers[$scheme]); } diff --git a/src/bundle/Debug/Collector/IbexaCoreCollector.php b/src/bundle/Debug/Collector/IbexaCoreCollector.php index 842a9fe500..5500125642 100644 --- a/src/bundle/Debug/Collector/IbexaCoreCollector.php +++ b/src/bundle/Debug/Collector/IbexaCoreCollector.php @@ -28,7 +28,7 @@ public function collect(Request $request, Response $response, \Throwable $except } } - public function getName() + public function getName(): string { return 'ezpublish.debug.toolbar'; } diff --git a/src/bundle/Debug/Collector/PersistenceCacheCollector.php b/src/bundle/Debug/Collector/PersistenceCacheCollector.php index f16599035d..3ae2a39c6e 100644 --- a/src/bundle/Debug/Collector/PersistenceCacheCollector.php +++ b/src/bundle/Debug/Collector/PersistenceCacheCollector.php @@ -35,7 +35,7 @@ public function collect(Request $request, Response $response, \Throwable $except ]; } - public function getName() + public function getName(): string { return 'ezpublish.debug.persistence'; } diff --git a/src/bundle/Debug/Collector/SiteAccessCollector.php b/src/bundle/Debug/Collector/SiteAccessCollector.php index 7b061065f3..9f10a20dc3 100644 --- a/src/bundle/Debug/Collector/SiteAccessCollector.php +++ b/src/bundle/Debug/Collector/SiteAccessCollector.php @@ -24,7 +24,7 @@ public function collect(Request $request, Response $response, \Throwable $except ]; } - public function getName() + public function getName(): string { return 'ezpublish.debug.siteaccess'; } diff --git a/src/bundle/IO/BinaryStreamResponse.php b/src/bundle/IO/BinaryStreamResponse.php index 9bc3011499..cf1fc82bbe 100644 --- a/src/bundle/IO/BinaryStreamResponse.php +++ b/src/bundle/IO/BinaryStreamResponse.php @@ -171,12 +171,12 @@ public function prepare(Request $request) if ($start <= $end) { if ($start < 0 || $end > $fileSize - 1) { - $this->setStatusCode(416); // HTTP_REQUESTED_RANGE_NOT_SATISFIABLE + $this->setStatusCode(Response::HTTP_REQUESTED_RANGE_NOT_SATISFIABLE); // HTTP_REQUESTED_RANGE_NOT_SATISFIABLE } elseif ($start !== 0 || $end !== $fileSize - 1) { $this->maxlen = $end < $fileSize ? $end - $start + 1 : -1; $this->offset = $start; - $this->setStatusCode(206); // HTTP_PARTIAL_CONTENT + $this->setStatusCode(Response::HTTP_PARTIAL_CONTENT); // HTTP_PARTIAL_CONTENT $this->headers->set('Content-Range', sprintf('bytes %s-%s/%s', $start, $end, $fileSize)); $this->headers->set('Content-Length', $end - $start + 1); } diff --git a/src/bundle/IO/Command/MigrateFilesCommand.php b/src/bundle/IO/Command/MigrateFilesCommand.php index be56dc3656..438520952a 100644 --- a/src/bundle/IO/Command/MigrateFilesCommand.php +++ b/src/bundle/IO/Command/MigrateFilesCommand.php @@ -18,6 +18,10 @@ final class MigrateFilesCommand extends Command { + protected static $defaultName = 'ibexa:io:migrate-files'; + + protected static $defaultDescription = 'Migrates files from one IO repository to another'; + /** @var mixed Configuration for metadata handlers */ private $configuredMetadataHandlers; @@ -61,8 +65,6 @@ public function __construct( protected function configure() { $this - ->setName('ibexa:io:migrate-files') - ->setDescription('Migrates files from one IO repository to another') ->addOption('from', null, InputOption::VALUE_REQUIRED, 'Migrate from ,') ->addOption('to', null, InputOption::VALUE_REQUIRED, 'Migrate to ,') ->addOption('list-io-handlers', null, InputOption::VALUE_NONE, 'List available IO handlers') @@ -96,14 +98,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($input->getOption('list-io-handlers')) { $this->outputConfiguredHandlers($output); - return 0; + return self::SUCCESS; } $bulkCount = (int)$input->getOption('bulk-count'); if ($bulkCount < 1) { $output->writeln('The value for --bulk-count must be a positive integer.'); - return 0; + return self::SUCCESS; } $output->writeln($this->getProcessedHelp()); @@ -122,7 +124,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } if (!$this->validateHandlerOptions($fromHandlers, $toHandlers, $output)) { - return 0; + return self::SUCCESS; } $output->writeln([ @@ -157,7 +159,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($totalCount === 0) { $output->writeln('Nothing to process.'); - return 0; + return self::SUCCESS; } if (!$input->getOption('no-interaction')) { @@ -170,7 +172,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (!$helper->ask($input, $output, $question)) { $output->writeln('Aborting.'); - return 0; + return self::SUCCESS; } } @@ -181,7 +183,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output ); - return 0; + return self::SUCCESS; } /** @@ -212,7 +214,7 @@ protected function validateHandlerOptions( $fromHandlers, $toHandlers, OutputInterface $output - ) { + ): bool { foreach (['From' => $fromHandlers, 'To' => $toHandlers] as $direction => $handlers) { $lowerDirection = strtolower($direction); if (count($handlers) !== 2) { diff --git a/src/bundle/IO/DependencyInjection/Configuration.php b/src/bundle/IO/DependencyInjection/Configuration.php index 6b51c4429d..d3f4e09a85 100644 --- a/src/bundle/IO/DependencyInjection/Configuration.php +++ b/src/bundle/IO/DependencyInjection/Configuration.php @@ -30,7 +30,7 @@ public function setBinarydataHandlerFactories(ArrayObject $factories) $this->binarydataHandlerFactories = $factories; } - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder(IbexaIOExtension::EXTENSION_NAME); diff --git a/src/bundle/IO/DependencyInjection/ConfigurationFactory/BinarydataHandler/Flysystem.php b/src/bundle/IO/DependencyInjection/ConfigurationFactory/BinarydataHandler/Flysystem.php index 5d6d3bd740..617de5a2de 100644 --- a/src/bundle/IO/DependencyInjection/ConfigurationFactory/BinarydataHandler/Flysystem.php +++ b/src/bundle/IO/DependencyInjection/ConfigurationFactory/BinarydataHandler/Flysystem.php @@ -11,7 +11,7 @@ class Flysystem extends BaseFactory { - public function getParentServiceId() + public function getParentServiceId(): string { return 'ibexa.core.io.binarydata_handler.flysystem'; } diff --git a/src/bundle/IO/DependencyInjection/ConfigurationFactory/Flysystem.php b/src/bundle/IO/DependencyInjection/ConfigurationFactory/Flysystem.php index 34bf3812fe..a44a8f4243 100644 --- a/src/bundle/IO/DependencyInjection/ConfigurationFactory/Flysystem.php +++ b/src/bundle/IO/DependencyInjection/ConfigurationFactory/Flysystem.php @@ -60,7 +60,7 @@ public function configureHandler(ServiceDefinition $definition, array $config) * * @return string */ - private function createFilesystem(ContainerBuilder $container, $name, $adapter) + private function createFilesystem(ContainerBuilder $container, $name, $adapter): string { $adapterId = sprintf('oneup_flysystem.%s_adapter', $adapter); // has either definition or alias diff --git a/src/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/Flysystem.php b/src/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/Flysystem.php index f0c2f999cc..3f9cfe6318 100644 --- a/src/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/Flysystem.php +++ b/src/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/Flysystem.php @@ -11,7 +11,7 @@ class Flysystem extends BaseFactory { - public function getParentServiceId() + public function getParentServiceId(): string { return 'ibexa.core.io.metadata_handler.flysystem'; } diff --git a/src/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/LegacyDFSCluster.php b/src/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/LegacyDFSCluster.php index 02b5095963..5d37b68e20 100644 --- a/src/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/LegacyDFSCluster.php +++ b/src/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/LegacyDFSCluster.php @@ -14,7 +14,7 @@ class LegacyDFSCluster implements ConfigurationFactory { - public function getParentServiceId() + public function getParentServiceId(): string { return \Ibexa\Core\IO\IOMetadataHandler\LegacyDFSCluster::class; } diff --git a/src/bundle/IO/DependencyInjection/IbexaIOExtension.php b/src/bundle/IO/DependencyInjection/IbexaIOExtension.php index 54eded7d7a..27031f8230 100644 --- a/src/bundle/IO/DependencyInjection/IbexaIOExtension.php +++ b/src/bundle/IO/DependencyInjection/IbexaIOExtension.php @@ -8,6 +8,7 @@ namespace Ibexa\Bundle\IO\DependencyInjection; use ArrayObject; +use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -73,7 +74,7 @@ public function getBinarydataHandlerFactories() return $this->binarydataHandlerFactories; } - public function getAlias() + public function getAlias(): string { return self::EXTENSION_NAME; } @@ -119,7 +120,7 @@ private function processHandlers(ContainerBuilder $container, $config, $key) $container->setParameter("ibexa.io.{$key}", $handlers); } - public function getConfiguration(array $config, ContainerBuilder $container) + public function getConfiguration(array $config, ContainerBuilder $container): ?ConfigurationInterface { $configuration = new Configuration(); $configuration->setMetadataHandlerFactories($this->getMetadataHandlerFactories()); diff --git a/src/bundle/IO/EventListener/StreamFileListener.php b/src/bundle/IO/EventListener/StreamFileListener.php index 0e6391f8ca..0a8a740c86 100644 --- a/src/bundle/IO/EventListener/StreamFileListener.php +++ b/src/bundle/IO/EventListener/StreamFileListener.php @@ -34,7 +34,7 @@ public function __construct(IOServiceInterface $ioService, IOConfigProvider $ioC $this->ioConfigResolver = $ioConfigResolver; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::REQUEST => ['onKernelRequest', 42], @@ -43,7 +43,7 @@ public static function getSubscribedEvents() public function onKernelRequest(RequestEvent $event) { - if ($event->getRequestType() !== HttpKernelInterface::MASTER_REQUEST) { + if ($event->getRequestType() !== HttpKernelInterface::MAIN_REQUEST) { return; } @@ -82,7 +82,7 @@ public function onKernelRequest(RequestEvent $event) * * @return bool */ - private function isIoUri($uri, $urlPrefix) + private function isIoUri($uri, $urlPrefix): bool { return strpos(ltrim($uri, '/'), $urlPrefix) === 0; } diff --git a/src/bundle/IO/IbexaIOBundle.php b/src/bundle/IO/IbexaIOBundle.php index d0fa03daef..cba5911556 100644 --- a/src/bundle/IO/IbexaIOBundle.php +++ b/src/bundle/IO/IbexaIOBundle.php @@ -11,6 +11,7 @@ use Ibexa\Bundle\IO\DependencyInjection\ConfigurationFactory; use Ibexa\Bundle\IO\DependencyInjection\IbexaIOExtension; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; use Symfony\Component\HttpKernel\Bundle\Bundle; class IbexaIOBundle extends Bundle @@ -31,7 +32,7 @@ public function build(ContainerBuilder $container) parent::build($container); } - public function getContainerExtension() + public function getContainerExtension(): ?ExtensionInterface { if (!isset($this->extension)) { $this->extension = new IbexaIOExtension(); diff --git a/src/bundle/IO/Migration/FileLister/BinaryFileLister.php b/src/bundle/IO/Migration/FileLister/BinaryFileLister.php index 5167339c1d..c040beef7d 100644 --- a/src/bundle/IO/Migration/FileLister/BinaryFileLister.php +++ b/src/bundle/IO/Migration/FileLister/BinaryFileLister.php @@ -45,7 +45,7 @@ public function __construct( parent::__construct($metadataHandlerRegistry, $binarydataHandlerRegistry, $logger); } - public function countFiles() + public function countFiles(): int { return count($this->fileList); } diff --git a/src/bundle/IO/Migration/FileLister/FileRowReader/LegacyStorageBinaryFileRowReader.php b/src/bundle/IO/Migration/FileLister/FileRowReader/LegacyStorageBinaryFileRowReader.php index 1ab91ed65e..2fa5934259 100644 --- a/src/bundle/IO/Migration/FileLister/FileRowReader/LegacyStorageBinaryFileRowReader.php +++ b/src/bundle/IO/Migration/FileLister/FileRowReader/LegacyStorageBinaryFileRowReader.php @@ -14,7 +14,7 @@ final class LegacyStorageBinaryFileRowReader extends LegacyStorageFileRowReader * * @return string */ - protected function getStorageTable() + protected function getStorageTable(): string { return 'ezbinaryfile'; } diff --git a/src/bundle/IO/Migration/FileLister/FileRowReader/LegacyStorageFileRowReader.php b/src/bundle/IO/Migration/FileLister/FileRowReader/LegacyStorageFileRowReader.php index f8100f4493..c68d4bf697 100644 --- a/src/bundle/IO/Migration/FileLister/FileRowReader/LegacyStorageFileRowReader.php +++ b/src/bundle/IO/Migration/FileLister/FileRowReader/LegacyStorageFileRowReader.php @@ -59,7 +59,7 @@ final public function getCount() * * @return string */ - private function prependMimeToPath($path, $mimeType) + private function prependMimeToPath($path, $mimeType): string { return substr($mimeType, 0, strpos($mimeType, '/')) . '/' . $path; } diff --git a/src/bundle/IO/Migration/FileLister/FileRowReader/LegacyStorageMediaFileRowReader.php b/src/bundle/IO/Migration/FileLister/FileRowReader/LegacyStorageMediaFileRowReader.php index ad61ffc1fe..fec7b176cc 100644 --- a/src/bundle/IO/Migration/FileLister/FileRowReader/LegacyStorageMediaFileRowReader.php +++ b/src/bundle/IO/Migration/FileLister/FileRowReader/LegacyStorageMediaFileRowReader.php @@ -14,7 +14,7 @@ final class LegacyStorageMediaFileRowReader extends LegacyStorageFileRowReader * * @return string */ - protected function getStorageTable() + protected function getStorageTable(): string { return 'ezmedia'; } diff --git a/src/bundle/IO/Migration/FileLister/ImageFileLister.php b/src/bundle/IO/Migration/FileLister/ImageFileLister.php index faa463ac54..da3e9c02e8 100644 --- a/src/bundle/IO/Migration/FileLister/ImageFileLister.php +++ b/src/bundle/IO/Migration/FileLister/ImageFileLister.php @@ -59,7 +59,7 @@ public function __construct( parent::__construct($metadataHandlerRegistry, $binarydataHandlerRegistry, $logger); } - public function countFiles() + public function countFiles(): int { return count($this->imageFileList); } diff --git a/src/bundle/IO/Migration/FileListerRegistry/ConfigurableRegistry.php b/src/bundle/IO/Migration/FileListerRegistry/ConfigurableRegistry.php index c4b008e31c..f1518b998a 100644 --- a/src/bundle/IO/Migration/FileListerRegistry/ConfigurableRegistry.php +++ b/src/bundle/IO/Migration/FileListerRegistry/ConfigurableRegistry.php @@ -49,7 +49,7 @@ public function getItem($identifier) * * @return string[] Array of identifier strings. */ - public function getIdentifiers() + public function getIdentifiers(): array { return array_keys($this->registry); } diff --git a/src/bundle/IO/Migration/FileMigrator/FileMigrator.php b/src/bundle/IO/Migration/FileMigrator/FileMigrator.php index 09ebabe0cc..4440f6cf1d 100644 --- a/src/bundle/IO/Migration/FileMigrator/FileMigrator.php +++ b/src/bundle/IO/Migration/FileMigrator/FileMigrator.php @@ -15,7 +15,7 @@ final class FileMigrator extends MigrationHandler implements FileMigratorInterface { - public function migrateFile(BinaryFile $binaryFile) + public function migrateFile(BinaryFile $binaryFile): bool { if (!$this->migrateBinaryFile($binaryFile) || !$this->migrateMetadata($binaryFile)) { return false; diff --git a/src/bundle/LegacySearchEngine/DependencyInjection/IbexaLegacySearchEngineExtension.php b/src/bundle/LegacySearchEngine/DependencyInjection/IbexaLegacySearchEngineExtension.php index fdbaa0dce1..8369d672ab 100644 --- a/src/bundle/LegacySearchEngine/DependencyInjection/IbexaLegacySearchEngineExtension.php +++ b/src/bundle/LegacySearchEngine/DependencyInjection/IbexaLegacySearchEngineExtension.php @@ -14,7 +14,7 @@ class IbexaLegacySearchEngineExtension extends Extension { - public function getAlias() + public function getAlias(): string { return 'ibexa_legacy_search_engine'; } diff --git a/src/bundle/LegacySearchEngine/IbexaLegacySearchEngineBundle.php b/src/bundle/LegacySearchEngine/IbexaLegacySearchEngineBundle.php index e9ce3e7ab3..dd452de200 100644 --- a/src/bundle/LegacySearchEngine/IbexaLegacySearchEngineBundle.php +++ b/src/bundle/LegacySearchEngine/IbexaLegacySearchEngineBundle.php @@ -12,6 +12,7 @@ use Ibexa\Core\Base\Container\Compiler\Search\Legacy\CriterionFieldValueHandlerRegistryPass; use Ibexa\Core\Base\Container\Compiler\Search\Legacy\SortClauseConverterPass; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; use Symfony\Component\HttpKernel\Bundle\Bundle; class IbexaLegacySearchEngineBundle extends Bundle @@ -26,7 +27,7 @@ public function build(ContainerBuilder $container) $container->addCompilerPass(new FieldRegistryPass()); } - public function getContainerExtension() + public function getContainerExtension(): ?ExtensionInterface { if (!isset($this->extension)) { $this->extension = new DependencyInjection\IbexaLegacySearchEngineExtension(); diff --git a/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php b/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php index a754a96419..2d6d606176 100644 --- a/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php +++ b/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php @@ -22,6 +22,13 @@ final class InstallPlatformCommand extends Command { + public const int EXIT_GENERAL_DATABASE_ERROR = 4; + public const int EXIT_PARAMETERS_NOT_FOUND = 5; + public const int EXIT_UNKNOWN_INSTALL_TYPE = 6; + public const int EXIT_MISSING_PERMISSIONS = 7; + + protected static $defaultName = 'ibexa:install'; + /** @var \Doctrine\DBAL\Connection */ private $connection; @@ -39,11 +46,6 @@ final class InstallPlatformCommand extends Command private RepositoryConfigurationProviderInterface $repositoryConfigurationProvider; - public const EXIT_GENERAL_DATABASE_ERROR = 4; - public const EXIT_PARAMETERS_NOT_FOUND = 5; - public const EXIT_UNKNOWN_INSTALL_TYPE = 6; - public const EXIT_MISSING_PERMISSIONS = 7; - public function __construct( Connection $connection, array $installers, @@ -61,8 +63,6 @@ public function __construct( protected function configure() { - $this->setName('ibexa:install'); - $this->addArgument( 'type', InputArgument::OPTIONAL, @@ -88,7 +88,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (!empty($schemaManager->listTables())) { $io = new SymfonyStyle($input, $output); if (!$io->confirm('Running this command will delete data in all Ibexa generated tables. Continue?')) { - return 0; + return self::SUCCESS; } } @@ -114,7 +114,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->indexData($output, $siteaccess); } - return 0; + return self::SUCCESS; } private function checkPermissions() diff --git a/src/bundle/RepositoryInstaller/Command/ValidatePasswordHashesCommand.php b/src/bundle/RepositoryInstaller/Command/ValidatePasswordHashesCommand.php index d077dbe4fc..f73a9d7443 100644 --- a/src/bundle/RepositoryInstaller/Command/ValidatePasswordHashesCommand.php +++ b/src/bundle/RepositoryInstaller/Command/ValidatePasswordHashesCommand.php @@ -15,6 +15,8 @@ final class ValidatePasswordHashesCommand extends Command { + protected static $defaultName = 'ibexa:user:validate-password-hashes'; + /** @var \Ibexa\Core\FieldType\User\UserStorage */ private $userStorage; @@ -31,11 +33,6 @@ public function __construct( parent::__construct(); } - protected function configure() - { - $this->setName('ibexa:user:validate-password-hashes'); - } - protected function execute(InputInterface $input, OutputInterface $output): int { $unsupportedHashesCounter = $this->userStorage->countUsersWithUnsupportedHashType( @@ -49,6 +46,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln('OK - All users have supported password hash types'); } - return Command::SUCCESS; + return self::SUCCESS; } } diff --git a/src/contracts/Persistence/Filter/Doctrine/FilteringQueryBuilder.php b/src/contracts/Persistence/Filter/Doctrine/FilteringQueryBuilder.php index c4a8551543..58ac699220 100644 --- a/src/contracts/Persistence/Filter/Doctrine/FilteringQueryBuilder.php +++ b/src/contracts/Persistence/Filter/Doctrine/FilteringQueryBuilder.php @@ -107,7 +107,7 @@ public function getExistingTableAliasJoinCondition(string $tableAlias): ?string $existingTableAliasJoins = array_values( array_filter( $joins, - static function (array $joinData) use ($tableAlias) { + static function (array $joinData) use ($tableAlias): bool { return $joinData['joinAlias'] === $tableAlias; } ) diff --git a/src/contracts/Repository/Values/Content/Query/Criterion.php b/src/contracts/Repository/Values/Content/Query/Criterion.php index 1de7f59100..1f1215cf04 100644 --- a/src/contracts/Repository/Values/Content/Query/Criterion.php +++ b/src/contracts/Repository/Values/Content/Query/Criterion.php @@ -154,23 +154,23 @@ abstract public function getSpecifications(): array; */ private function getValueTypeCheckCallback(int $valueTypes): callable { - $callback = static function ($value) { + $callback = static function ($value): bool { return false; }; // the callback code will return true as soon as an accepted value type is found if ($valueTypes & Specifications::TYPE_INTEGER) { - $callback = static function ($value) use ($callback) { + $callback = static function ($value) use ($callback): bool { return is_numeric($value) || $callback($value); }; } if ($valueTypes & Specifications::TYPE_STRING) { - $callback = static function ($value) use ($callback) { + $callback = static function ($value) use ($callback): bool { return is_string($value) || $callback($value); }; } if ($valueTypes & Specifications::TYPE_BOOLEAN) { - $callback = static function ($value) use ($callback) { + $callback = static function ($value) use ($callback): bool { return is_bool($value) || $callback($value); }; } diff --git a/src/contracts/Test/Persistence/Fixture/FixtureImporter.php b/src/contracts/Test/Persistence/Fixture/FixtureImporter.php index a59e65a1fe..dbe36f34e2 100644 --- a/src/contracts/Test/Persistence/Fixture/FixtureImporter.php +++ b/src/contracts/Test/Persistence/Fixture/FixtureImporter.php @@ -45,7 +45,7 @@ public function import(Fixture $fixture): void $nonEmptyTablesData = array_filter( $data, - static function ($tableData) { + static function ($tableData): bool { return !empty($tableData); } ); diff --git a/src/lib/Base/Exceptions/UserPasswordValidationException.php b/src/lib/Base/Exceptions/UserPasswordValidationException.php index a3ab00e35b..71061e252a 100644 --- a/src/lib/Base/Exceptions/UserPasswordValidationException.php +++ b/src/lib/Base/Exceptions/UserPasswordValidationException.php @@ -22,7 +22,7 @@ class UserPasswordValidationException extends InvalidArgumentException */ public function __construct(string $argumentName, array $errors, Exception $previous = null) { - $rules = array_map(static function (ValidationError $error) { + $rules = array_map(static function (ValidationError $error): string { return (string) $error->getTranslatableMessage(); }, $errors); diff --git a/src/lib/Base/TranslatableBase.php b/src/lib/Base/TranslatableBase.php index 421429060b..d77971497b 100644 --- a/src/lib/Base/TranslatableBase.php +++ b/src/lib/Base/TranslatableBase.php @@ -46,7 +46,7 @@ public function getParameters() return $this->parameters; } - public function getBaseTranslation() + public function getBaseTranslation(): string { return strtr($this->messageTemplate, $this->parameters); } diff --git a/src/lib/FieldType/Author/SearchField.php b/src/lib/FieldType/Author/SearchField.php index a9e28c4381..ea1615bd8a 100644 --- a/src/lib/FieldType/Author/SearchField.php +++ b/src/lib/FieldType/Author/SearchField.php @@ -96,7 +96,7 @@ public function getIndexDefinition() * * @return string */ - public function getDefaultMatchField() + public function getDefaultMatchField(): string { return 'name'; } @@ -110,7 +110,7 @@ public function getDefaultMatchField() * * @return string */ - public function getDefaultSortField() + public function getDefaultSortField(): string { return 'sort_value'; } diff --git a/src/lib/FieldType/Author/Type.php b/src/lib/FieldType/Author/Type.php index 87d3412456..5fa7348ecf 100644 --- a/src/lib/FieldType/Author/Type.php +++ b/src/lib/FieldType/Author/Type.php @@ -21,6 +21,8 @@ * * Field type representing a list of authors, consisting of author name, and * author email. + * + * @phpstan-type TAuthorHash list */ class Type extends FieldType implements TranslationContainerInterface { @@ -48,7 +50,7 @@ class Type extends FieldType implements TranslationContainerInterface * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezauthor'; } @@ -123,9 +125,9 @@ protected function getSortInfo(BaseValue $value) } /** - * Converts an $hash to the Value defined by the field type. + * Converts a $hash to the Value defined by the field type. * - * @param mixed $hash + * @phpstan-param TAuthorHash $hash * * @return \Ibexa\Core\FieldType\Author\Value $value */ @@ -146,9 +148,9 @@ static function ($author) { * * @param \Ibexa\Core\FieldType\Author\Value $value * - * @return mixed + * @phpstan-return TAuthorHash */ - public function toHash(SPIValue $value) + public function toHash(SPIValue $value): array { return array_map( static function ($author) { @@ -163,7 +165,7 @@ static function ($author) { * * @return bool */ - public function isSearchable() + public function isSearchable(): bool { return true; } diff --git a/src/lib/FieldType/BinaryBase/BinaryBaseStorage.php b/src/lib/FieldType/BinaryBase/BinaryBaseStorage.php index 7fa52f9c68..e60f6b35f8 100644 --- a/src/lib/FieldType/BinaryBase/BinaryBaseStorage.php +++ b/src/lib/FieldType/BinaryBase/BinaryBaseStorage.php @@ -205,7 +205,8 @@ public function hasFieldData() return true; } - public function getIndexData(VersionInfo $versionInfo, Field $field, array $context) + public function getIndexData(VersionInfo $versionInfo, Field $field, array $context): array { + return []; } } diff --git a/src/lib/FieldType/BinaryBase/PathGenerator/LegacyPathGenerator.php b/src/lib/FieldType/BinaryBase/PathGenerator/LegacyPathGenerator.php index e8e60f0c1f..46f6d1fcae 100644 --- a/src/lib/FieldType/BinaryBase/PathGenerator/LegacyPathGenerator.php +++ b/src/lib/FieldType/BinaryBase/PathGenerator/LegacyPathGenerator.php @@ -13,7 +13,7 @@ class LegacyPathGenerator extends PathGenerator { - public function getStoragePathForField(Field $field, VersionInfo $versionInfo) + public function getStoragePathForField(Field $field, VersionInfo $versionInfo): string { $extension = pathinfo($field->value->externalData['fileName'], PATHINFO_EXTENSION); @@ -29,7 +29,7 @@ public function getStoragePathForField(Field $field, VersionInfo $versionInfo) * * @return string */ - protected function getFirstPartOfMimeType($mimeType) + protected function getFirstPartOfMimeType($mimeType): string { return substr($mimeType, 0, strpos($mimeType, '/')); } diff --git a/src/lib/FieldType/BinaryFile/BinaryFileStorage/Gateway/DoctrineStorage.php b/src/lib/FieldType/BinaryFile/BinaryFileStorage/Gateway/DoctrineStorage.php index 82949b49d8..0ecf5af997 100644 --- a/src/lib/FieldType/BinaryFile/BinaryFileStorage/Gateway/DoctrineStorage.php +++ b/src/lib/FieldType/BinaryFile/BinaryFileStorage/Gateway/DoctrineStorage.php @@ -21,7 +21,7 @@ class DoctrineStorage extends BaseDoctrineStorage /** * {@inheritdoc} */ - protected function getStorageTable() + protected function getStorageTable(): string { return 'ezbinaryfile'; } diff --git a/src/lib/FieldType/BinaryFile/Type.php b/src/lib/FieldType/BinaryFile/Type.php index d2419fdb75..a5474a481e 100644 --- a/src/lib/FieldType/BinaryFile/Type.php +++ b/src/lib/FieldType/BinaryFile/Type.php @@ -26,7 +26,7 @@ class Type extends BinaryBaseType implements TranslationContainerInterface * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezbinaryfile'; } diff --git a/src/lib/FieldType/Checkbox/SearchField.php b/src/lib/FieldType/Checkbox/SearchField.php index 70cf1f1156..842e87f6cb 100644 --- a/src/lib/FieldType/Checkbox/SearchField.php +++ b/src/lib/FieldType/Checkbox/SearchField.php @@ -44,7 +44,7 @@ public function getIndexDefinition() * * @return string */ - public function getDefaultMatchField() + public function getDefaultMatchField(): string { return 'value'; } diff --git a/src/lib/FieldType/Checkbox/Type.php b/src/lib/FieldType/Checkbox/Type.php index 797a289de5..5733bd9c8d 100644 --- a/src/lib/FieldType/Checkbox/Type.php +++ b/src/lib/FieldType/Checkbox/Type.php @@ -27,7 +27,7 @@ class Type extends FieldType implements TranslationContainerInterface * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezboolean'; } @@ -105,7 +105,7 @@ protected function checkValueStructure(BaseValue $value) * * @return int */ - protected function getSortInfo(BaseValue $value) + protected function getSortInfo(BaseValue $value): int { return (int)$value->bool; } @@ -139,7 +139,7 @@ public function toHash(SPIValue $value) * * @return bool */ - public function isSearchable() + public function isSearchable(): bool { return true; } diff --git a/src/lib/FieldType/Country/SearchField.php b/src/lib/FieldType/Country/SearchField.php index 296a17c812..4ca6e75998 100644 --- a/src/lib/FieldType/Country/SearchField.php +++ b/src/lib/FieldType/Country/SearchField.php @@ -102,7 +102,7 @@ public function getIndexDefinition() * * @return string */ - public function getDefaultMatchField() + public function getDefaultMatchField(): string { return 'name'; } @@ -116,7 +116,7 @@ public function getDefaultMatchField() * * @return string */ - public function getDefaultSortField() + public function getDefaultSortField(): string { return 'sort_value'; } diff --git a/src/lib/FieldType/Country/Type.php b/src/lib/FieldType/Country/Type.php index 4300639f56..9f36c3c020 100644 --- a/src/lib/FieldType/Country/Type.php +++ b/src/lib/FieldType/Country/Type.php @@ -47,7 +47,7 @@ public function __construct(array $countriesInfo) * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezcountry'; } @@ -156,7 +156,7 @@ public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue) /** * {@inheritdoc} */ - protected function getSortInfo(BaseValue $value) + protected function getSortInfo(BaseValue $value): string { $countries = []; foreach ($value->countries as $countryInfo) { @@ -220,7 +220,7 @@ public function toHash(SPIValue $value) * * @return bool */ - public function isSearchable() + public function isSearchable(): bool { return true; } diff --git a/src/lib/FieldType/Date/SearchField.php b/src/lib/FieldType/Date/SearchField.php index 1f211b2e32..11c28c61b3 100644 --- a/src/lib/FieldType/Date/SearchField.php +++ b/src/lib/FieldType/Date/SearchField.php @@ -53,7 +53,7 @@ public function getIndexDefinition() * * @return string */ - public function getDefaultMatchField() + public function getDefaultMatchField(): string { return 'value'; } diff --git a/src/lib/FieldType/Date/Type.php b/src/lib/FieldType/Date/Type.php index d3c94c8fcb..642ab8e245 100644 --- a/src/lib/FieldType/Date/Type.php +++ b/src/lib/FieldType/Date/Type.php @@ -42,7 +42,7 @@ class Type extends FieldType implements TranslationContainerInterface * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezdate'; } @@ -186,7 +186,7 @@ public function toHash(SPIValue $value) * * @return bool */ - public function isSearchable() + public function isSearchable(): bool { return true; } diff --git a/src/lib/FieldType/DateAndTime/SearchField.php b/src/lib/FieldType/DateAndTime/SearchField.php index 0a1fb15220..60a4b14f8c 100644 --- a/src/lib/FieldType/DateAndTime/SearchField.php +++ b/src/lib/FieldType/DateAndTime/SearchField.php @@ -44,7 +44,7 @@ public function getIndexDefinition() * * @return string */ - public function getDefaultMatchField() + public function getDefaultMatchField(): string { return 'value'; } diff --git a/src/lib/FieldType/DateAndTime/Type.php b/src/lib/FieldType/DateAndTime/Type.php index cdcdfe9db6..cfdc9fb3c9 100644 --- a/src/lib/FieldType/DateAndTime/Type.php +++ b/src/lib/FieldType/DateAndTime/Type.php @@ -52,7 +52,7 @@ class Type extends FieldType implements TranslationContainerInterface * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezdatetime'; } @@ -196,7 +196,7 @@ public function toHash(SPIValue $value) * * @return bool */ - public function isSearchable() + public function isSearchable(): bool { return true; } diff --git a/src/lib/FieldType/EmailAddress/SearchField.php b/src/lib/FieldType/EmailAddress/SearchField.php index fc9bf75f89..e61724e5ba 100644 --- a/src/lib/FieldType/EmailAddress/SearchField.php +++ b/src/lib/FieldType/EmailAddress/SearchField.php @@ -57,7 +57,7 @@ public function getIndexDefinition() * * @return string */ - public function getDefaultMatchField() + public function getDefaultMatchField(): string { return 'value'; } diff --git a/src/lib/FieldType/EmailAddress/Type.php b/src/lib/FieldType/EmailAddress/Type.php index df0a8e8a2d..ef0d55bda5 100644 --- a/src/lib/FieldType/EmailAddress/Type.php +++ b/src/lib/FieldType/EmailAddress/Type.php @@ -103,7 +103,7 @@ public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue) * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezemail'; } @@ -204,7 +204,7 @@ public function toHash(SPIValue $value) * * @return bool */ - public function isSearchable() + public function isSearchable(): bool { return true; } diff --git a/src/lib/FieldType/Float/SearchField.php b/src/lib/FieldType/Float/SearchField.php index 102bfde92b..1aba06c7fe 100644 --- a/src/lib/FieldType/Float/SearchField.php +++ b/src/lib/FieldType/Float/SearchField.php @@ -49,7 +49,7 @@ public function getIndexDefinition() * * @return string */ - public function getDefaultMatchField() + public function getDefaultMatchField(): string { return 'value'; } diff --git a/src/lib/FieldType/Float/Type.php b/src/lib/FieldType/Float/Type.php index 06e4198698..b4335949da 100644 --- a/src/lib/FieldType/Float/Type.php +++ b/src/lib/FieldType/Float/Type.php @@ -45,7 +45,7 @@ protected function getValidators(): array * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezfloat'; } @@ -70,7 +70,7 @@ public function getEmptyValue(): Value /** * @param \Ibexa\Core\FieldType\Float\Value $value */ - public function isEmptyValue(SPIValue $value) + public function isEmptyValue(SPIValue $value): bool { return $value->value === null; } diff --git a/src/lib/FieldType/ISBN/Type.php b/src/lib/FieldType/ISBN/Type.php index c8c86ca402..2b56fd0435 100644 --- a/src/lib/FieldType/ISBN/Type.php +++ b/src/lib/FieldType/ISBN/Type.php @@ -41,7 +41,7 @@ class Type extends FieldType implements TranslationContainerInterface * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezisbn'; } @@ -74,7 +74,7 @@ public function getEmptyValue() * * @return bool */ - public function isEmptyValue(SPIValue $value) + public function isEmptyValue(SPIValue $value): bool { return $value->isbn === null || trim($value->isbn) === ''; } @@ -218,7 +218,7 @@ public function toHash(SPIValue $value) * * @return bool */ - public function isSearchable() + public function isSearchable(): bool { return true; } @@ -275,7 +275,7 @@ public function validateFieldSettings($fieldSettings) * * @return bool */ - private function validateISBNChecksum($isbnNr) + private function validateISBNChecksum($isbnNr): bool { $result = 0; $isbnNr = strtoupper($isbnNr); @@ -303,7 +303,7 @@ private function validateISBNChecksum($isbnNr) * * @return bool */ - private function validateISBN13Checksum($isbnNr, &$error) + private function validateISBN13Checksum($isbnNr, &$error): bool { if (!$isbnNr) { return false; diff --git a/src/lib/FieldType/Image/IO/Legacy.php b/src/lib/FieldType/Image/IO/Legacy.php index 956b41e67c..ba53f07518 100644 --- a/src/lib/FieldType/Image/IO/Legacy.php +++ b/src/lib/FieldType/Image/IO/Legacy.php @@ -246,7 +246,7 @@ public function newBinaryCreateStructFromUploadedFile(array $uploadedFile) * * @return bool true if $internalPath is the path to a published image */ - protected function isPublishedImagePath($internalPath) + protected function isPublishedImagePath($internalPath): bool { return strpos($internalPath, $this->publishedPrefix) === 0; } @@ -258,7 +258,7 @@ protected function isPublishedImagePath($internalPath) * * @return bool true if $internalPath is the path to a published image */ - protected function isDraftImagePath($internalPath) + protected function isDraftImagePath($internalPath): bool { return strpos($internalPath, $this->draftPrefix) === 0; } diff --git a/src/lib/FieldType/Image/ImageStorage.php b/src/lib/FieldType/Image/ImageStorage.php index 21e6282a22..9da6b9b5b2 100644 --- a/src/lib/FieldType/Image/ImageStorage.php +++ b/src/lib/FieldType/Image/ImageStorage.php @@ -67,7 +67,7 @@ public function __construct( * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException */ - public function storeFieldData(VersionInfo $versionInfo, Field $field, array $context) + public function storeFieldData(VersionInfo $versionInfo, Field $field, array $context): bool { $contentMetaData = [ 'fieldId' => $field->id, @@ -187,21 +187,20 @@ public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array } } - public function hasFieldData() + public function hasFieldData(): bool { return true; } - public function getIndexData(VersionInfo $versionInfo, Field $field, array $context) + public function getIndexData(VersionInfo $versionInfo, Field $field, array $context): array { - // @todo: Correct? - return null; + return []; } /** * @return string */ - private function buildImageId(VersionInfo $versionInfo, Field $field) + private function buildImageId(VersionInfo $versionInfo, Field $field): string { return sprintf( '%s-%s-%s', diff --git a/src/lib/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php b/src/lib/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php index e3794b2e9d..1f9b4696a7 100644 --- a/src/lib/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php +++ b/src/lib/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php @@ -231,7 +231,7 @@ public function removeImageReferences($uri, $versionNo, $fieldId): void * * @return int */ - public function countImageReferences($uri) + public function countImageReferences($uri): int { $path = $this->redecorator->redecorateFromSource($uri); diff --git a/src/lib/FieldType/Image/PathGenerator/LegacyPathGenerator.php b/src/lib/FieldType/Image/PathGenerator/LegacyPathGenerator.php index 4de319195d..999868c170 100644 --- a/src/lib/FieldType/Image/PathGenerator/LegacyPathGenerator.php +++ b/src/lib/FieldType/Image/PathGenerator/LegacyPathGenerator.php @@ -22,7 +22,7 @@ class LegacyPathGenerator extends PathGenerator * * @return string */ - public function getStoragePathForField($fieldId, $versionNo, $languageCode) + public function getStoragePathForField($fieldId, $versionNo, $languageCode): string { return sprintf( '%s/%s-%s-%s', @@ -40,7 +40,7 @@ public function getStoragePathForField($fieldId, $versionNo, $languageCode) * * @return string */ - private function getDirectoryStructure($id) + private function getDirectoryStructure($id): string { // our base string is the last 4 digits, defaulting to 0, reversed $idString = strrev( diff --git a/src/lib/FieldType/Image/SearchField.php b/src/lib/FieldType/Image/SearchField.php index 12b4b2e7a1..4c9a5e52b3 100644 --- a/src/lib/FieldType/Image/SearchField.php +++ b/src/lib/FieldType/Image/SearchField.php @@ -88,7 +88,7 @@ public function getIndexDefinition() * * @return string */ - public function getDefaultMatchField() + public function getDefaultMatchField(): string { return 'filename'; } diff --git a/src/lib/FieldType/Image/Type.php b/src/lib/FieldType/Image/Type.php index 4ea29a04ba..a7993a6d30 100644 --- a/src/lib/FieldType/Image/Type.php +++ b/src/lib/FieldType/Image/Type.php @@ -75,7 +75,7 @@ public function __construct( * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezimage'; } @@ -335,7 +335,7 @@ public function validateValidatorConfiguration($validatorConfiguration) /** * {@inheritdoc} */ - protected function getSortInfo(BaseValue $value) + protected function getSortInfo(BaseValue $value): bool { return false; } diff --git a/src/lib/FieldType/Integer/SearchField.php b/src/lib/FieldType/Integer/SearchField.php index 667ffe00f2..750fe80722 100644 --- a/src/lib/FieldType/Integer/SearchField.php +++ b/src/lib/FieldType/Integer/SearchField.php @@ -49,7 +49,7 @@ public function getIndexDefinition() * * @return string */ - public function getDefaultMatchField() + public function getDefaultMatchField(): string { return 'value'; } diff --git a/src/lib/FieldType/Integer/Type.php b/src/lib/FieldType/Integer/Type.php index 735cf69db4..7d768d870c 100644 --- a/src/lib/FieldType/Integer/Type.php +++ b/src/lib/FieldType/Integer/Type.php @@ -45,7 +45,7 @@ protected function getValidators(): array * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezinteger'; } @@ -72,7 +72,7 @@ public function getEmptyValue(): Value * * @param \Ibexa\Core\FieldType\Integer\Value $value */ - public function isEmptyValue(SPIValue $value) + public function isEmptyValue(SPIValue $value): bool { return $value->value === null; } @@ -154,7 +154,7 @@ public function toHash(SPIValue $value): ?int * * @return bool */ - public function isSearchable() + public function isSearchable(): bool { return true; } diff --git a/src/lib/FieldType/Keyword/KeywordStorage.php b/src/lib/FieldType/Keyword/KeywordStorage.php index 5c3ccc6d8f..c91fbd634c 100644 --- a/src/lib/FieldType/Keyword/KeywordStorage.php +++ b/src/lib/FieldType/Keyword/KeywordStorage.php @@ -52,7 +52,7 @@ public function getFieldData(VersionInfo $versionInfo, Field $field, array $cont * * @return bool */ - public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array $context) + public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array $context): bool { foreach ($fieldIds as $fieldId) { $this->gateway->deleteFieldData($fieldId, $versionInfo->versionNo); @@ -66,20 +66,13 @@ public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array * * @return bool */ - public function hasFieldData() + public function hasFieldData(): bool { return true; } - /** - * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo - * @param \Ibexa\Contracts\Core\Persistence\Content\Field $field - * @param array $context - * - * @return \Ibexa\Contracts\Core\Search\Field[]|null - */ - public function getIndexData(VersionInfo $versionInfo, Field $field, array $context) + public function getIndexData(VersionInfo $versionInfo, Field $field, array $context): array { - return null; + return []; } } diff --git a/src/lib/FieldType/Keyword/KeywordStorage/Gateway/DoctrineStorage.php b/src/lib/FieldType/Keyword/KeywordStorage/Gateway/DoctrineStorage.php index d54595b00b..16d1d85861 100644 --- a/src/lib/FieldType/Keyword/KeywordStorage/Gateway/DoctrineStorage.php +++ b/src/lib/FieldType/Keyword/KeywordStorage/Gateway/DoctrineStorage.php @@ -141,7 +141,7 @@ protected function getAssignedKeywords(int $fieldId, int $versionNo): array * * @return int */ - protected function loadContentTypeId($fieldDefinitionId) + protected function loadContentTypeId($fieldDefinitionId): int { $query = $this->connection->createQueryBuilder(); $query diff --git a/src/lib/FieldType/Keyword/SearchField.php b/src/lib/FieldType/Keyword/SearchField.php index b3cc8ef40b..26bc6d7983 100644 --- a/src/lib/FieldType/Keyword/SearchField.php +++ b/src/lib/FieldType/Keyword/SearchField.php @@ -46,12 +46,12 @@ public function getIndexDefinition() ]; } - public function getDefaultMatchField() + public function getDefaultMatchField(): string { return 'value'; } - public function getDefaultSortField() + public function getDefaultSortField(): string { return 'sort_value'; } diff --git a/src/lib/FieldType/Keyword/Type.php b/src/lib/FieldType/Keyword/Type.php index b2336144bc..da978a7794 100644 --- a/src/lib/FieldType/Keyword/Type.php +++ b/src/lib/FieldType/Keyword/Type.php @@ -28,7 +28,7 @@ class Type extends FieldType implements TranslationContainerInterface * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezkeyword'; } @@ -93,7 +93,7 @@ protected function checkValueStructure(BaseValue $value) /** * {@inheritdoc} */ - protected function getSortInfo(BaseValue $value) + protected function getSortInfo(BaseValue $value): string { return implode(',', $value->values); } @@ -127,7 +127,7 @@ public function toHash(SPIValue $value) * * @return bool */ - public function isSearchable() + public function isSearchable(): bool { return true; } diff --git a/src/lib/FieldType/MapLocation/MapLocationStorage.php b/src/lib/FieldType/MapLocation/MapLocationStorage.php index 43423fa346..a233abbd58 100644 --- a/src/lib/FieldType/MapLocation/MapLocationStorage.php +++ b/src/lib/FieldType/MapLocation/MapLocationStorage.php @@ -55,20 +55,14 @@ public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array * * @return bool */ - public function hasFieldData() + public function hasFieldData(): bool { return true; } - /** - * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo - * @param \Ibexa\Contracts\Core\Persistence\Content\Field $field - * @param array $context - * - * @return \Ibexa\Contracts\Core\Search\Field[]|null - */ - public function getIndexData(VersionInfo $versionInfo, Field $field, array $context) + public function getIndexData(VersionInfo $versionInfo, Field $field, array $context): array { - return is_array($field->value->externalData) ? $field->value->externalData['address'] : null; + // Handled by @see \Ibexa\Core\FieldType\MapLocation\SearchField::getIndexData() + return []; } } diff --git a/src/lib/FieldType/MapLocation/MapLocationStorage/Gateway/DoctrineStorage.php b/src/lib/FieldType/MapLocation/MapLocationStorage/Gateway/DoctrineStorage.php index db1dc0cc6b..667be196d7 100644 --- a/src/lib/FieldType/MapLocation/MapLocationStorage/Gateway/DoctrineStorage.php +++ b/src/lib/FieldType/MapLocation/MapLocationStorage/Gateway/DoctrineStorage.php @@ -36,7 +36,7 @@ public function __construct(Connection $connection) * * @return bool If restoring of the internal field data is required */ - public function storeFieldData(VersionInfo $versionInfo, Field $field) + public function storeFieldData(VersionInfo $versionInfo, Field $field): bool { if ($field->value->externalData === null) { // Store empty value and return @@ -197,7 +197,7 @@ protected function loadFieldData($fieldId, $versionNo) * * @return bool */ - protected function hasFieldData($fieldId, $versionNo) + protected function hasFieldData($fieldId, $versionNo): bool { return $this->loadFieldData($fieldId, $versionNo) !== null; } diff --git a/src/lib/FieldType/MapLocation/SearchField.php b/src/lib/FieldType/MapLocation/SearchField.php index 169af3822d..0639d0acc6 100644 --- a/src/lib/FieldType/MapLocation/SearchField.php +++ b/src/lib/FieldType/MapLocation/SearchField.php @@ -58,7 +58,7 @@ public function getIndexDefinition() * * @return string */ - public function getDefaultMatchField() + public function getDefaultMatchField(): string { return 'value_address'; } diff --git a/src/lib/FieldType/MapLocation/Type.php b/src/lib/FieldType/MapLocation/Type.php index 4c204177e9..0307fa7288 100644 --- a/src/lib/FieldType/MapLocation/Type.php +++ b/src/lib/FieldType/MapLocation/Type.php @@ -28,7 +28,7 @@ class Type extends FieldType implements TranslationContainerInterface * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezgmaplocation'; } @@ -59,7 +59,7 @@ public function getEmptyValue() * * @return bool */ - public function isEmptyValue(SPIValue $value) + public function isEmptyValue(SPIValue $value): bool { return $value->latitude === null && $value->longitude === null; } @@ -165,7 +165,7 @@ public function toHash(SPIValue $value) * * @return bool */ - public function isSearchable() + public function isSearchable(): bool { return true; } diff --git a/src/lib/FieldType/Media/MediaStorage/Gateway/DoctrineStorage.php b/src/lib/FieldType/Media/MediaStorage/Gateway/DoctrineStorage.php index 09d236e1f9..dd084e4a2d 100644 --- a/src/lib/FieldType/Media/MediaStorage/Gateway/DoctrineStorage.php +++ b/src/lib/FieldType/Media/MediaStorage/Gateway/DoctrineStorage.php @@ -22,7 +22,7 @@ class DoctrineStorage extends BaseDoctrineStorage /** * {@inheritdoc} */ - protected function getStorageTable() + protected function getStorageTable(): string { return 'ezmedia'; } @@ -35,19 +35,19 @@ protected function getPropertyMapping() $propertyMap = parent::getPropertyMapping(); $propertyMap['has_controller'] = [ 'name' => 'hasController', - 'cast' => static function ($val) { + 'cast' => static function ($val): bool { return (bool)$val; }, ]; $propertyMap['is_autoplay'] = [ 'name' => 'autoplay', - 'cast' => static function ($val) { + 'cast' => static function ($val): bool { return (bool)$val; }, ]; $propertyMap['is_loop'] = [ 'name' => 'loop', - 'cast' => static function ($val) { + 'cast' => static function ($val): bool { return (bool)$val; }, ]; diff --git a/src/lib/FieldType/Media/Type.php b/src/lib/FieldType/Media/Type.php index b03050222d..99080c463e 100644 --- a/src/lib/FieldType/Media/Type.php +++ b/src/lib/FieldType/Media/Type.php @@ -60,7 +60,7 @@ class Type extends BaseType implements TranslationContainerInterface * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezmedia'; } @@ -263,7 +263,7 @@ public function fromPersistenceValue(FieldValue $fieldValue) * * @return bool */ - public function isSearchable() + public function isSearchable(): bool { return false; } diff --git a/src/lib/FieldType/Null/Type.php b/src/lib/FieldType/Null/Type.php index d38e177193..6f103b17da 100644 --- a/src/lib/FieldType/Null/Type.php +++ b/src/lib/FieldType/Null/Type.php @@ -126,7 +126,7 @@ public function toHash(SPIValue $value) * * @return bool */ - public function isSearchable() + public function isSearchable(): bool { return true; } diff --git a/src/lib/FieldType/NullStorage.php b/src/lib/FieldType/NullStorage.php index 8ac0416415..cf5a574472 100644 --- a/src/lib/FieldType/NullStorage.php +++ b/src/lib/FieldType/NullStorage.php @@ -19,7 +19,7 @@ class NullStorage implements FieldStorage /** * @see \Ibexa\Contracts\Core\FieldType\FieldStorage::storeFieldData() */ - public function storeFieldData(VersionInfo $versionInfo, Field $field, array $context) + public function storeFieldData(VersionInfo $versionInfo, Field $field, array $context): bool { return false; } @@ -35,7 +35,7 @@ public function getFieldData(VersionInfo $versionInfo, Field $field, array $cont /** * @see \Ibexa\Contracts\Core\FieldType\FieldStorage::deleteFieldData() */ - public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array $context) + public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array $context): bool { return true; } @@ -45,17 +45,14 @@ public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array * * @return bool */ - public function hasFieldData() + public function hasFieldData(): bool { return false; } - /** - * @see \Ibexa\Contracts\Core\FieldType\FieldStorage::getIndexData() - */ - public function getIndexData(VersionInfo $versionInfo, Field $field, array $context) + public function getIndexData(VersionInfo $versionInfo, Field $field, array $context): array { - return false; + return []; } /** diff --git a/src/lib/FieldType/Relation/SearchField.php b/src/lib/FieldType/Relation/SearchField.php index a6375377ea..8ed651e69a 100644 --- a/src/lib/FieldType/Relation/SearchField.php +++ b/src/lib/FieldType/Relation/SearchField.php @@ -44,7 +44,7 @@ public function getIndexDefinition() * * @return string */ - public function getDefaultMatchField() + public function getDefaultMatchField(): string { return 'value'; } diff --git a/src/lib/FieldType/Relation/Type.php b/src/lib/FieldType/Relation/Type.php index dac17b2234..b322db581c 100644 --- a/src/lib/FieldType/Relation/Type.php +++ b/src/lib/FieldType/Relation/Type.php @@ -146,7 +146,7 @@ public function validateFieldSettings($fieldSettings) * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezobjectrelation'; } @@ -215,7 +215,7 @@ public function getEmptyValue() * * @return bool */ - public function isEmptyValue(SPIValue $value) + public function isEmptyValue(SPIValue $value): bool { return $value->destinationContentId === null; } @@ -265,7 +265,7 @@ protected function checkValueStructure(BaseValue $value) * * @return string */ - protected function getSortInfo(BaseValue $value) + protected function getSortInfo(BaseValue $value): string { return (string)$value; } @@ -313,7 +313,7 @@ public function toHash(SPIValue $value) * * @return bool */ - public function isSearchable() + public function isSearchable(): bool { return true; } diff --git a/src/lib/FieldType/RelationList/SearchField.php b/src/lib/FieldType/RelationList/SearchField.php index fb0b3e1369..9cfb25a972 100644 --- a/src/lib/FieldType/RelationList/SearchField.php +++ b/src/lib/FieldType/RelationList/SearchField.php @@ -50,7 +50,7 @@ public function getIndexDefinition() * * @return string */ - public function getDefaultMatchField() + public function getDefaultMatchField(): string { return 'value'; } @@ -64,7 +64,7 @@ public function getDefaultMatchField() * * @return string */ - public function getDefaultSortField() + public function getDefaultSortField(): string { return 'sort_value'; } diff --git a/src/lib/FieldType/RelationList/Type.php b/src/lib/FieldType/RelationList/Type.php index 321e2af620..436f72b39a 100644 --- a/src/lib/FieldType/RelationList/Type.php +++ b/src/lib/FieldType/RelationList/Type.php @@ -296,7 +296,7 @@ public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue) * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezobjectrelationlist'; } @@ -400,7 +400,7 @@ protected function checkValueStructure(BaseValue $value) * * @return string */ - protected function getSortInfo(BaseValue $value) + protected function getSortInfo(BaseValue $value): string { return implode(',', $value->destinationContentIds); } @@ -434,7 +434,7 @@ public function toHash(SPIValue $value) * * @return bool */ - public function isSearchable() + public function isSearchable(): bool { return true; } @@ -479,7 +479,7 @@ public function getRelations(SPIValue $value) * * @return bool */ - private function isValidSelectionMethod($selectionMethod) + private function isValidSelectionMethod($selectionMethod): bool { return in_array($selectionMethod, [ self::SELECTION_BROWSE, diff --git a/src/lib/FieldType/Selection/SearchField.php b/src/lib/FieldType/Selection/SearchField.php index f54743fdce..e39d0c3a13 100644 --- a/src/lib/FieldType/Selection/SearchField.php +++ b/src/lib/FieldType/Selection/SearchField.php @@ -81,7 +81,7 @@ public function getIndexDefinition() * * @return string */ - public function getDefaultMatchField() + public function getDefaultMatchField(): string { return 'selected_option_index'; } @@ -95,7 +95,7 @@ public function getDefaultMatchField() * * @return string */ - public function getDefaultSortField() + public function getDefaultSortField(): string { return 'sort_value'; } diff --git a/src/lib/FieldType/Selection/Type.php b/src/lib/FieldType/Selection/Type.php index 1c727547c4..844632dc92 100644 --- a/src/lib/FieldType/Selection/Type.php +++ b/src/lib/FieldType/Selection/Type.php @@ -121,7 +121,7 @@ public function validateFieldSettings($fieldSettings) * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezselection'; } @@ -243,7 +243,7 @@ public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue) //@todo: find a way to include selection language if (isset($fieldSettings['multilingualOptions'])) { - $possibleOptionIndexesByLanguage = array_map(static function ($languageOptionIndexes) { + $possibleOptionIndexesByLanguage = array_map(static function ($languageOptionIndexes): array { return array_keys($languageOptionIndexes); }, $fieldSettings['multilingualOptions']); @@ -273,7 +273,7 @@ public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue) * * @return string */ - protected function getSortInfo(BaseValue $value) + protected function getSortInfo(BaseValue $value): string { return implode('-', $value->selection); } @@ -307,7 +307,7 @@ public function toHash(SPIValue $value) * * @return bool */ - public function isSearchable() + public function isSearchable(): bool { return true; } diff --git a/src/lib/FieldType/TextBlock/SearchField.php b/src/lib/FieldType/TextBlock/SearchField.php index 78b105f981..7ad3c94d16 100644 --- a/src/lib/FieldType/TextBlock/SearchField.php +++ b/src/lib/FieldType/TextBlock/SearchField.php @@ -40,7 +40,7 @@ public function getIndexData(Field $field, FieldDefinition $fieldDefinition) * * @return string */ - private function extractShortText($string) + private function extractShortText($string): string { return mb_substr(strtok(trim((string)$string), "\r\n"), 0, 255); } @@ -61,7 +61,7 @@ public function getIndexDefinition() * * @return string */ - public function getDefaultMatchField() + public function getDefaultMatchField(): string { return 'value'; } diff --git a/src/lib/FieldType/TextBlock/Type.php b/src/lib/FieldType/TextBlock/Type.php index 272826b527..57abce5128 100644 --- a/src/lib/FieldType/TextBlock/Type.php +++ b/src/lib/FieldType/TextBlock/Type.php @@ -29,7 +29,7 @@ class Type extends BaseTextType protected $validatorConfigurationSchema = []; - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'eztext'; } diff --git a/src/lib/FieldType/TextLine/Type.php b/src/lib/FieldType/TextLine/Type.php index cf78bd2c42..d87092f5d7 100644 --- a/src/lib/FieldType/TextLine/Type.php +++ b/src/lib/FieldType/TextLine/Type.php @@ -84,7 +84,7 @@ public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue) return false === $validator->validate($fieldValue, $fieldDefinition) ? $validator->getMessage() : []; } - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezstring'; } diff --git a/src/lib/FieldType/Time/SearchField.php b/src/lib/FieldType/Time/SearchField.php index be825875ef..b56b3275cb 100644 --- a/src/lib/FieldType/Time/SearchField.php +++ b/src/lib/FieldType/Time/SearchField.php @@ -44,7 +44,7 @@ public function getIndexDefinition() * * @return string */ - public function getDefaultMatchField() + public function getDefaultMatchField(): string { return 'value'; } diff --git a/src/lib/FieldType/Time/Type.php b/src/lib/FieldType/Time/Type.php index df3fe4ea21..f7f1bc62fc 100644 --- a/src/lib/FieldType/Time/Type.php +++ b/src/lib/FieldType/Time/Type.php @@ -46,7 +46,7 @@ class Type extends FieldType implements TranslationContainerInterface * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'eztime'; } @@ -156,7 +156,7 @@ public function fromHash($hash) * * @return bool */ - public function isEmptyValue(SPIValue $value) + public function isEmptyValue(SPIValue $value): bool { if ($value->time === null) { return true; @@ -186,7 +186,7 @@ public function toHash(SPIValue $value) * * @return bool */ - public function isSearchable() + public function isSearchable(): bool { return true; } diff --git a/src/lib/FieldType/Url/SearchField.php b/src/lib/FieldType/Url/SearchField.php index 87b24203e7..efe0867f21 100644 --- a/src/lib/FieldType/Url/SearchField.php +++ b/src/lib/FieldType/Url/SearchField.php @@ -61,7 +61,7 @@ public function getIndexDefinition() * * @return string */ - public function getDefaultMatchField() + public function getDefaultMatchField(): string { return 'value_url'; } diff --git a/src/lib/FieldType/Url/Type.php b/src/lib/FieldType/Url/Type.php index c3a2cdf1af..c25416da71 100644 --- a/src/lib/FieldType/Url/Type.php +++ b/src/lib/FieldType/Url/Type.php @@ -28,7 +28,7 @@ class Type extends FieldType implements TranslationContainerInterface * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return 'ezurl'; } @@ -97,7 +97,7 @@ protected function checkValueStructure(BaseValue $value) /** * {@inheritdoc} */ - protected function getSortInfo(BaseValue $value) + protected function getSortInfo(BaseValue $value): bool { return false; } diff --git a/src/lib/FieldType/Url/UrlStorage.php b/src/lib/FieldType/Url/UrlStorage.php index b135b5827b..b1ac1f0186 100644 --- a/src/lib/FieldType/Url/UrlStorage.php +++ b/src/lib/FieldType/Url/UrlStorage.php @@ -36,16 +36,7 @@ public function __construct(StorageGatewayInterface $gateway, LoggerInterface $l $this->logger = $logger; } - /** - * @see \Ibexa\Contracts\Core\FieldType\FieldStorage - * - * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo - * @param \Ibexa\Contracts\Core\Persistence\Content\Field $field - * @param array $context - * - * @return bool|mixed - */ - public function storeFieldData(VersionInfo $versionInfo, Field $field, array $context) + public function storeFieldData(VersionInfo $versionInfo, Field $field, array $context): bool { $url = $field->value->externalData; @@ -55,11 +46,7 @@ public function storeFieldData(VersionInfo $versionInfo, Field $field, array $co $map = $this->gateway->getUrlIdMap([$url]); - if (isset($map[$url])) { - $urlId = $map[$url]; - } else { - $urlId = $this->gateway->insertUrl($url); - } + $urlId = $map[$url] ?? $this->gateway->insertUrl($url); $this->gateway->linkUrl($urlId, $field->id, $versionInfo->versionNo); @@ -116,19 +103,13 @@ public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array * * @return bool */ - public function hasFieldData() + public function hasFieldData(): bool { return true; } - /** - * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo - * @param \Ibexa\Contracts\Core\Persistence\Content\Field $field - * @param array $context - * - * @return \Ibexa\Contracts\Core\Search\Field[] - */ - public function getIndexData(VersionInfo $versionInfo, Field $field, array $context) + public function getIndexData(VersionInfo $versionInfo, Field $field, array $context): array { + return []; } } diff --git a/src/lib/FieldType/Url/UrlStorage/Gateway/DoctrineStorage.php b/src/lib/FieldType/Url/UrlStorage/Gateway/DoctrineStorage.php index 2233118e40..c0ef8a3f18 100644 --- a/src/lib/FieldType/Url/UrlStorage/Gateway/DoctrineStorage.php +++ b/src/lib/FieldType/Url/UrlStorage/Gateway/DoctrineStorage.php @@ -99,9 +99,9 @@ public function getUrlIdMap(array $urls) * * @param string $url The URL to insert in the database * - * @return string + * @throws \Doctrine\DBAL\Exception */ - public function insertUrl($url) + public function insertUrl($url): int { $time = time(); diff --git a/src/lib/FieldType/User/Type.php b/src/lib/FieldType/User/Type.php index a7bf7ec338..85a0b322fa 100644 --- a/src/lib/FieldType/User/Type.php +++ b/src/lib/FieldType/User/Type.php @@ -115,7 +115,7 @@ public function __construct( * * @return string */ - public function getFieldTypeIdentifier() + public function getFieldTypeIdentifier(): string { return self::FIELD_TYPE_IDENTIFIER; } @@ -133,7 +133,7 @@ public function getName(SPIValue $value, FieldDefinition $fieldDefinition, strin * * @return bool */ - public function isSingular() + public function isSingular(): bool { return true; } @@ -143,7 +143,7 @@ public function isSingular() * * @return bool */ - public function onlyEmptyInstance() + public function onlyEmptyInstance(): bool { return true; } @@ -190,7 +190,7 @@ protected function checkValueStructure(BaseValue $value) /** * {@inheritdoc} */ - protected function getSortInfo(BaseValue $value) + protected function getSortInfo(BaseValue $value): bool { return false; } diff --git a/src/lib/FieldType/User/UserStorage.php b/src/lib/FieldType/User/UserStorage.php index 353083a147..8443ccfe57 100644 --- a/src/lib/FieldType/User/UserStorage.php +++ b/src/lib/FieldType/User/UserStorage.php @@ -64,20 +64,14 @@ public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array * * @return bool */ - public function hasFieldData() + public function hasFieldData(): bool { return true; } - /** - * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo - * @param \Ibexa\Contracts\Core\Persistence\Content\Field $field - * @param array $context - * - * @return \Ibexa\Contracts\Core\Search\Field[] - */ - public function getIndexData(VersionInfo $versionInfo, Field $field, array $context) + public function getIndexData(VersionInfo $versionInfo, Field $field, array $context): array { + return []; } /** diff --git a/src/lib/FieldType/User/UserStorage/Gateway/DoctrineStorage.php b/src/lib/FieldType/User/UserStorage/Gateway/DoctrineStorage.php index 94236cec61..c7155eb36b 100644 --- a/src/lib/FieldType/User/UserStorage/Gateway/DoctrineStorage.php +++ b/src/lib/FieldType/User/UserStorage/Gateway/DoctrineStorage.php @@ -84,7 +84,7 @@ protected function getPropertyMap() return [ 'has_stored_login' => [ 'name' => 'hasStoredlogin', - 'cast' => static function ($input) { + 'cast' => static function ($input): bool { return $input == '1'; }, ], @@ -116,7 +116,7 @@ protected function getPropertyMap() ], 'is_enabled' => [ 'name' => 'enabled', - 'cast' => static function ($input) { + 'cast' => static function ($input): bool { return $input == '1'; }, ], @@ -155,7 +155,7 @@ protected function convertColumnsToProperties(array $databaseValues) * * @return int */ - protected function fetchUserId($fieldId) + protected function fetchUserId($fieldId): int { $query = $this->connection->createQueryBuilder(); $query diff --git a/src/lib/FieldType/Validator/EmailAddressValidator.php b/src/lib/FieldType/Validator/EmailAddressValidator.php index 254e2f8f54..0a1f853bf8 100644 --- a/src/lib/FieldType/Validator/EmailAddressValidator.php +++ b/src/lib/FieldType/Validator/EmailAddressValidator.php @@ -86,7 +86,7 @@ public function validateConstraints($constraints) * * @return bool */ - public function validate(BaseValue $value, ?FieldDefinition $fieldDefinition = null) + public function validate(BaseValue $value, ?FieldDefinition $fieldDefinition = null): bool { $pattern = '/^((\"[^\"\f\n\r\t\v\b]+\")|([A-Za-z0-9_\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+(\.[A-Za-z0-9_\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]{2,}))$/'; diff --git a/src/lib/FieldType/Validator/FileExtensionBlackListValidator.php b/src/lib/FieldType/Validator/FileExtensionBlackListValidator.php index eb1c77766a..0bee0955ca 100644 --- a/src/lib/FieldType/Validator/FileExtensionBlackListValidator.php +++ b/src/lib/FieldType/Validator/FileExtensionBlackListValidator.php @@ -47,7 +47,7 @@ public function validateConstraints($constraints) /** * {@inheritdoc} */ - public function validate(BaseValue $value, ?FieldDefinition $fieldDefinition = null) + public function validate(BaseValue $value, ?FieldDefinition $fieldDefinition = null): bool { $this->errors = []; diff --git a/src/lib/FieldType/Validator/FileSizeValidator.php b/src/lib/FieldType/Validator/FileSizeValidator.php index cda86de542..3a1b744e54 100644 --- a/src/lib/FieldType/Validator/FileSizeValidator.php +++ b/src/lib/FieldType/Validator/FileSizeValidator.php @@ -68,7 +68,7 @@ public function validateConstraints($constraints) * * @return bool */ - public function validate(BaseValue $value, ?FieldDefinition $fieldDefinition = null) + public function validate(BaseValue $value, ?FieldDefinition $fieldDefinition = null): bool { $isValid = true; diff --git a/src/lib/FieldType/Validator/ImageValidator.php b/src/lib/FieldType/Validator/ImageValidator.php index c421084d0d..01f371a3ac 100644 --- a/src/lib/FieldType/Validator/ImageValidator.php +++ b/src/lib/FieldType/Validator/ImageValidator.php @@ -25,7 +25,7 @@ public function validateConstraints($constraints, ?FieldDefinition $fieldDefinit /** * {@inheritdoc} */ - public function validate(Value $value, ?FieldDefinition $fieldDefinition = null) + public function validate(Value $value, ?FieldDefinition $fieldDefinition = null): bool { $mimeTypes = []; if (null !== $fieldDefinition) { diff --git a/src/lib/FieldType/Validator/StringLengthValidator.php b/src/lib/FieldType/Validator/StringLengthValidator.php index 041d17cc61..85c136967e 100644 --- a/src/lib/FieldType/Validator/StringLengthValidator.php +++ b/src/lib/FieldType/Validator/StringLengthValidator.php @@ -92,7 +92,7 @@ public function validateConstraints($constraints) * * @return bool */ - protected function validateConstraintsOrder($constraints) + protected function validateConstraintsOrder($constraints): bool { return !isset($constraints['minStringLength'], $constraints['maxStringLength']) || ($constraints['minStringLength'] <= $constraints['maxStringLength']); @@ -107,7 +107,7 @@ protected function validateConstraintsOrder($constraints) * * @return bool */ - public function validate(BaseValue $value, ?FieldDefinition $fieldDefinition = null) + public function validate(BaseValue $value, ?FieldDefinition $fieldDefinition = null): bool { $isValid = true; diff --git a/src/lib/Helper/TranslationHelper.php b/src/lib/Helper/TranslationHelper.php index d882889c35..27c0e84da5 100644 --- a/src/lib/Helper/TranslationHelper.php +++ b/src/lib/Helper/TranslationHelper.php @@ -53,7 +53,7 @@ public function __construct(ConfigResolverInterface $configResolver, ContentServ * * @return string */ - public function getTranslatedContentName(Content $content, $forcedLanguage = null) + public function getTranslatedContentName(Content $content, $forcedLanguage = null): string { return $this->getTranslatedContentNameByVersionInfo( $content->getVersionInfo(), diff --git a/src/lib/IO/IOMetadataHandler/LegacyDFSCluster.php b/src/lib/IO/IOMetadataHandler/LegacyDFSCluster.php index a6e336b255..d78210a039 100644 --- a/src/lib/IO/IOMetadataHandler/LegacyDFSCluster.php +++ b/src/lib/IO/IOMetadataHandler/LegacyDFSCluster.php @@ -161,7 +161,7 @@ public function load($spiBinaryFileId) * * @return bool */ - public function exists($spiBinaryFileId) + public function exists($spiBinaryFileId): bool { $path = (string)$this->addPrefix($spiBinaryFileId); @@ -209,7 +209,7 @@ protected function getNameTrunk(SPIBinaryFileCreateStruct $binaryFileCreateStruc * * @return string */ - protected function getScope(SPIBinaryFileCreateStruct $binaryFileCreateStruct) + protected function getScope(SPIBinaryFileCreateStruct $binaryFileCreateStruct): string { [$filePrefix] = explode('/', $binaryFileCreateStruct->id); diff --git a/src/lib/IO/MimeTypeDetector/FileInfo.php b/src/lib/IO/MimeTypeDetector/FileInfo.php index 6dfd600c0d..8ca0b1cc04 100644 --- a/src/lib/IO/MimeTypeDetector/FileInfo.php +++ b/src/lib/IO/MimeTypeDetector/FileInfo.php @@ -30,12 +30,12 @@ public function __construct() } } - public function getFromPath($path) + public function getFromPath($path): string|false { return $this->getFileInfo()->file($path); } - public function getFromBuffer($path) + public function getFromBuffer($path): string|false { return $this->getFileInfo()->buffer($path); } diff --git a/src/lib/Limitation/BlockingLimitationType.php b/src/lib/Limitation/BlockingLimitationType.php index a43604e3d1..0769837be9 100644 --- a/src/lib/Limitation/BlockingLimitationType.php +++ b/src/lib/Limitation/BlockingLimitationType.php @@ -115,7 +115,7 @@ public function buildValue(array $limitationValues) * * @return bool */ - public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null) + public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null): bool { if (!$value instanceof APIBlockingLimitation) { throw new InvalidArgumentException('$value', 'Must be of type: BlockingLimitation'); diff --git a/src/lib/Limitation/LocationLimitationType.php b/src/lib/Limitation/LocationLimitationType.php index 269771cf6e..f90ec4d3e7 100644 --- a/src/lib/Limitation/LocationLimitationType.php +++ b/src/lib/Limitation/LocationLimitationType.php @@ -142,7 +142,7 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse } } /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location[]|\Ibexa\Contracts\Core\Persistence\Content\Location[] $targets */ - $targets = array_filter($targets, static function ($target) { + $targets = array_filter($targets, static function ($target): bool { return $target instanceof Location || $target instanceof SPILocation; }); @@ -170,7 +170,7 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse * * @return bool */ - protected function evaluateForContentCreateStruct(APILimitationValue $value, array $targets = null) + protected function evaluateForContentCreateStruct(APILimitationValue $value, array $targets = null): bool { // If targets is empty/null return false as user does not have access // to content w/o location with this limitation @@ -224,13 +224,7 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren return new Criterion\LocationId($value->limitationValues); } - /** - * Returns info on valid $limitationValues. - * - * @return mixed[]|int In case of array, a hash with key as valid limitations value and value as human readable name - * of that option, in case of int on of VALUE_SCHEMA_ constants. - */ - public function valueSchema() + public function valueSchema(): int { return self::VALUE_SCHEMA_LOCATION_ID; } diff --git a/src/lib/Limitation/NewObjectStateLimitationType.php b/src/lib/Limitation/NewObjectStateLimitationType.php index c8dd82359a..2db85f5b1b 100644 --- a/src/lib/Limitation/NewObjectStateLimitationType.php +++ b/src/lib/Limitation/NewObjectStateLimitationType.php @@ -110,7 +110,7 @@ public function buildValue(array $limitationValues) * * @return bool */ - public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null) + public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null): bool { if (!$value instanceof APINewObjectStateLimitation) { throw new InvalidArgumentException('$value', 'Must be of type: NewObjectStateLimitation'); diff --git a/src/lib/Limitation/NewSectionLimitationType.php b/src/lib/Limitation/NewSectionLimitationType.php index f5643bd3cd..faa03cd792 100644 --- a/src/lib/Limitation/NewSectionLimitationType.php +++ b/src/lib/Limitation/NewSectionLimitationType.php @@ -112,7 +112,7 @@ public function buildValue(array $limitationValues) * * @return bool */ - public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null) + public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null): bool { if (!$value instanceof APINewSectionLimitation) { throw new InvalidArgumentException('$value', 'Must be of type: APINewSectionLimitation'); diff --git a/src/lib/Limitation/ObjectStateLimitationType.php b/src/lib/Limitation/ObjectStateLimitationType.php index 321fdd49c6..4c4775ece7 100644 --- a/src/lib/Limitation/ObjectStateLimitationType.php +++ b/src/lib/Limitation/ObjectStateLimitationType.php @@ -167,7 +167,7 @@ public function evaluate( * * @return bool */ - private function isStateGroupUsedForLimitation($stateGroupId, array $limitationValues) + private function isStateGroupUsedForLimitation($stateGroupId, array $limitationValues): bool { $objectStateHandler = $this->persistence->objectStateHandler(); $states = $objectStateHandler->loadObjectStates($stateGroupId); diff --git a/src/lib/Limitation/OwnerLimitationType.php b/src/lib/Limitation/OwnerLimitationType.php index e06334e5b0..633623b813 100644 --- a/src/lib/Limitation/OwnerLimitationType.php +++ b/src/lib/Limitation/OwnerLimitationType.php @@ -112,7 +112,7 @@ public function buildValue(array $limitationValues) * * @todo Add support for $limitationValues[0] == 2 when session values can be injected somehow, or deprecate */ - public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null) + public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null): bool { if (!$value instanceof APIOwnerLimitation) { throw new InvalidArgumentException('$value', 'Must be of type: APIOwnerLimitation'); diff --git a/src/lib/Limitation/ParentContentTypeLimitationType.php b/src/lib/Limitation/ParentContentTypeLimitationType.php index 504132f1ee..edf10d02aa 100644 --- a/src/lib/Limitation/ParentContentTypeLimitationType.php +++ b/src/lib/Limitation/ParentContentTypeLimitationType.php @@ -183,7 +183,7 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse * * @return bool */ - protected function evaluateForContentCreateStruct(APILimitationValue $value, array $targets = null) + protected function evaluateForContentCreateStruct(APILimitationValue $value, array $targets = null): bool { // If targets is empty/null return false as user does not have access // to content w/o location with this limitation diff --git a/src/lib/Limitation/ParentDepthLimitationType.php b/src/lib/Limitation/ParentDepthLimitationType.php index 0fc70d7873..a8be463053 100644 --- a/src/lib/Limitation/ParentDepthLimitationType.php +++ b/src/lib/Limitation/ParentDepthLimitationType.php @@ -163,7 +163,7 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse * * @return bool */ - protected function evaluateForContentCreateStruct(APILimitationValue $value, array $targets = null) + protected function evaluateForContentCreateStruct(APILimitationValue $value, array $targets = null): bool { // If targets is empty/null return false as user does not have access // to content w/o location with this limitation diff --git a/src/lib/Limitation/ParentOwnerLimitationType.php b/src/lib/Limitation/ParentOwnerLimitationType.php index 335f0dee8f..f839264972 100644 --- a/src/lib/Limitation/ParentOwnerLimitationType.php +++ b/src/lib/Limitation/ParentOwnerLimitationType.php @@ -111,7 +111,7 @@ public function buildValue(array $limitationValues) * * @todo Add support for $limitationValues[0] == 2 when session values can be injected somehow */ - public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null) + public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null): bool { if (!$value instanceof APIParentOwnerLimitation) { throw new InvalidArgumentException('$value', 'Must be of type: APIParentOwnerLimitation'); diff --git a/src/lib/Limitation/ParentUserGroupLimitationType.php b/src/lib/Limitation/ParentUserGroupLimitationType.php index 6bf4f0d3be..216ed26e55 100644 --- a/src/lib/Limitation/ParentUserGroupLimitationType.php +++ b/src/lib/Limitation/ParentUserGroupLimitationType.php @@ -112,7 +112,7 @@ public function buildValue(array $limitationValues) * * @return bool */ - public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null) + public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null): bool { if (!$value instanceof APIParentUserGroupLimitation) { throw new InvalidArgumentException('$value', 'Must be of type: APIParentUserGroupLimitation'); diff --git a/src/lib/Limitation/SiteAccessLimitationType.php b/src/lib/Limitation/SiteAccessLimitationType.php index 674c7ab10a..fb35007e48 100644 --- a/src/lib/Limitation/SiteAccessLimitationType.php +++ b/src/lib/Limitation/SiteAccessLimitationType.php @@ -124,7 +124,7 @@ public function buildValue(array $limitationValues) * * @return bool */ - public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null) + public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null): bool { if (!$value instanceof APISiteAccessLimitation) { throw new InvalidArgumentException('$value', 'Must be of type: APISiteAccessLimitation'); diff --git a/src/lib/Limitation/StatusLimitationType.php b/src/lib/Limitation/StatusLimitationType.php index 23d1a59af4..5efd8e2b47 100644 --- a/src/lib/Limitation/StatusLimitationType.php +++ b/src/lib/Limitation/StatusLimitationType.php @@ -110,7 +110,7 @@ public function buildValue(array $limitationValues) * * @return bool */ - public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null) + public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null): bool { if (!$value instanceof APIStatusLimitation) { throw new InvalidArgumentException('$value', 'Must be of type: APIStatusLimitation'); diff --git a/src/lib/Limitation/SubtreeLimitationType.php b/src/lib/Limitation/SubtreeLimitationType.php index 355ac8943f..67ba1511fc 100644 --- a/src/lib/Limitation/SubtreeLimitationType.php +++ b/src/lib/Limitation/SubtreeLimitationType.php @@ -147,7 +147,7 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse return self::ACCESS_ABSTAIN; } - $targets = array_filter($targets, static function ($target) { + $targets = array_filter($targets, static function ($target): bool { return !$target instanceof Version; }); @@ -194,7 +194,7 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse * * @return bool */ - protected function evaluateForContentCreateStruct(APILimitationValue $value, array $targets) + protected function evaluateForContentCreateStruct(APILimitationValue $value, array $targets): bool { // If targets is empty/null return false as user does not have access // to content w/o location with this limitation @@ -258,13 +258,7 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren return new PermissionSubtree($value->limitationValues); } - /** - * Returns info on valid $limitationValues. - * - * @return mixed[]|int In case of array, a hash with key as valid limitations value and value as human readable name - * of that option, in case of int on of VALUE_SCHEMA_ constants. - */ - public function valueSchema() + public function valueSchema(): int { return self::VALUE_SCHEMA_LOCATION_PATH; } diff --git a/src/lib/Limitation/UserGroupLimitationType.php b/src/lib/Limitation/UserGroupLimitationType.php index 86340bd19b..b00829620a 100644 --- a/src/lib/Limitation/UserGroupLimitationType.php +++ b/src/lib/Limitation/UserGroupLimitationType.php @@ -114,7 +114,7 @@ public function buildValue(array $limitationValues) * * @return bool */ - public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null) + public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null): bool { if (!$value instanceof APIUserGroupLimitation) { throw new InvalidArgumentException('$value', 'Must be of type: APIUserGroupLimitation'); diff --git a/src/lib/MVC/Symfony/Component/Serializer/AbstractPropertyWhitelistNormalizer.php b/src/lib/MVC/Symfony/Component/Serializer/AbstractPropertyWhitelistNormalizer.php index 36154396ab..8f89e3128e 100644 --- a/src/lib/MVC/Symfony/Component/Serializer/AbstractPropertyWhitelistNormalizer.php +++ b/src/lib/MVC/Symfony/Component/Serializer/AbstractPropertyWhitelistNormalizer.php @@ -8,15 +8,25 @@ namespace Ibexa\Core\MVC\Symfony\Component\Serializer; +use Symfony\Component\Serializer\Exception\LogicException; use Symfony\Component\Serializer\Normalizer\PropertyNormalizer; abstract class AbstractPropertyWhitelistNormalizer extends PropertyNormalizer { - public function normalize($object, string $format = null, array $context = []) + /** + * @return array + * + * @throws \Symfony\Component\Serializer\Exception\ExceptionInterface + */ + public function normalize($object, string $format = null, array $context = []): array { - $data = parent::normalize($object, $format, $context); - foreach (array_keys($data) as $property) { - if (!in_array($property, $this->getAllowedProperties())) { + $data = parent::normalize($object, $format, $context) ?? []; + if (!is_array($data)) { + throw new LogicException(sprintf('Expected an array, got "%s"', gettype($data))); + } + + foreach (array_keys(iterator_to_array($data)) as $property) { + if (!in_array($property, $this->getAllowedProperties(), true)) { unset($data[$property]); } } diff --git a/src/lib/MVC/Symfony/Component/Serializer/CompoundMatcherNormalizer.php b/src/lib/MVC/Symfony/Component/Serializer/CompoundMatcherNormalizer.php index 5774f29abb..19410c90ae 100644 --- a/src/lib/MVC/Symfony/Component/Serializer/CompoundMatcherNormalizer.php +++ b/src/lib/MVC/Symfony/Component/Serializer/CompoundMatcherNormalizer.php @@ -12,9 +12,11 @@ class CompoundMatcherNormalizer extends AbstractPropertyWhitelistNormalizer { /** - * @see \Ibexa\Core\MVC\Symfony\SiteAccess\Matcher\Compound::__sleep. + * @throws \Symfony\Component\Serializer\Exception\ExceptionInterface + * + * @see \Ibexa\Core\MVC\Symfony\SiteAccess\Matcher\Compound::__sleep */ - public function normalize($object, string $format = null, array $context = []) + public function normalize($object, string $format = null, array $context = []): array { $data = parent::normalize($object, $format, $context); $data['config'] = []; diff --git a/src/lib/MVC/Symfony/Component/Serializer/HostElementNormalizer.php b/src/lib/MVC/Symfony/Component/Serializer/HostElementNormalizer.php index 0bf22d9025..3ba19e438f 100644 --- a/src/lib/MVC/Symfony/Component/Serializer/HostElementNormalizer.php +++ b/src/lib/MVC/Symfony/Component/Serializer/HostElementNormalizer.php @@ -12,7 +12,7 @@ final class HostElementNormalizer extends AbstractPropertyWhitelistNormalizer { - public function supportsNormalization($data, string $format = null) + public function supportsNormalization($data, string $format = null): bool { return $data instanceof HostElement; } diff --git a/src/lib/MVC/Symfony/Component/Serializer/HostTextNormalizer.php b/src/lib/MVC/Symfony/Component/Serializer/HostTextNormalizer.php index cebf291907..af7b1a6693 100644 --- a/src/lib/MVC/Symfony/Component/Serializer/HostTextNormalizer.php +++ b/src/lib/MVC/Symfony/Component/Serializer/HostTextNormalizer.php @@ -17,7 +17,7 @@ protected function getAllowedProperties(): array return ['siteAccessesConfiguration']; } - public function supportsNormalization($data, string $format = null) + public function supportsNormalization($data, string $format = null): bool { return $data instanceof HostText; } diff --git a/src/lib/MVC/Symfony/Component/Serializer/MapNormalizer.php b/src/lib/MVC/Symfony/Component/Serializer/MapNormalizer.php index 5fbeaa5cfe..80b60cb5bf 100644 --- a/src/lib/MVC/Symfony/Component/Serializer/MapNormalizer.php +++ b/src/lib/MVC/Symfony/Component/Serializer/MapNormalizer.php @@ -15,8 +15,12 @@ final class MapNormalizer extends PropertyNormalizer { /** * @see \Ibexa\Core\MVC\Symfony\SiteAccess\Matcher\Map::__sleep + * + * @param \Ibexa\Core\MVC\Symfony\SiteAccess\Matcher\Map $object + * + * @return array{key: string, map: array{}, reverseMap: array{}} */ - public function normalize($object, string $format = null, array $context = []) + public function normalize($object, string $format = null, array $context = []): array { return [ 'key' => $object->getMapKey(), @@ -25,7 +29,7 @@ public function normalize($object, string $format = null, array $context = []) ]; } - public function supportsNormalization($data, string $format = null) + public function supportsNormalization($data, string $format = null): bool { return $data instanceof Map; } diff --git a/src/lib/MVC/Symfony/Component/Serializer/RegexHostNormalizer.php b/src/lib/MVC/Symfony/Component/Serializer/RegexHostNormalizer.php index bcb59438e0..2aaa3128c2 100644 --- a/src/lib/MVC/Symfony/Component/Serializer/RegexHostNormalizer.php +++ b/src/lib/MVC/Symfony/Component/Serializer/RegexHostNormalizer.php @@ -17,7 +17,7 @@ protected function getAllowedProperties(): array return ['siteAccessesConfiguration']; } - public function supportsNormalization($data, string $format = null) + public function supportsNormalization($data, string $format = null): bool { return $data instanceof Host; } diff --git a/src/lib/MVC/Symfony/Component/Serializer/RegexNormalizer.php b/src/lib/MVC/Symfony/Component/Serializer/RegexNormalizer.php index 0443e6d0c3..c605c30281 100644 --- a/src/lib/MVC/Symfony/Component/Serializer/RegexNormalizer.php +++ b/src/lib/MVC/Symfony/Component/Serializer/RegexNormalizer.php @@ -12,7 +12,7 @@ final class RegexNormalizer extends AbstractPropertyWhitelistNormalizer { - public function supportsNormalization($data, string $format = null) + public function supportsNormalization($data, string $format = null): bool { return $data instanceof Regex; } diff --git a/src/lib/MVC/Symfony/Component/Serializer/RegexURINormalizer.php b/src/lib/MVC/Symfony/Component/Serializer/RegexURINormalizer.php index b3fdeb26ef..391421e7a3 100644 --- a/src/lib/MVC/Symfony/Component/Serializer/RegexURINormalizer.php +++ b/src/lib/MVC/Symfony/Component/Serializer/RegexURINormalizer.php @@ -17,7 +17,7 @@ protected function getAllowedProperties(): array return ['siteAccessesConfiguration']; } - public function supportsNormalization($data, string $format = null) + public function supportsNormalization($data, string $format = null): bool { return $data instanceof URI; } diff --git a/src/lib/MVC/Symfony/Component/Serializer/SimplifiedRequestNormalizer.php b/src/lib/MVC/Symfony/Component/Serializer/SimplifiedRequestNormalizer.php index 05464fa522..8a5c83768c 100644 --- a/src/lib/MVC/Symfony/Component/Serializer/SimplifiedRequestNormalizer.php +++ b/src/lib/MVC/Symfony/Component/Serializer/SimplifiedRequestNormalizer.php @@ -13,11 +13,21 @@ final class SimplifiedRequestNormalizer extends PropertyNormalizer { /** - * @see \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize - * * @param \Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest $object + * + * @return array{ + * scheme: string, + * host: string, + * port: string, + * pathinfo: string, + * queryParams: array, + * languages: string[], + * headers: array{} + * } + * + * @see \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { return [ 'scheme' => $object->scheme, @@ -30,7 +40,7 @@ public function normalize($object, $format = null, array $context = []) ]; } - public function supportsNormalization($data, $format = null, array $context = []) + public function supportsNormalization($data, $format = null, array $context = []): bool { return $data instanceof SimplifiedRequest; } diff --git a/src/lib/MVC/Symfony/Component/Serializer/URIElementNormalizer.php b/src/lib/MVC/Symfony/Component/Serializer/URIElementNormalizer.php index df8d5f3066..0ac40bceec 100644 --- a/src/lib/MVC/Symfony/Component/Serializer/URIElementNormalizer.php +++ b/src/lib/MVC/Symfony/Component/Serializer/URIElementNormalizer.php @@ -12,7 +12,7 @@ final class URIElementNormalizer extends AbstractPropertyWhitelistNormalizer { - public function supportsNormalization($data, string $format = null) + public function supportsNormalization($data, string $format = null): bool { return $data instanceof URIElement; } diff --git a/src/lib/MVC/Symfony/Component/Serializer/URITextNormalizer.php b/src/lib/MVC/Symfony/Component/Serializer/URITextNormalizer.php index 37dbfcf899..a6d50a16d6 100644 --- a/src/lib/MVC/Symfony/Component/Serializer/URITextNormalizer.php +++ b/src/lib/MVC/Symfony/Component/Serializer/URITextNormalizer.php @@ -17,7 +17,7 @@ protected function getAllowedProperties(): array return ['siteAccessesConfiguration']; } - public function supportsNormalization($data, string $format = null) + public function supportsNormalization($data, string $format = null): bool { return $data instanceof URIText; } diff --git a/src/lib/MVC/Symfony/Controller/Content/DownloadRedirectionController.php b/src/lib/MVC/Symfony/Controller/Content/DownloadRedirectionController.php index 49ab74fba1..b212490190 100644 --- a/src/lib/MVC/Symfony/Controller/Content/DownloadRedirectionController.php +++ b/src/lib/MVC/Symfony/Controller/Content/DownloadRedirectionController.php @@ -15,6 +15,7 @@ use InvalidArgumentException; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\RouterInterface; class DownloadRedirectionController extends Controller @@ -71,7 +72,7 @@ public function redirectToContentDownloadAction($contentId, $fieldId, Request $r $downloadRouteRef->getParams() ); - return new RedirectResponse($downloadUrl, 302); + return new RedirectResponse($downloadUrl, Response::HTTP_FOUND); } /** diff --git a/src/lib/MVC/Symfony/Event/APIContentExceptionEvent.php b/src/lib/MVC/Symfony/Event/APIContentExceptionEvent.php index b03560c9b3..ff194fe641 100644 --- a/src/lib/MVC/Symfony/Event/APIContentExceptionEvent.php +++ b/src/lib/MVC/Symfony/Event/APIContentExceptionEvent.php @@ -62,7 +62,7 @@ public function getContentView() /** * @return bool */ - public function hasContentView() + public function hasContentView(): bool { return isset($this->contentView); } diff --git a/src/lib/MVC/Symfony/EventListener/LanguageSwitchListener.php b/src/lib/MVC/Symfony/EventListener/LanguageSwitchListener.php index 3db628d0ce..3b15bd2d8d 100644 --- a/src/lib/MVC/Symfony/EventListener/LanguageSwitchListener.php +++ b/src/lib/MVC/Symfony/EventListener/LanguageSwitchListener.php @@ -26,7 +26,7 @@ public function __construct(TranslationHelper $translationHelper) $this->translationHelper = $translationHelper; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ MVCEvents::ROUTE_REFERENCE_GENERATION => 'onRouteReferenceGeneration', diff --git a/src/lib/MVC/Symfony/EventListener/SiteAccessMatchListener.php b/src/lib/MVC/Symfony/EventListener/SiteAccessMatchListener.php index 1141c72e21..a82f97af7c 100644 --- a/src/lib/MVC/Symfony/EventListener/SiteAccessMatchListener.php +++ b/src/lib/MVC/Symfony/EventListener/SiteAccessMatchListener.php @@ -51,7 +51,7 @@ public function __construct( $this->siteAccessMatcherRegistry = $siteAccessMatcherRegistry; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ // Should take place just after FragmentListener (priority 48) in order to get rebuilt request attributes in case of subrequest diff --git a/src/lib/MVC/Symfony/ExpressionLanguage/TwigVariableProviderExtension.php b/src/lib/MVC/Symfony/ExpressionLanguage/TwigVariableProviderExtension.php index fb5e6f16f5..0ca47ef27c 100644 --- a/src/lib/MVC/Symfony/ExpressionLanguage/TwigVariableProviderExtension.php +++ b/src/lib/MVC/Symfony/ExpressionLanguage/TwigVariableProviderExtension.php @@ -27,7 +27,7 @@ public function getFunctions(): array return [ new ExpressionFunction( 'twig_variable_provider', - static function (string $identifier) { + static function (string $identifier): string { return 'Not implemented: Not a Dependency Injection expression'; }, function (array $variables, string $identifier) { diff --git a/src/lib/MVC/Symfony/FieldType/BinaryBase/ContentDownloadUrlGenerator.php b/src/lib/MVC/Symfony/FieldType/BinaryBase/ContentDownloadUrlGenerator.php index a1fa1cd153..15bb27430c 100644 --- a/src/lib/MVC/Symfony/FieldType/BinaryBase/ContentDownloadUrlGenerator.php +++ b/src/lib/MVC/Symfony/FieldType/BinaryBase/ContentDownloadUrlGenerator.php @@ -26,7 +26,7 @@ public function __construct(RouterInterface $router) $this->router = $router; } - public function getStoragePathForField(Field $field, VersionInfo $versionInfo) + public function getStoragePathForField(Field $field, VersionInfo $versionInfo): string { return $this->generate($this->route, $this->getParameters($field, $versionInfo)); } diff --git a/src/lib/MVC/Symfony/FieldType/View/ParameterProviderRegistry.php b/src/lib/MVC/Symfony/FieldType/View/ParameterProviderRegistry.php index b21a6bfb59..32ddd5f3a7 100644 --- a/src/lib/MVC/Symfony/FieldType/View/ParameterProviderRegistry.php +++ b/src/lib/MVC/Symfony/FieldType/View/ParameterProviderRegistry.php @@ -20,7 +20,7 @@ class ParameterProviderRegistry implements ParameterProviderRegistryInterface * * @return bool */ - public function hasParameterProvider($fieldTypeIdentifier) + public function hasParameterProvider($fieldTypeIdentifier): bool { return isset($this->providers[$fieldTypeIdentifier]); } diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Depth.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Depth.php index 03c8747f8c..4703c40269 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Depth.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Depth.php @@ -23,7 +23,7 @@ class Depth extends MultipleValued * * @return bool */ - public function matchLocation(Location $location) + public function matchLocation(Location $location): bool { return isset($this->values[$location->depth]); } @@ -35,7 +35,7 @@ public function matchLocation(Location $location) * * @return bool */ - public function matchContentInfo(ContentInfo $contentInfo) + public function matchContentInfo(ContentInfo $contentInfo): bool { $location = $this->repository->sudo( static function (Repository $repository) use ($contentInfo) { diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/Content.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/Content.php index 313faf0768..741bb6782d 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/Content.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/Content.php @@ -22,7 +22,7 @@ class Content extends MultipleValued * * @return bool */ - public function matchLocation(APILocation $location) + public function matchLocation(APILocation $location): bool { return isset($this->values[$location->getContentInfo()->id]); } @@ -34,12 +34,12 @@ public function matchLocation(APILocation $location) * * @return bool */ - public function matchContentInfo(ContentInfo $contentInfo) + public function matchContentInfo(ContentInfo $contentInfo): bool { return isset($this->values[$contentInfo->id]); } - public function match(View $view) + public function match(View $view): bool { if (!$view instanceof ContentValueView) { return false; diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentType.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentType.php index 6cb3d694e9..8039550e4d 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentType.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentType.php @@ -22,7 +22,7 @@ class ContentType extends MultipleValued * * @return bool */ - public function matchLocation(APILocation $location) + public function matchLocation(APILocation $location): bool { return isset($this->values[$location->getContentInfo()->contentTypeId]); } @@ -34,12 +34,12 @@ public function matchLocation(APILocation $location) * * @return bool */ - public function matchContentInfo(ContentInfo $contentInfo) + public function matchContentInfo(ContentInfo $contentInfo): bool { return isset($this->values[$contentInfo->contentTypeId]); } - public function match(View $view) + public function match(View $view): bool { if (!$view instanceof ContentValueView) { return false; diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTypeGroup.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTypeGroup.php index 2d609323f7..3b4216778d 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTypeGroup.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTypeGroup.php @@ -51,7 +51,7 @@ public function match(View $view) /** * @return bool */ - private function matchContentTypeId($contentTypeId) + private function matchContentTypeId($contentTypeId): bool { $contentTypeGroups = $this->repository ->getContentTypeService() diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/Location.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/Location.php index 76b776c548..3b9733c180 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/Location.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/Location.php @@ -22,7 +22,7 @@ class Location extends MultipleValued * * @return bool */ - public function matchLocation(APILocation $location) + public function matchLocation(APILocation $location): bool { return isset($this->values[$location->id]); } @@ -34,12 +34,12 @@ public function matchLocation(APILocation $location) * * @return bool */ - public function matchContentInfo(ContentInfo $contentInfo) + public function matchContentInfo(ContentInfo $contentInfo): bool { return isset($this->values[$contentInfo->mainLocationId]); } - public function match(View $view) + public function match(View $view): bool { if (!$view instanceof LocationValueView) { return false; diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/LocationRemote.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/LocationRemote.php index 6187b895d6..3d3a34b5cc 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/LocationRemote.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/LocationRemote.php @@ -37,7 +37,7 @@ public function matchContentInfo(ContentInfo $contentInfo) { } - public function match(View $view) + public function match(View $view): bool { if (!$view instanceof LocationValueView) { return false; diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentContentType.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentContentType.php index 7d93b13afe..1843af3e82 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentContentType.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentContentType.php @@ -23,7 +23,7 @@ class ParentContentType extends MultipleValued * * @return bool */ - public function matchLocation(APILocation $location) + public function matchLocation(APILocation $location): bool { $parent = $this->repository->sudo( static function (Repository $repository) use ($location) { @@ -52,7 +52,7 @@ static function (Repository $repository) use ($contentInfo) { return $this->matchLocation($location); } - public function match(View $view) + public function match(View $view): bool { if (!$view instanceof LocationValueView) { return false; diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentLocation.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentLocation.php index efadf73c51..ff3ab61ae3 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentLocation.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentLocation.php @@ -23,7 +23,7 @@ class ParentLocation extends MultipleValued * * @return bool */ - public function matchLocation(APILocation $location) + public function matchLocation(APILocation $location): bool { return isset($this->values[$location->parentLocationId]); } @@ -35,7 +35,7 @@ public function matchLocation(APILocation $location) * * @return bool */ - public function matchContentInfo(ContentInfo $contentInfo) + public function matchContentInfo(ContentInfo $contentInfo): bool { $location = $this->repository->sudo( static function (Repository $repository) use ($contentInfo) { @@ -46,7 +46,7 @@ static function (Repository $repository) use ($contentInfo) { return isset($this->values[$location->parentLocationId]); } - public function match(View $view) + public function match(View $view): bool { if (!$view instanceof LocationValueView) { return false; diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/Remote.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/Remote.php index 5c404947bf..9cae3d311b 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/Remote.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/Remote.php @@ -22,7 +22,7 @@ class Remote extends MultipleValued * * @return bool */ - public function matchLocation(APILocation $location) + public function matchLocation(APILocation $location): bool { return isset($this->values[$location->remoteId]); } @@ -34,12 +34,12 @@ public function matchLocation(APILocation $location) * * @return bool */ - public function matchContentInfo(ContentInfo $contentInfo) + public function matchContentInfo(ContentInfo $contentInfo): bool { return isset($this->values[$contentInfo->remoteId]); } - public function match(View $view) + public function match(View $view): bool { if (!$view instanceof ContentValueView) { return false; diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/Section.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/Section.php index 3f4d35e4dc..e05d569851 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/Section.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/Section.php @@ -22,7 +22,7 @@ class Section extends MultipleValued * * @return bool */ - public function matchLocation(APILocation $location) + public function matchLocation(APILocation $location): bool { return isset($this->values[$location->getContentInfo()->getSectionId()]); } @@ -34,12 +34,12 @@ public function matchLocation(APILocation $location) * * @return bool */ - public function matchContentInfo(ContentInfo $contentInfo) + public function matchContentInfo(ContentInfo $contentInfo): bool { return isset($this->values[$contentInfo->getSectionId()]); } - public function match(View $view) + public function match(View $view): bool { if (!$view instanceof ContentValueView) { return false; diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ContentType.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ContentType.php index a1abeecaa9..266e2d5876 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ContentType.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ContentType.php @@ -22,7 +22,7 @@ class ContentType extends MultipleValued * * @return bool */ - public function matchLocation(Location $location) + public function matchLocation(Location $location): bool { $contentType = $this->repository ->getContentTypeService() @@ -38,7 +38,7 @@ public function matchLocation(Location $location) * * @return bool */ - public function matchContentInfo(ContentInfo $contentInfo) + public function matchContentInfo(ContentInfo $contentInfo): bool { $contentType = $this->repository ->getContentTypeService() @@ -47,7 +47,7 @@ public function matchContentInfo(ContentInfo $contentInfo) return isset($this->values[$contentType->identifier]); } - public function match(View $view) + public function match(View $view): bool { if (!$view instanceof ContentValueView) { return false; diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ParentContentType.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ParentContentType.php index 52969c39d3..b52ec15ee5 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ParentContentType.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ParentContentType.php @@ -24,7 +24,7 @@ class ParentContentType extends MultipleValued * * @return bool */ - public function matchLocation(APILocation $location) + public function matchLocation(APILocation $location): bool { $parentContentType = $this->repository->sudo( static function (Repository $repository) use ($location) { diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/Section.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/Section.php index 41876b240a..89f5360ecd 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/Section.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/Section.php @@ -23,7 +23,7 @@ class Section extends MultipleValued * * @return bool */ - public function matchLocation(Location $location) + public function matchLocation(Location $location): bool { $section = $this->repository->sudo( static function (Repository $repository) use ($location) { @@ -43,7 +43,7 @@ static function (Repository $repository) use ($location) { * * @return bool */ - public function matchContentInfo(ContentInfo $contentInfo) + public function matchContentInfo(ContentInfo $contentInfo): bool { $section = $this->repository->sudo( static function (Repository $repository) use ($contentInfo) { @@ -56,7 +56,7 @@ static function (Repository $repository) use ($contentInfo) { return isset($this->values[$section->identifier]); } - public function match(View $view) + public function match(View $view): bool { if (!$view instanceof ContentValueView) { return false; diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/UrlAlias.php b/src/lib/MVC/Symfony/Matcher/ContentBased/UrlAlias.php index 34107f2aa0..906debd877 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/UrlAlias.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/UrlAlias.php @@ -21,7 +21,7 @@ class UrlAlias extends MultipleValued * * @return bool */ - public function matchLocation(Location $location) + public function matchLocation(Location $location): bool { $urlAliasService = $this->repository->getURLAliasService(); $locationUrls = array_merge( diff --git a/src/lib/MVC/Symfony/Routing/Generator/UrlAliasGenerator.php b/src/lib/MVC/Symfony/Routing/Generator/UrlAliasGenerator.php index 18ec998bd3..41abb9a31d 100644 --- a/src/lib/MVC/Symfony/Routing/Generator/UrlAliasGenerator.php +++ b/src/lib/MVC/Symfony/Routing/Generator/UrlAliasGenerator.php @@ -69,7 +69,7 @@ public function __construct(Repository $repository, RouterInterface $defaultRout * * @return string */ - public function doGenerate($location, array $parameters) + public function doGenerate($location, array $parameters): string { $siteAccess = $parameters['siteaccess'] ?? null; @@ -143,7 +143,7 @@ public function getPathPrefixByRootLocationId($rootLocationId, $languages = null * * @return bool */ - public function isUriPrefixExcluded($uri) + public function isUriPrefixExcluded($uri): bool { foreach ($this->excludedUriPrefixes as $excludedPrefix) { $excludedPrefix = '/' . ltrim($excludedPrefix, '/'); diff --git a/src/lib/MVC/Symfony/Routing/UrlAliasRouter.php b/src/lib/MVC/Symfony/Routing/UrlAliasRouter.php index 3cdb02ea24..dc62d9f509 100644 --- a/src/lib/MVC/Symfony/Routing/UrlAliasRouter.php +++ b/src/lib/MVC/Symfony/Routing/UrlAliasRouter.php @@ -263,7 +263,7 @@ protected function getUrlAlias($pathinfo) * * @return \Symfony\Component\Routing\RouteCollection A RouteCollection instance */ - public function getRouteCollection() + public function getRouteCollection(): RouteCollection { return new RouteCollection(); } diff --git a/src/lib/MVC/Symfony/Security/Authorization/Voter/CoreVoter.php b/src/lib/MVC/Symfony/Security/Authorization/Voter/CoreVoter.php index b3695a212c..8a58d7ef21 100644 --- a/src/lib/MVC/Symfony/Security/Authorization/Voter/CoreVoter.php +++ b/src/lib/MVC/Symfony/Security/Authorization/Voter/CoreVoter.php @@ -29,7 +29,7 @@ public function __construct(PermissionResolver $permissionResolver) * * @return bool true if this Voter supports the attribute, false otherwise */ - public function supportsAttribute($attribute) + public function supportsAttribute($attribute): bool { return $attribute instanceof AuthorizationAttribute && empty($attribute->limitations); } @@ -41,7 +41,7 @@ public function supportsAttribute($attribute) * * @return true if this Voter can process the class */ - public function supportsClass($class) + public function supportsClass($class): bool { return true; } @@ -58,7 +58,7 @@ public function supportsClass($class) * * @return int either ACCESS_GRANTED, ACCESS_ABSTAIN, or ACCESS_DENIED */ - public function vote(TokenInterface $token, $object, array $attributes) + public function vote(TokenInterface $token, $object, array $attributes): int { foreach ($attributes as $attribute) { if ($this->supportsAttribute($attribute)) { diff --git a/src/lib/MVC/Symfony/Security/Authorization/Voter/ValueObjectVoter.php b/src/lib/MVC/Symfony/Security/Authorization/Voter/ValueObjectVoter.php index d8e36aab95..422308faff 100644 --- a/src/lib/MVC/Symfony/Security/Authorization/Voter/ValueObjectVoter.php +++ b/src/lib/MVC/Symfony/Security/Authorization/Voter/ValueObjectVoter.php @@ -25,12 +25,12 @@ public function __construct(PermissionResolver $permissionResolver) $this->permissionResolver = $permissionResolver; } - public function supportsAttribute($attribute) + public function supportsAttribute($attribute): bool { return $attribute instanceof AuthorizationAttribute && isset($attribute->limitations['valueObject']); } - public function supportsClass($class) + public function supportsClass($class): bool { return true; } @@ -54,7 +54,7 @@ public function supportsClass($class) * * @return int either ACCESS_GRANTED, ACCESS_ABSTAIN, or ACCESS_DENIED */ - public function vote(TokenInterface $token, $object, array $attributes) + public function vote(TokenInterface $token, $object, array $attributes): int { foreach ($attributes as $attribute) { if ($this->supportsAttribute($attribute)) { diff --git a/src/lib/MVC/Symfony/Security/HttpUtils.php b/src/lib/MVC/Symfony/Security/HttpUtils.php index bc382f66c7..24190d6087 100644 --- a/src/lib/MVC/Symfony/Security/HttpUtils.php +++ b/src/lib/MVC/Symfony/Security/HttpUtils.php @@ -54,7 +54,7 @@ public function checkRequestPath(Request $request, $path) * * @return bool */ - private function isRouteName($path) + private function isRouteName($path): bool { return $path && strpos($path, 'http') !== 0 && strpos($path, '/') !== 0; } diff --git a/src/lib/MVC/Symfony/Security/User.php b/src/lib/MVC/Symfony/Security/User.php index 299877d6b8..db17bbc6d4 100644 --- a/src/lib/MVC/Symfony/Security/User.php +++ b/src/lib/MVC/Symfony/Security/User.php @@ -80,6 +80,11 @@ public function getSalt(): ?string * Returns the username used to authenticate the user. */ public function getUsername(): string + { + return $this->getUserIdentifier(); + } + + public function getUserIdentifier(): string { return $this->getAPIUser()->getLogin(); } diff --git a/src/lib/MVC/Symfony/Security/User/BaseProvider.php b/src/lib/MVC/Symfony/Security/User/BaseProvider.php index b9f7ffe1c5..a75f3e5ac6 100644 --- a/src/lib/MVC/Symfony/Security/User/BaseProvider.php +++ b/src/lib/MVC/Symfony/Security/User/BaseProvider.php @@ -17,7 +17,7 @@ use Ibexa\Core\MVC\Symfony\Security\UserInterface; use Ibexa\Core\Repository\Values\User\UserReference; use Symfony\Component\Security\Core\Exception\UnsupportedUserException; -use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; +use Symfony\Component\Security\Core\Exception\UserNotFoundException; use Symfony\Component\Security\Core\User\UserInterface as CoreUserInterface; abstract class BaseProvider implements APIUserProviderInterface @@ -36,7 +36,7 @@ public function __construct( $this->userService = $userService; } - public function refreshUser(CoreUserInterface $user) + public function refreshUser(CoreUserInterface $user): CoreUserInterface { if (!$user instanceof UserInterface) { throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user))); @@ -55,7 +55,7 @@ public function refreshUser(CoreUserInterface $user) return $user; } catch (NotFoundException $e) { - throw new UsernameNotFoundException($e->getMessage(), 0, $e); + throw new UserNotFoundException($e->getMessage(), 0, $e); } } @@ -66,7 +66,7 @@ public function refreshUser(CoreUserInterface $user) * * @return bool */ - public function supportsClass($class) + public function supportsClass($class): bool { return $class === UserInterface::class || is_subclass_of($class, UserInterface::class); } diff --git a/src/lib/MVC/Symfony/Security/UserWrapped.php b/src/lib/MVC/Symfony/Security/UserWrapped.php index 9022edecce..a417445ac6 100644 --- a/src/lib/MVC/Symfony/Security/UserWrapped.php +++ b/src/lib/MVC/Symfony/Security/UserWrapped.php @@ -102,7 +102,7 @@ public function getWrappedUser() return $this->wrappedUser; } - public function getRoles() + public function getRoles(): array { return $this->wrappedUser->getRoles(); } diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/HostElement.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/HostElement.php index 72927a907b..0554c20a80 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/HostElement.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/HostElement.php @@ -61,7 +61,7 @@ public function match() return isset($elements[$this->elementNumber - 1]) ? $elements[$this->elementNumber - 1] : false; } - public function getName() + public function getName(): string { return 'host:element'; } diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Host.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Host.php index d9380fa24b..a04ef3967c 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Host.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Host.php @@ -12,7 +12,7 @@ class Host extends Map { - public function getName() + public function getName(): string { return 'host:map'; } diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Port.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Port.php index 33c3b44740..1c7083f7fe 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Port.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Port.php @@ -12,7 +12,7 @@ class Port extends Map { - public function getName() + public function getName(): string { return 'port'; } diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/URI.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/URI.php index d6a76026ed..c4aa6c2bca 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/URI.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/URI.php @@ -28,7 +28,7 @@ public function setRequest(SimplifiedRequest $request) parent::setRequest($request); } - public function getName() + public function getName(): string { return 'uri:map'; } @@ -60,7 +60,7 @@ public function analyseURI($uri) * * @return string The modified link URI */ - public function analyseLink($linkUri) + public function analyseLink($linkUri): string { // Joining slash between uriElements and actual linkUri must be present, except if $linkUri is empty or is just the slash root. $joiningSlash = empty($linkUri) || ($linkUri === '/') ? '' : '/'; diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/Host.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/Host.php index 660bc4ea0e..78a7bdf2ef 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/Host.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/Host.php @@ -37,7 +37,7 @@ public function __construct(array $siteAccessesConfiguration) $this->siteAccessesConfiguration = $siteAccessesConfiguration; } - public function getName() + public function getName(): string { return 'host:regexp'; } diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/URI.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/URI.php index a8d8e1a7b1..9d49eeb30c 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/URI.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/URI.php @@ -37,7 +37,7 @@ public function __construct(array $siteAccessesConfiguration) $this->siteAccessesConfiguration = $siteAccessesConfiguration; } - public function getName() + public function getName(): string { return 'uri:regexp'; } diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/URIElement.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/URIElement.php index 797a503b28..11c5dcd8ec 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/URIElement.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/URIElement.php @@ -100,7 +100,7 @@ protected function getURIElements() return $this->uriElements = $elements; } - public function getName() + public function getName(): string { return 'uri:element'; } @@ -149,7 +149,7 @@ public function analyseURI($uri) * * @return string The modified link URI */ - public function analyseLink($linkUri) + public function analyseLink($linkUri): string { // Joining slash between uriElements and actual linkUri must be present, except if $linkUri is empty. $joiningSlash = empty($linkUri) ? '' : '/'; diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtension.php index 971f8bbd7a..10ec36c376 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtension.php @@ -99,7 +99,7 @@ public function getFilters() * * @return string */ - public function sizeFilter($number, $precision) + public function sizeFilter($number, $precision): string|false { $mod = 1024; $index = count($this->suffixes); diff --git a/src/lib/MVC/Symfony/Translation/CatalogueMapperFileWriter.php b/src/lib/MVC/Symfony/Translation/CatalogueMapperFileWriter.php index f78e1b9470..1d90f7cb48 100644 --- a/src/lib/MVC/Symfony/Translation/CatalogueMapperFileWriter.php +++ b/src/lib/MVC/Symfony/Translation/CatalogueMapperFileWriter.php @@ -20,6 +20,8 @@ */ class CatalogueMapperFileWriter extends FileWriter { + private const string XLF_FILE_NAME_REGEX_PATTERN = '/\.[-_a-z]+\.xlf$/i'; + /** @var \JMS\TranslationBundle\Translation\LoaderManager */ private $loaderManager; @@ -74,14 +76,14 @@ public function write(MessageCatalogue $catalogue, $domain, $filePath, $format) $this->innerFileWriter->write($newCatalogue, $domain, $filePath, $format); } - /** - * @param $filePath - * - * @return mixed - */ - private function getEnglishFilePath($filePath) + private function getEnglishFilePath(string $filePath): string { - return preg_replace('/\.[-_a-z]+\.xlf$/i', '.en.xlf', $filePath); + $enFilePath = preg_replace(self::XLF_FILE_NAME_REGEX_PATTERN, '.en.xlf', $filePath); + if (null === $enFilePath) { + throw new InvalidArgumentException("failed to get English XLF file path for '$filePath'"); + } + + return $enFilePath; } /** @@ -101,7 +103,7 @@ private function loadEnglishCatalogue($foreignFilePath, $domain, $format) ); } - private function hasEnglishCatalogue($foreignFilePath) + private function hasEnglishCatalogue($foreignFilePath): bool { return file_exists($this->getEnglishFilePath($foreignFilePath)); } diff --git a/src/lib/MVC/Symfony/View/Builder/ContentViewBuilder.php b/src/lib/MVC/Symfony/View/Builder/ContentViewBuilder.php index 6037543115..6df71a3b6c 100644 --- a/src/lib/MVC/Symfony/View/Builder/ContentViewBuilder.php +++ b/src/lib/MVC/Symfony/View/Builder/ContentViewBuilder.php @@ -68,7 +68,7 @@ public function __construct( $this->requestStack = $requestStack; } - public function matches($argument) + public function matches($argument): bool { return strpos($argument, 'ibexa_content:') !== false; } @@ -283,7 +283,7 @@ private function canRead(Content $content, Location $location = null, bool $isEm * * @return bool */ - private function isEmbed($parameters) + private function isEmbed($parameters): bool { if ($parameters['_controller'] === 'ibexa_content:embedAction') { return true; diff --git a/src/lib/MVC/Symfony/View/Builder/ParametersFilter/RequestAttributes.php b/src/lib/MVC/Symfony/View/Builder/ParametersFilter/RequestAttributes.php index d03b53a0b5..c88679fddc 100644 --- a/src/lib/MVC/Symfony/View/Builder/ParametersFilter/RequestAttributes.php +++ b/src/lib/MVC/Symfony/View/Builder/ParametersFilter/RequestAttributes.php @@ -16,7 +16,7 @@ */ class RequestAttributes implements EventSubscriberInterface { - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ViewEvents::FILTER_BUILDER_PARAMETERS => 'addRequestAttributes']; } diff --git a/src/lib/MVC/Symfony/View/CustomLocationControllerChecker.php b/src/lib/MVC/Symfony/View/CustomLocationControllerChecker.php index 8bcb2a0386..a97e1c7ce4 100644 --- a/src/lib/MVC/Symfony/View/CustomLocationControllerChecker.php +++ b/src/lib/MVC/Symfony/View/CustomLocationControllerChecker.php @@ -29,7 +29,7 @@ class CustomLocationControllerChecker * * @return bool */ - public function usesCustomController(Content $content, Location $location, $viewMode = 'full') + public function usesCustomController(Content $content, Location $location, $viewMode = 'full'): bool { $contentView = new ContentView(null, [], $viewMode); $contentView->setContent($content); diff --git a/src/lib/MVC/Symfony/View/ParametersInjector/CustomParameters.php b/src/lib/MVC/Symfony/View/ParametersInjector/CustomParameters.php index bc848a6e9d..7a30313c76 100644 --- a/src/lib/MVC/Symfony/View/ParametersInjector/CustomParameters.php +++ b/src/lib/MVC/Symfony/View/ParametersInjector/CustomParameters.php @@ -16,7 +16,7 @@ */ class CustomParameters implements EventSubscriberInterface { - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ViewEvents::FILTER_VIEW_PARAMETERS => 'injectCustomParameters']; } diff --git a/src/lib/MVC/Symfony/View/ParametersInjector/EmbedObjectParameters.php b/src/lib/MVC/Symfony/View/ParametersInjector/EmbedObjectParameters.php index 8e3c65f125..8ae533855d 100644 --- a/src/lib/MVC/Symfony/View/ParametersInjector/EmbedObjectParameters.php +++ b/src/lib/MVC/Symfony/View/ParametersInjector/EmbedObjectParameters.php @@ -16,7 +16,7 @@ */ class EmbedObjectParameters implements EventSubscriberInterface { - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ViewEvents::FILTER_VIEW_PARAMETERS => 'injectEmbedObjectParameters']; } diff --git a/src/lib/MVC/Symfony/View/ParametersInjector/NoLayout.php b/src/lib/MVC/Symfony/View/ParametersInjector/NoLayout.php index 0e9fdbcee5..178aa3c828 100644 --- a/src/lib/MVC/Symfony/View/ParametersInjector/NoLayout.php +++ b/src/lib/MVC/Symfony/View/ParametersInjector/NoLayout.php @@ -16,7 +16,7 @@ */ class NoLayout implements EventSubscriberInterface { - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ViewEvents::FILTER_VIEW_PARAMETERS => 'injectCustomParameters']; } diff --git a/src/lib/MVC/Symfony/View/ParametersInjector/ValueObjectsIds.php b/src/lib/MVC/Symfony/View/ParametersInjector/ValueObjectsIds.php index 3afde6a271..4221231683 100644 --- a/src/lib/MVC/Symfony/View/ParametersInjector/ValueObjectsIds.php +++ b/src/lib/MVC/Symfony/View/ParametersInjector/ValueObjectsIds.php @@ -18,7 +18,7 @@ */ class ValueObjectsIds implements EventSubscriberInterface { - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [View\ViewEvents::FILTER_VIEW_PARAMETERS => 'injectValueObjectsIds']; } diff --git a/src/lib/MVC/Symfony/View/ParametersInjector/ViewbaseLayout.php b/src/lib/MVC/Symfony/View/ParametersInjector/ViewbaseLayout.php index 96f3c00927..0548cb4572 100644 --- a/src/lib/MVC/Symfony/View/ParametersInjector/ViewbaseLayout.php +++ b/src/lib/MVC/Symfony/View/ParametersInjector/ViewbaseLayout.php @@ -29,7 +29,7 @@ public function __construct($viewbaseLayout, ConfigResolverInterface $configReso $this->configResolver = $configResolver; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ViewEvents::FILTER_VIEW_PARAMETERS => 'injectViewbaseLayout']; } diff --git a/src/lib/Persistence/Cache/ObjectStateHandler.php b/src/lib/Persistence/Cache/ObjectStateHandler.php index e66806e21e..a1dd875ecb 100644 --- a/src/lib/Persistence/Cache/ObjectStateHandler.php +++ b/src/lib/Persistence/Cache/ObjectStateHandler.php @@ -102,7 +102,7 @@ function (Group $group) use ($escapedIdentifier): array { /** * {@inheritdoc} */ - public function loadAllGroups($offset = 0, $limit = -1) + public function loadAllGroups($offset = 0, $limit = -1): array { $stateGroups = $this->getListCacheValue( $this->cacheIdentifierGenerator->generateKey(self::STATE_GROUP_ALL_IDENTIFIER, [], true), diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/AuthorConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/AuthorConverter.php index 77c89d3b07..6ce82ff8b1 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/AuthorConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/AuthorConverter.php @@ -8,6 +8,7 @@ namespace Ibexa\Core\Persistence\Legacy\Content\FieldValue\Converter; use DOMDocument; +use Ibexa\Contracts\Core\Exception\InvalidArgumentException; use Ibexa\Contracts\Core\Persistence\Content\FieldValue; use Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition; use Ibexa\Core\FieldType\Author\Type as AuthorType; @@ -33,10 +34,8 @@ public static function create() } /** - * Converts data from $value to $storageFieldValue. - * - * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value - * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue + * @throws \DOMException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) { @@ -97,7 +96,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { return 'sort_key_string'; } @@ -108,8 +107,11 @@ public function getIndexColumn() * @param array $authorValue * * @return string The generated XML string + * + * @throws \DOMException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ - private function generateXmlString(array $authorValue) + private function generateXmlString(array $authorValue): string { $doc = new DOMDocument('1.0', 'utf-8'); @@ -121,14 +123,26 @@ private function generateXmlString(array $authorValue) foreach ($authorValue as $author) { $authorNode = $doc->createElement('author'); - $authorNode->setAttribute('id', $author['id']); + $authorNode->setAttribute('id', (string)$author['id']); $authorNode->setAttribute('name', $author['name']); $authorNode->setAttribute('email', $author['email']); $authors->appendChild($authorNode); unset($authorNode); } - return $doc->saveXML(); + $xml = $doc->saveXML(); + if (false === $xml) { + $lastError = libxml_get_last_error(); + throw new InvalidArgumentException( + '$authorValue', + sprintf( + 'AuthorConverter: an error occurred when trying to save author field data: %s', + $lastError !== false ? $lastError->message : 'unknown error' + ) + ); + } + + return $xml; } /** diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/CheckboxConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/CheckboxConverter.php index f736f267f6..009e5c4271 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/CheckboxConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/CheckboxConverter.php @@ -84,7 +84,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { return 'sort_key_int'; } diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/CountryConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/CountryConverter.php index eadc9795db..65cbd59657 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/CountryConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/CountryConverter.php @@ -102,7 +102,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { return 'sort_key_string'; } diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeConverter.php index 0bf27e9c43..008a6ee045 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeConverter.php @@ -10,6 +10,7 @@ use DateInterval; use DateTime; use DOMDocument; +use Ibexa\Contracts\Core\Exception\InvalidArgumentException; use Ibexa\Contracts\Core\Persistence\Content\FieldValue; use Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition; use Ibexa\Core\FieldType\DateAndTime\Type as DateAndTimeType; @@ -147,7 +148,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { return 'sort_key_int'; } @@ -155,11 +156,10 @@ public function getIndexColumn() /** * Generates the internal XML structure for $dateInterval, used for date adjustment. * - * @param \DateInterval $dateInterval - * - * @return string The generated XML string + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \DOMException */ - protected function generateDateIntervalXML(DateInterval $dateInterval) + protected function generateDateIntervalXML(DateInterval $dateInterval): string { // Constructing XML structure $doc = new DOMDocument('1.0', 'utf-8'); @@ -197,7 +197,19 @@ protected function generateDateIntervalXML(DateInterval $dateInterval) $doc->appendChild($root); - return $doc->saveXML(); + $xml = $doc->saveXML(); + if (false === $xml) { + $lastError = libxml_get_last_error(); + throw new InvalidArgumentException( + '$dateInterval', + sprintf( + 'DateAndTimeConverter: an error occurred when trying to save date and time field data: %s', + $lastError !== false ? $lastError->message : 'unknown error' + ) + ); + } + + return $xml; } /** diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/DateConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/DateConverter.php index a3192134f1..5266c7f018 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/DateConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/DateConverter.php @@ -115,7 +115,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { return 'sort_key_int'; } diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/EmailAddressConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/EmailAddressConverter.php index bd8ed08e4a..a9bd35900b 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/EmailAddressConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/EmailAddressConverter.php @@ -89,7 +89,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { return 'sort_key_string'; } diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/FloatConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/FloatConverter.php index fd9ce297e2..e8e9ab045b 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/FloatConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/FloatConverter.php @@ -111,7 +111,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { return 'sort_key_string'; } @@ -127,7 +127,7 @@ public function getIndexColumn() * * @return int */ - private function getStorageDefValidatorState($minValue, $maxValue) + private function getStorageDefValidatorState($minValue, $maxValue): int { $state = 0; diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ISBNConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ISBNConverter.php index 621db48b5d..0fb3e540e2 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ISBNConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ISBNConverter.php @@ -98,7 +98,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { return 'sort_key_string'; } diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageAssetConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageAssetConverter.php index 3f524f1b5f..9077569f3d 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageAssetConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageAssetConverter.php @@ -77,7 +77,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { return 'sort_key_string'; } diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php index 2f16e78123..c6f7d01b5f 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php @@ -109,7 +109,7 @@ protected function createLegacyXml(array $data) * * @return string */ - protected function fillXml($imageData, $pathInfo, $timestamp) + protected function fillXml($imageData, $pathInfo, $timestamp): string { $additionalData = $this->buildAdditionalDataTag($imageData['additionalData'] ?? []); diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/IntegerConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/IntegerConverter.php index f08ef8760c..dcfc8f0041 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/IntegerConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/IntegerConverter.php @@ -117,7 +117,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { return 'sort_key_int'; } @@ -133,7 +133,7 @@ public function getIndexColumn() * * @return int */ - private function getStorageDefValidatorState($minValue, $maxValue) + private function getStorageDefValidatorState($minValue, $maxValue): int { $state = 0; diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/KeywordConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/KeywordConverter.php index 0a96f28b87..b13aaf685a 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/KeywordConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/KeywordConverter.php @@ -81,7 +81,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { return 'sort_key_string'; } diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/MapLocationConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/MapLocationConverter.php index 94879798aa..ae3ed50636 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/MapLocationConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/MapLocationConverter.php @@ -81,7 +81,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { return 'sort_key_string'; } diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/MediaConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/MediaConverter.php index 8644e3fb14..6284a80e4b 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/MediaConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/MediaConverter.php @@ -59,17 +59,8 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin ); } - /** - * Returns the name of the index column in the attribute table. - * - * Returns the name of the index column the datatype uses, which is either - * "sort_key_int" or "sort_key_string". This column is then used for - * filtering and sorting for this type. - * - * @return string - */ - public function getIndexColumn() + public function getIndexColumn(): string { - return false; + return ''; } } diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/NullConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/NullConverter.php index fc59ebe90a..360c48bc30 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/NullConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/NullConverter.php @@ -86,10 +86,8 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * Returns the name of the index column the datatype uses, which is either * "sort_key_int" or "sort_key_string". This column is then used for * filtering and sorting for this type. - * - * @return string */ - public function getIndexColumn() + public function getIndexColumn(): bool { return false; } diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationConverter.php index 9b03b0f1bb..d1ff7740ba 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationConverter.php @@ -192,7 +192,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { return 'sort_key_int'; } diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationListConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationListConverter.php index d4ddb2c437..9a3dc4a568 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationListConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationListConverter.php @@ -264,7 +264,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { return 'sort_key_string'; } diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/SelectionConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/SelectionConverter.php index bd05c2e6e0..234f65771c 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/SelectionConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/SelectionConverter.php @@ -151,7 +151,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { return 'sort_key_string'; } diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextBlockConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextBlockConverter.php index df3723773d..8ec266d445 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextBlockConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextBlockConverter.php @@ -93,7 +93,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { return 'sort_key_string'; } diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextLineConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextLineConverter.php index d92b8f7432..ea74c13226 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextLineConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextLineConverter.php @@ -115,7 +115,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { return 'sort_key_string'; } diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TimeConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TimeConverter.php index 142adb2037..8858fd142e 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TimeConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TimeConverter.php @@ -116,7 +116,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { return 'sort_key_int'; } diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/UrlConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/UrlConverter.php index 67b135f59c..f91c6570ed 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/UrlConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/UrlConverter.php @@ -92,7 +92,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return false */ - public function getIndexColumn() + public function getIndexColumn(): bool { return false; } diff --git a/src/lib/Persistence/Legacy/Content/Handler.php b/src/lib/Persistence/Legacy/Content/Handler.php index cb8b3afc6e..1a8ef9d195 100644 --- a/src/lib/Persistence/Legacy/Content/Handler.php +++ b/src/lib/Persistence/Legacy/Content/Handler.php @@ -466,12 +466,9 @@ public function loadContentInfoByRemoteId($remoteId) ); } - /** - * {@inheritdoc} - */ - public function loadVersionInfo($contentId, $versionNo = null) + public function loadVersionInfo($contentId, $versionNo = null): VersionInfo { - $rows = $this->contentGateway->loadVersionInfo($contentId, $versionNo); + $rows = $this->contentGateway->loadVersionInfo((int)$contentId, $versionNo); if (empty($rows)) { throw new NotFound('content', $contentId); } @@ -481,7 +478,12 @@ public function loadVersionInfo($contentId, $versionNo = null) $this->contentGateway->loadVersionedNameData([['id' => $contentId, 'version' => $rows[0]['ezcontentobject_version_version']]]) ); - return reset($versionInfo); + $versionInfo = reset($versionInfo); + if (false === $versionInfo) { + throw new NotFound('versionInfo', $contentId); + } + + return $versionInfo; } public function countDraftsForUser(int $userId): int @@ -933,7 +935,7 @@ public function deleteTranslationFromDraft($contentId, $versionNo, $languageCode // get all [languageCode => name] entries except the removed Translation $names = array_filter( $versionInfo->names, - static function ($lang) use ($languageCode) { + static function ($lang) use ($languageCode): bool { return $lang !== $languageCode; }, ARRAY_FILTER_USE_KEY diff --git a/src/lib/Persistence/Legacy/Content/Language/Handler.php b/src/lib/Persistence/Legacy/Content/Language/Handler.php index 1f172a5968..13a37c7b16 100644 --- a/src/lib/Persistence/Legacy/Content/Language/Handler.php +++ b/src/lib/Persistence/Legacy/Content/Language/Handler.php @@ -80,7 +80,7 @@ public function update(Language $language) * * @return \Ibexa\Contracts\Core\Persistence\Content\Language */ - public function load($id) + public function load($id): Language { $languages = $this->languageMapper->extractLanguagesFromRows( $this->languageGateway->loadLanguageListData([$id]) @@ -113,7 +113,7 @@ public function loadList(array $ids): iterable * * @return \Ibexa\Contracts\Core\Persistence\Content\Language */ - public function loadByLanguageCode($languageCode) + public function loadByLanguageCode($languageCode): Language { $languages = $this->languageMapper->extractLanguagesFromRows( $this->languageGateway->loadLanguageListDataByLanguageCode([$languageCode]) diff --git a/src/lib/Persistence/Legacy/Content/Language/MaskGenerator.php b/src/lib/Persistence/Legacy/Content/Language/MaskGenerator.php index feca1e2081..7d81269b75 100644 --- a/src/lib/Persistence/Legacy/Content/Language/MaskGenerator.php +++ b/src/lib/Persistence/Legacy/Content/Language/MaskGenerator.php @@ -43,7 +43,7 @@ public function __construct(LanguageHandler $languageHandler) * * @return int */ - public function generateLanguageMask(array $languages) + public function generateLanguageMask(array $languages): int { $mask = 0; if (isset($languages['always-available'])) { @@ -94,7 +94,7 @@ public function generateLanguageMaskFromLanguageIds(array $languageIds, $alwaysA * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - public function generateLanguageIndicator($languageCode, $alwaysAvailable) + public function generateLanguageIndicator($languageCode, $alwaysAvailable): int { return $this->languageHandler->loadByLanguageCode($languageCode)->id | ($alwaysAvailable ? 1 : 0); } diff --git a/src/lib/Persistence/Legacy/Content/Location/Handler.php b/src/lib/Persistence/Legacy/Content/Location/Handler.php index f0ba2d7332..6fe93eae46 100644 --- a/src/lib/Persistence/Legacy/Content/Location/Handler.php +++ b/src/lib/Persistence/Legacy/Content/Location/Handler.php @@ -82,7 +82,7 @@ public function __construct( * * @return string */ - protected function getParentPathString($pathString) + protected function getParentPathString($pathString): string { return implode('/', array_slice(explode('/', $pathString), 0, -2)) . '/'; } @@ -378,7 +378,7 @@ private function updateSubtreeSectionIfNecessary(Location $location, $sectionId) * * @return bool */ - private function isMainLocation(Location $location) + private function isMainLocation(Location $location): bool { $locationContentInfo = $this->contentHandler->loadContentInfo($location->contentId); diff --git a/src/lib/Persistence/Legacy/Content/Location/Mapper.php b/src/lib/Persistence/Legacy/Content/Location/Mapper.php index 2ebb8fe834..949eee2aa6 100644 --- a/src/lib/Persistence/Legacy/Content/Location/Mapper.php +++ b/src/lib/Persistence/Legacy/Content/Location/Mapper.php @@ -61,7 +61,7 @@ public function createLocationFromRow(array $data, $prefix = '', ?Location $loca * * @return \Ibexa\Contracts\Core\Persistence\Content\Location[] */ - public function createLocationsFromRows(array $rows, $prefix = '', ?Location $location = null) + public function createLocationsFromRows(array $rows, $prefix = '', ?Location $location = null): array { $locations = []; diff --git a/src/lib/Persistence/Legacy/Content/Mapper.php b/src/lib/Persistence/Legacy/Content/Mapper.php index b0932d8ca1..bb33629493 100644 --- a/src/lib/Persistence/Legacy/Content/Mapper.php +++ b/src/lib/Persistence/Legacy/Content/Mapper.php @@ -476,7 +476,7 @@ private function extractVersionInfoFromRow(array $row, array $names = []) * * @return \Ibexa\Contracts\Core\Persistence\Content\VersionInfo[] */ - public function extractVersionInfoListFromRows(array $rows, array $nameRows) + public function extractVersionInfoListFromRows(array $rows, array $nameRows): array { $nameData = []; foreach ($nameRows as $row) { diff --git a/src/lib/Persistence/Legacy/Content/ObjectState/Handler.php b/src/lib/Persistence/Legacy/Content/ObjectState/Handler.php index 5b78c171e3..e1db7acd40 100644 --- a/src/lib/Persistence/Legacy/Content/ObjectState/Handler.php +++ b/src/lib/Persistence/Legacy/Content/ObjectState/Handler.php @@ -309,7 +309,7 @@ public function delete($stateId) * * @return bool */ - public function setContentState($contentId, $groupId, $stateId) + public function setContentState($contentId, $groupId, $stateId): bool { $this->objectStateGateway->setContentState($contentId, $groupId, $stateId); diff --git a/src/lib/Persistence/Legacy/Content/Type/ContentUpdater.php b/src/lib/Persistence/Legacy/Content/Type/ContentUpdater.php index d8256ec274..7a915f5830 100644 --- a/src/lib/Persistence/Legacy/Content/Type/ContentUpdater.php +++ b/src/lib/Persistence/Legacy/Content/Type/ContentUpdater.php @@ -109,7 +109,7 @@ public function determineActions(Type $fromType, Type $toType) * * @return bool */ - protected function hasFieldDefinition(Type $type, FieldDefinition $fieldDef) + protected function hasFieldDefinition(Type $type, FieldDefinition $fieldDef): bool { foreach ($type->fieldDefinitions as $existFieldDef) { if ($existFieldDef->id == $fieldDef->id) { diff --git a/src/lib/Persistence/Legacy/Content/Type/Handler.php b/src/lib/Persistence/Legacy/Content/Type/Handler.php index a695f1119a..ec267e3c00 100644 --- a/src/lib/Persistence/Legacy/Content/Type/Handler.php +++ b/src/lib/Persistence/Legacy/Content/Type/Handler.php @@ -373,7 +373,7 @@ public function update($typeId, $status, UpdateStruct $updateStruct) * * @return bool */ - public function delete($contentTypeId, $status) + public function delete($contentTypeId, $status): bool { if (Type::STATUS_DEFINED === $status && $this->contentTypeGateway->countInstancesOfType($contentTypeId)) { throw new BadStateException( @@ -470,7 +470,7 @@ public function copy($userId, $contentTypeId, $status) * * @todo Add throws for NotFound and BadState when group is not assigned to type */ - public function unlink($groupId, $contentTypeId, $status) + public function unlink($groupId, $contentTypeId, $status): bool { $groupCount = $this->contentTypeGateway->countGroupsForType($contentTypeId, $status); if ($groupCount < 2) { @@ -494,7 +494,7 @@ public function unlink($groupId, $contentTypeId, $status) * * @todo Above throws are not implemented */ - public function link($groupId, $contentTypeId, $status) + public function link($groupId, $contentTypeId, $status): bool { $this->contentTypeGateway->insertGroupAssignment($groupId, $contentTypeId, $status); diff --git a/src/lib/Persistence/Legacy/Content/Type/Mapper.php b/src/lib/Persistence/Legacy/Content/Type/Mapper.php index 6c625659a0..30a9999a6f 100644 --- a/src/lib/Persistence/Legacy/Content/Type/Mapper.php +++ b/src/lib/Persistence/Legacy/Content/Type/Mapper.php @@ -129,7 +129,7 @@ public function extractTypesFromRows(array $rows, bool $keepTypeIdAsKey = false) $fieldId = (int)$row['ezcontentclass_attribute_id']; if ($fieldId && !isset($fields[$fieldId])) { - $fieldDataRows = array_filter($rows, static function (array $row) use ($fieldId) { + $fieldDataRows = array_filter($rows, static function (array $row) use ($fieldId): bool { return (int) $row['ezcontentclass_attribute_id'] === (int) $fieldId; }); diff --git a/src/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php index 9f5b4399e3..4d91760184 100644 --- a/src/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php @@ -681,7 +681,7 @@ public function loadUrlAliasData(array $urlHashes): array $query ->addSelect( array_map( - static function (string $columnName) use ($tableAlias) { + static function (string $columnName) use ($tableAlias): string { // do not alias data for top level url part $columnAlias = 'u' === $tableAlias ? $columnName @@ -1051,7 +1051,7 @@ public function archiveUrlAliasesForDeletedTranslations( $rowLanguageMask = (int)$row['lang_mask']; $languageIdsToBeRemoved = array_filter( $languageIds, - static function ($languageId) use ($rowLanguageMask) { + static function ($languageId) use ($rowLanguageMask): int { return $languageId & $rowLanguageMask; } ); @@ -1346,7 +1346,7 @@ private function filterOriginalAliases(array $urlAliasesData): array { $originalUrlAliases = array_filter( $urlAliasesData, - static function ($urlAliasData) { + static function ($urlAliasData): bool { // filter is_original=true ignoring broken parent records (cleaned up elsewhere) return (bool)$urlAliasData['is_original'] && $urlAliasData['existing_parent'] !== null; } diff --git a/src/lib/Persistence/Legacy/Content/UrlAlias/Handler.php b/src/lib/Persistence/Legacy/Content/UrlAlias/Handler.php index c4c5882449..5f757fce01 100644 --- a/src/lib/Persistence/Legacy/Content/UrlAlias/Handler.php +++ b/src/lib/Persistence/Legacy/Content/UrlAlias/Handler.php @@ -545,7 +545,7 @@ public function listGlobalURLAliases($languageCode = null, $offset = 0, $limit = * * @return bool */ - public function removeURLAliases(array $urlAliases) + public function removeURLAliases(array $urlAliases): bool { foreach ($urlAliases as $urlAlias) { if ($urlAlias->isCustom) { @@ -829,7 +829,7 @@ private function shouldUrlAliasForSecondLocationBePublishedFirst( $location2ParentId, $name2, $languageId - ) { + ): bool { if ($location1ParentId === $location2ParentId && $name1 === $name2) { $locationEntry1 = $this->getLocationEntryInLanguage($location1Entries, $languageId); $locationEntry2 = $this->getLocationEntryInLanguage($location2Entries, $languageId); @@ -912,7 +912,7 @@ private function getLocationEntryInLanguage(array $locationEntries, $languageId) { $entries = array_filter( $locationEntries, - static function (array $row) use ($languageId) { + static function (array $row) use ($languageId): bool { return (bool) ($row['lang_mask'] & $languageId); } ); @@ -1085,7 +1085,7 @@ protected function removeSubtree($id, $action, $original) * * @return string */ - protected function getHash($text) + protected function getHash($text): string { return md5(mb_strtolower($text, 'UTF-8')); } diff --git a/src/lib/Persistence/Legacy/Content/UrlWildcard/Handler.php b/src/lib/Persistence/Legacy/Content/UrlWildcard/Handler.php index 2a4d9dbc7a..988c62195c 100644 --- a/src/lib/Persistence/Legacy/Content/UrlWildcard/Handler.php +++ b/src/lib/Persistence/Legacy/Content/UrlWildcard/Handler.php @@ -183,7 +183,7 @@ public function translate(string $sourceUrl): UrlWildcard $rows = $this->gateway->loadUrlWildcardsData(); uasort( $rows, - static function ($row1, $row2) { + static function ($row1, $row2): int { return strlen($row2['source_url']) - strlen($row1['source_url']); } ); diff --git a/src/lib/Persistence/Legacy/Content/UrlWildcard/Mapper.php b/src/lib/Persistence/Legacy/Content/UrlWildcard/Mapper.php index dd2a808119..f888fdb0b7 100644 --- a/src/lib/Persistence/Legacy/Content/UrlWildcard/Mapper.php +++ b/src/lib/Persistence/Legacy/Content/UrlWildcard/Mapper.php @@ -58,7 +58,7 @@ public function extractUrlWildcardFromRow(array $row) * * @return string */ - protected function cleanUrl($url) + protected function cleanUrl($url): string { // if given $url is an absolute URL, then it's not necessary to prepend it with slash if (null !== parse_url($url, PHP_URL_SCHEME)) { diff --git a/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Location/AncestorQueryBuilder.php b/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Location/AncestorQueryBuilder.php index aee1a1e65e..a5aab229df 100644 --- a/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Location/AncestorQueryBuilder.php +++ b/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Location/AncestorQueryBuilder.php @@ -39,7 +39,7 @@ public function buildQueryConstraint( // extract numerical IDs from $criterion->value e.g. = ['/1/2/', '/1/4/10/'] $locationIDs = array_merge( ...array_map( - static function (string $pathString) { + static function (string $pathString): array { return array_map( 'intval', array_filter(explode('/', trim($pathString, '/'))) diff --git a/src/lib/Persistence/Legacy/Filter/Gateway/Content/Doctrine/DoctrineGateway.php b/src/lib/Persistence/Legacy/Filter/Gateway/Content/Doctrine/DoctrineGateway.php index 6d9006bf1b..9226255e42 100644 --- a/src/lib/Persistence/Legacy/Filter/Gateway/Content/Doctrine/DoctrineGateway.php +++ b/src/lib/Persistence/Legacy/Filter/Gateway/Content/Doctrine/DoctrineGateway.php @@ -195,7 +195,7 @@ private function extractVersionData(array $rows, int $contentId, int $versionNo) { return array_filter( $rows, - static function (array $row) use ($contentId, $versionNo) { + static function (array $row) use ($contentId, $versionNo): bool { return (int)$row['content_id'] === $contentId && (int)$row['version_no'] === $versionNo; } diff --git a/src/lib/Persistence/Legacy/URL/Handler.php b/src/lib/Persistence/Legacy/URL/Handler.php index 8bc3d27ae6..c9c5313454 100644 --- a/src/lib/Persistence/Legacy/URL/Handler.php +++ b/src/lib/Persistence/Legacy/URL/Handler.php @@ -8,6 +8,7 @@ namespace Ibexa\Core\Persistence\Legacy\URL; use Ibexa\Contracts\Core\Persistence\URL\Handler as HandlerInterface; +use Ibexa\Contracts\Core\Persistence\URL\URL; use Ibexa\Contracts\Core\Persistence\URL\URLUpdateStruct; use Ibexa\Contracts\Core\Repository\Values\URL\URLQuery; use Ibexa\Core\Base\Exceptions\NotFoundException; @@ -72,7 +73,7 @@ public function find(URLQuery $query) /** * {@inheritdoc} */ - public function loadById($id) + public function loadById($id): URL { $url = $this->urlMapper->extractURLsFromRows( $this->urlGateway->loadUrlData($id) @@ -88,7 +89,7 @@ public function loadById($id) /** * {@inheritdoc} */ - public function loadByUrl($url) + public function loadByUrl($url): URL { $urls = $this->urlMapper->extractURLsFromRows( $this->urlGateway->loadUrlDataByUrl($url) diff --git a/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalAnd.php b/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalAnd.php index a1f2116147..909d43d71c 100644 --- a/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalAnd.php +++ b/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalAnd.php @@ -17,7 +17,7 @@ class LogicalAnd implements CriterionHandler /** * {@inheritdoc} */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\LogicalAnd; } diff --git a/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalNot.php b/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalNot.php index 8a9b00fcb3..88cde42903 100644 --- a/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalNot.php +++ b/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalNot.php @@ -17,7 +17,7 @@ class LogicalNot implements CriterionHandler /** * {@inheritdoc} */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\LogicalNot; } @@ -31,7 +31,7 @@ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, Criterion $criterion - ) { + ): string { return sprintf( 'NOT (%s)', $converter->convertCriteria($queryBuilder, $criterion->criteria[0]) diff --git a/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalOr.php b/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalOr.php index df8e069d0b..43195a1b9b 100644 --- a/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalOr.php +++ b/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalOr.php @@ -17,7 +17,7 @@ class LogicalOr implements CriterionHandler /** * {@inheritdoc} */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\LogicalOr; } diff --git a/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/MatchAll.php b/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/MatchAll.php index aa505fd3ac..2817c5b7d0 100644 --- a/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/MatchAll.php +++ b/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/MatchAll.php @@ -17,7 +17,7 @@ class MatchAll implements CriterionHandler /** * {@inheritdoc} */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\MatchAll; } @@ -29,7 +29,7 @@ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, Criterion $criterion - ) { + ): string { return '1 = 1'; } } diff --git a/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/MatchNone.php b/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/MatchNone.php index bd2d5ceecd..8ca474ba70 100644 --- a/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/MatchNone.php +++ b/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/MatchNone.php @@ -17,7 +17,7 @@ class MatchNone implements CriterionHandler /** * {@inheritdoc} */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\MatchNone; } @@ -29,7 +29,7 @@ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, Criterion $criterion - ) { + ): string { return '1 = 0'; } } diff --git a/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/Pattern.php b/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/Pattern.php index dc187cb0bf..dbcfc24800 100644 --- a/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/Pattern.php +++ b/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/Pattern.php @@ -18,7 +18,7 @@ class Pattern implements CriterionHandler /** * {@inheritdoc} */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\Pattern; } diff --git a/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/Validity.php b/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/Validity.php index e53adbf0d0..bbcf04b25d 100644 --- a/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/Validity.php +++ b/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/Validity.php @@ -18,7 +18,7 @@ class Validity implements CriterionHandler /** * {@inheritdoc} */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\Validity; } diff --git a/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/VisibleOnly.php b/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/VisibleOnly.php index f2fe945515..3b75f458d3 100644 --- a/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/VisibleOnly.php +++ b/src/lib/Persistence/Legacy/URL/Query/CriterionHandler/VisibleOnly.php @@ -18,7 +18,7 @@ class VisibleOnly extends Base /** * {@inheritdoc} */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\VisibleOnly; } diff --git a/src/lib/Persistence/Legacy/User/Mapper.php b/src/lib/Persistence/Legacy/User/Mapper.php index 80bf198616..b18eb8b478 100644 --- a/src/lib/Persistence/Legacy/User/Mapper.php +++ b/src/lib/Persistence/Legacy/User/Mapper.php @@ -64,7 +64,7 @@ public function mapUsers(array $data) * * @return \Ibexa\Contracts\Core\Persistence\User\Policy[] */ - public function mapPolicies(array $data) + public function mapPolicies(array $data): array { /** @var \Ibexa\Contracts\Core\Persistence\User\Policy[] */ $policies = []; diff --git a/src/lib/Persistence/Legacy/User/Role/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/User/Role/Gateway/DoctrineDatabase.php index 7ffcd7bf3e..4943584224 100644 --- a/src/lib/Persistence/Legacy/User/Role/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/User/Role/Gateway/DoctrineDatabase.php @@ -721,7 +721,7 @@ private function getAncestorLocationIdsForUser(int $userId): array $nodeIds = array_unique( array_reduce( array_map( - static function ($pathString) { + static function ($pathString): array { return array_filter(explode('/', $pathString)); }, $paths diff --git a/src/lib/Persistence/TransformationProcessor/DefinitionBased/Parser.php b/src/lib/Persistence/TransformationProcessor/DefinitionBased/Parser.php index 218b1e4da2..3222ddab15 100644 --- a/src/lib/Persistence/TransformationProcessor/DefinitionBased/Parser.php +++ b/src/lib/Persistence/TransformationProcessor/DefinitionBased/Parser.php @@ -98,7 +98,7 @@ public function parseString($string) $tokens = array_filter( $tokens, - static function ($token) { + static function ($token): bool { return !($token['type'] === TransformationProcessor::T_WHITESPACE || $token['type'] === TransformationProcessor::T_COMMENT); } diff --git a/src/lib/Persistence/TransformationProcessor/PcreCompiler.php b/src/lib/Persistence/TransformationProcessor/PcreCompiler.php index 32ad9a1af7..bcbcb98462 100644 --- a/src/lib/Persistence/TransformationProcessor/PcreCompiler.php +++ b/src/lib/Persistence/TransformationProcessor/PcreCompiler.php @@ -172,7 +172,7 @@ protected function compileTransposeModulo(array $rule) * * @return string */ - protected function getModuloCharRange($start, $end, $modulo) + protected function getModuloCharRange($start, $end, $modulo): string { $start = $this->converter->toUnicodeCodepoint($start); $end = $this->converter->toUnicodeCodepoint($end); @@ -219,7 +219,7 @@ protected function compileTargetCharacter($char) { switch (true) { case $char === 'remove': - return static function ($matches) { + return static function ($matches): string { return ''; }; diff --git a/src/lib/Persistence/Utf8Converter.php b/src/lib/Persistence/Utf8Converter.php index a9b6501a98..2317eca3a3 100644 --- a/src/lib/Persistence/Utf8Converter.php +++ b/src/lib/Persistence/Utf8Converter.php @@ -24,7 +24,7 @@ class Utf8Converter * * @return string */ - public static function toUTF8Character($charCode) + public static function toUTF8Character($charCode): string { switch ($charCode) { case 0: diff --git a/src/lib/Repository/Mapper/ContentDomainMapper.php b/src/lib/Repository/Mapper/ContentDomainMapper.php index eacc212226..6d107ed211 100644 --- a/src/lib/Repository/Mapper/ContentDomainMapper.php +++ b/src/lib/Repository/Mapper/ContentDomainMapper.php @@ -780,7 +780,7 @@ public function buildSPILocationCreateStruct( * * @return bool */ - public function isValidLocationSortField($sortField) + public function isValidLocationSortField($sortField): bool { switch ($sortField) { case APILocation::SORT_FIELD_PATH: @@ -808,7 +808,7 @@ public function isValidLocationSortField($sortField) * * @return bool */ - public function isValidLocationSortOrder($sortOrder) + public function isValidLocationSortOrder($sortOrder): bool { switch ($sortOrder) { case APILocation::SORT_ORDER_DESC: @@ -826,7 +826,7 @@ public function isValidLocationSortOrder($sortOrder) * * @return bool */ - public function isValidLocationPriority($priority) + public function isValidLocationPriority($priority): bool { if ($priority === null) { return true; @@ -885,7 +885,7 @@ public function getDateTime($timestamp) * * @return string */ - public function getUniqueHash($object) + public function getUniqueHash($object): string { return md5(uniqid(get_class($object), true)); } diff --git a/src/lib/Repository/Permission/PermissionResolver.php b/src/lib/Repository/Permission/PermissionResolver.php index 54e579e3ba..42204df748 100644 --- a/src/lib/Repository/Permission/PermissionResolver.php +++ b/src/lib/Repository/Permission/PermissionResolver.php @@ -306,7 +306,7 @@ public function lookupLimitations( $possibleLimitations[] = $limitation; } - $limitationFilter = static function (Limitation $limitation) use ($limitationsIdentifiers) { + $limitationFilter = static function (Limitation $limitation) use ($limitationsIdentifiers): bool { return \in_array($limitation->getIdentifier(), $limitationsIdentifiers, true); }; @@ -448,7 +448,7 @@ private function prepareTargetsForType(?array $targets, LimitationType $type): ? // BC: for TargetAware Limitations return only instances of Target, for others return only non-Target instances $targets = array_filter( $targets, - static function ($target) use ($isTargetAware) { + static function ($target) use ($isTargetAware): bool { $isTarget = $target instanceof Target; return $isTargetAware ? $isTarget : !$isTarget; diff --git a/src/lib/Repository/PermissionsCriterionHandler.php b/src/lib/Repository/PermissionsCriterionHandler.php index 819917cf66..0c495db131 100644 --- a/src/lib/Repository/PermissionsCriterionHandler.php +++ b/src/lib/Repository/PermissionsCriterionHandler.php @@ -25,7 +25,7 @@ class PermissionsCriterionHandler extends PermissionCriterionResolver * * @return bool */ - public function addPermissionsCriterion(Criterion &$criterion) + public function addPermissionsCriterion(Criterion &$criterion): bool { $permissionCriterion = $this->getPermissionsCriterion(); if ($permissionCriterion === true || $permissionCriterion === false) { diff --git a/src/lib/Repository/TrashService.php b/src/lib/Repository/TrashService.php index 528eac9cad..02ce266f3f 100644 --- a/src/lib/Repository/TrashService.php +++ b/src/lib/Repository/TrashService.php @@ -406,7 +406,7 @@ protected function getDateTime($timestamp) * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ - private function userHasPermissionsToRemove(ContentInfo $contentInfo, Location $location) + private function userHasPermissionsToRemove(ContentInfo $contentInfo, Location $location): bool { $versionInfo = $this->persistenceHandler->contentHandler()->loadVersionInfo( $contentInfo->id, diff --git a/src/lib/Repository/URLAliasService.php b/src/lib/Repository/URLAliasService.php index 350af54bb3..cf09650b4e 100644 --- a/src/lib/Repository/URLAliasService.php +++ b/src/lib/Repository/URLAliasService.php @@ -487,7 +487,7 @@ protected function isUrlAliasLoadable( ?string $languageCode, bool $showAllTranslations, array $prioritizedLanguageList - ) { + ): bool { if (isset($languageCode) && !in_array($languageCode, $spiUrlAlias->languageCodes)) { return false; } @@ -521,7 +521,7 @@ protected function isUrlAliasLoadable( * * @return bool */ - protected function isPathLoadable(array $pathData, array $languageCodes) + protected function isPathLoadable(array $pathData, array $languageCodes): bool { if ($this->languageResolver->getShowAllTranslations()) { return true; diff --git a/src/lib/Repository/UserService.php b/src/lib/Repository/UserService.php index 1903d15215..091ee4df0c 100644 --- a/src/lib/Repository/UserService.php +++ b/src/lib/Repository/UserService.php @@ -1382,7 +1382,7 @@ private function comparePasswordHashes( * * @return bool */ - private function isUserProfileUpdateRequested(UserUpdateStruct $userUpdateStruct) + private function isUserProfileUpdateRequested(UserUpdateStruct $userUpdateStruct): bool { return !empty($userUpdateStruct->contentUpdateStruct) || diff --git a/src/lib/Repository/Values/ContentType/FieldDefinitionCollection.php b/src/lib/Repository/Values/ContentType/FieldDefinitionCollection.php index f2bbdecd96..38c76a59c0 100644 --- a/src/lib/Repository/Values/ContentType/FieldDefinitionCollection.php +++ b/src/lib/Repository/Values/ContentType/FieldDefinitionCollection.php @@ -161,14 +161,14 @@ public function toArray(): array private function getIsTypePredicate(string $fieldTypeIdentifier): Closure { - return static function (FieldDefinition $fieldDefinition) use ($fieldTypeIdentifier) { + return static function (FieldDefinition $fieldDefinition) use ($fieldTypeIdentifier): bool { return $fieldDefinition->getFieldTypeIdentifier() === $fieldTypeIdentifier; }; } private function getInGroupPredicate(string $fieldGroup): Closure { - return static function (FieldDefinition $fieldDefinition) use ($fieldGroup) { + return static function (FieldDefinition $fieldDefinition) use ($fieldGroup): bool { return $fieldDefinition->fieldGroup === $fieldGroup; }; } diff --git a/src/lib/Search/Common/FieldNameGenerator.php b/src/lib/Search/Common/FieldNameGenerator.php index 7c343ff9b5..696c646096 100644 --- a/src/lib/Search/Common/FieldNameGenerator.php +++ b/src/lib/Search/Common/FieldNameGenerator.php @@ -54,7 +54,7 @@ public function __construct(array $fieldNameMapping) * * @return string */ - public function getName($name, $field = null, $type = null) + public function getName($name, $field = null, $type = null): string { return implode('_', array_filter([$type, $field, $name])); } diff --git a/src/lib/Search/Common/FieldNameResolver.php b/src/lib/Search/Common/FieldNameResolver.php index 890df87213..e1c7847048 100644 --- a/src/lib/Search/Common/FieldNameResolver.php +++ b/src/lib/Search/Common/FieldNameResolver.php @@ -106,7 +106,7 @@ public function getFieldNames( $fieldDefinitionIdentifier, $fieldTypeIdentifier = null, $name = null - ) { + ): array { $fieldTypeNameMap = $this->getFieldTypes($criterion, $fieldDefinitionIdentifier, $fieldTypeIdentifier, $name); return array_keys($fieldTypeNameMap); diff --git a/src/lib/Search/Common/FieldValueMapper/BooleanMapper.php b/src/lib/Search/Common/FieldValueMapper/BooleanMapper.php index 9fb8c0f9db..2f46d1d0ae 100644 --- a/src/lib/Search/Common/FieldValueMapper/BooleanMapper.php +++ b/src/lib/Search/Common/FieldValueMapper/BooleanMapper.php @@ -21,7 +21,7 @@ public function canMap(Field $field): bool return $field->getType() instanceof BooleanField; } - public function map(Field $field) + public function map(Field $field): bool { return (bool)$field->getValue(); } diff --git a/src/lib/Search/Common/FieldValueMapper/DateMapper.php b/src/lib/Search/Common/FieldValueMapper/DateMapper.php index ca8aa1288c..b6b64fe006 100644 --- a/src/lib/Search/Common/FieldValueMapper/DateMapper.php +++ b/src/lib/Search/Common/FieldValueMapper/DateMapper.php @@ -24,7 +24,7 @@ public function canMap(Field $field): bool return $field->getType() instanceof DateField; } - public function map(Field $field) + public function map(Field $field): string { $value = $field->getValue(); if (is_numeric($value)) { diff --git a/src/lib/Search/Common/FieldValueMapper/FloatMapper.php b/src/lib/Search/Common/FieldValueMapper/FloatMapper.php index 7662d5f307..d2ae206559 100644 --- a/src/lib/Search/Common/FieldValueMapper/FloatMapper.php +++ b/src/lib/Search/Common/FieldValueMapper/FloatMapper.php @@ -21,7 +21,7 @@ public function canMap(Field $field): bool return $field->getType() instanceof FloatField; } - public function map(Field $field) + public function map(Field $field): string { return sprintf('%F', (float)$field->getValue()); } diff --git a/src/lib/Search/Common/FieldValueMapper/GeoLocationMapper.php b/src/lib/Search/Common/FieldValueMapper/GeoLocationMapper.php index df7c97c5d0..563e47f65d 100644 --- a/src/lib/Search/Common/FieldValueMapper/GeoLocationMapper.php +++ b/src/lib/Search/Common/FieldValueMapper/GeoLocationMapper.php @@ -21,7 +21,7 @@ public function canMap(Field $field): bool return $field->getType() instanceof GeoLocationField; } - public function map(Field $field) + public function map(Field $field): ?string { $value = $field->getValue(); if ($value['latitude'] === null || $value['longitude'] === null) { diff --git a/src/lib/Search/Common/FieldValueMapper/PriceMapper.php b/src/lib/Search/Common/FieldValueMapper/PriceMapper.php index f8329a02c1..03610394f1 100644 --- a/src/lib/Search/Common/FieldValueMapper/PriceMapper.php +++ b/src/lib/Search/Common/FieldValueMapper/PriceMapper.php @@ -23,12 +23,8 @@ public function canMap(Field $field): bool /** * Map field value to a proper search engine representation. - * - * @param \Ibexa\Contracts\Core\Search\Field $field - * - * @return mixed */ - public function map(Field $field) + public function map(Field $field): float { return (float)$field->getValue(); } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentId.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentId.php index 65b252d5cb..c8fae82af7 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentId.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentId.php @@ -25,7 +25,7 @@ class ContentId extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\ContentId; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeGroupId.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeGroupId.php index 996f6f9c47..02547bfca3 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeGroupId.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeGroupId.php @@ -25,7 +25,7 @@ class ContentTypeGroupId extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\ContentTypeGroupId; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeId.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeId.php index 33efd29d9f..52e80800aa 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeId.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeId.php @@ -25,7 +25,7 @@ class ContentTypeId extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\ContentTypeId; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeIdentifier.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeIdentifier.php index 0051611645..77d83b24ec 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeIdentifier.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeIdentifier.php @@ -52,7 +52,7 @@ public function __construct( * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\ContentTypeIdentifier; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/DateMetadata.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/DateMetadata.php index 6e7c93dfe7..6043125359 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/DateMetadata.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/DateMetadata.php @@ -27,7 +27,7 @@ class DateMetadata extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\DateMetadata; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/Field.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/Field.php index 05c915f855..1e3552950c 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/Field.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/Field.php @@ -67,7 +67,7 @@ public function __construct( * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\Field; } @@ -131,7 +131,7 @@ public function handle( QueryBuilder $queryBuilder, Criterion $criterion, array $languageSettings - ) { + ): string { $fieldsInformation = $this->getFieldsInformation($criterion->target); $subSelect = $this->connection->createQueryBuilder(); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldEmpty.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldEmpty.php index a71974bd22..21a37a69ff 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldEmpty.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldEmpty.php @@ -102,7 +102,7 @@ public function handle( QueryBuilder $queryBuilder, Criterion $criterion, array $languageSettings - ) { + ): string { $fieldsInformation = $this->getFieldsInformation($criterion->target); $subSelect = $this->connection->createQueryBuilder(); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldRelation.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldRelation.php index 404cc9653d..3b798c252b 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldRelation.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldRelation.php @@ -37,7 +37,7 @@ class FieldRelation extends FieldBase * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\FieldRelation; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/HandlerRegistry.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/HandlerRegistry.php index e471b5d211..7128991443 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/HandlerRegistry.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/HandlerRegistry.php @@ -71,7 +71,7 @@ public function get($fieldTypeIdentifier) * * @return bool */ - public function has($fieldTypeIdentifier) + public function has($fieldTypeIdentifier): bool { return isset($this->map[$fieldTypeIdentifier]); } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FullText.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FullText.php index 4926b0cc98..6fdb81452d 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FullText.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FullText.php @@ -121,7 +121,7 @@ public function __construct( * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\FullText; } @@ -129,13 +129,13 @@ public function accept(Criterion $criterion) /** * Tokenize String. * - * @param string $string - * - * @return array + * @return array */ - protected function tokenizeString($string) + protected function tokenizeString(string $string): array { - return preg_split('/[^\w|*]/u', $string, -1, PREG_SPLIT_NO_EMPTY); + $tokens = preg_split('/[^\w|*]/u', $string, -1, PREG_SPLIT_NO_EMPTY); + + return false !== $tokens ? $tokens : []; } /** diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LanguageCode.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LanguageCode.php index b9e258d8cd..aaf4b82ca4 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LanguageCode.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LanguageCode.php @@ -36,7 +36,7 @@ public function __construct(Connection $connection, MaskGenerator $maskGenerator * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\LanguageCode; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalAnd.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalAnd.php index 4ae0cce95e..cbab0be9cd 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalAnd.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalAnd.php @@ -24,7 +24,7 @@ class LogicalAnd extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\LogicalAnd; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalNot.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalNot.php index 1d2d8fdb5c..74ec2dc92e 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalNot.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalNot.php @@ -24,7 +24,7 @@ class LogicalNot extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\LogicalNot; } @@ -34,7 +34,7 @@ public function handle( QueryBuilder $queryBuilder, Criterion $criterion, array $languageSettings - ) { + ): string { return sprintf( 'NOT (%s)', $converter->convertCriteria($queryBuilder, $criterion->criteria[0], $languageSettings) diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalOr.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalOr.php index f6843d763a..dad5e7baac 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalOr.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalOr.php @@ -24,7 +24,7 @@ class LogicalOr extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\LogicalOr; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MapLocationDistance.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MapLocationDistance.php index 878ba9529a..9b9db1d121 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MapLocationDistance.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MapLocationDistance.php @@ -37,7 +37,7 @@ class MapLocationDistance extends FieldBase * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\MapLocationDistance; } @@ -80,7 +80,7 @@ protected function getFieldDefinitionIds($fieldIdentifier) return $fieldDefinitionIdList; } - protected function kilometersToDegrees($kilometers) + protected function kilometersToDegrees($kilometers): float { return $kilometers / self::DEGREE_KM; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MatchAll.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MatchAll.php index 4a34903931..81b826e920 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MatchAll.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MatchAll.php @@ -24,7 +24,7 @@ class MatchAll extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\MatchAll; } @@ -34,7 +34,7 @@ public function handle( QueryBuilder $queryBuilder, Criterion $criterion, array $languageSettings - ) { + ): string { return '1 = 1'; } } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MatchNone.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MatchNone.php index 398724a21e..2b0e08ec4e 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MatchNone.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MatchNone.php @@ -24,7 +24,7 @@ class MatchNone extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\MatchNone; } @@ -34,7 +34,7 @@ public function handle( QueryBuilder $queryBuilder, Criterion $criterion, array $languageSettings - ) { + ): string { return '1 = 0'; } } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ObjectStateId.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ObjectStateId.php index b4b179bb04..58e5962b87 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ObjectStateId.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ObjectStateId.php @@ -25,7 +25,7 @@ class ObjectStateId extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\ObjectStateId; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/RemoteId.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/RemoteId.php index 9adb3e879f..dc65edc995 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/RemoteId.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/RemoteId.php @@ -25,7 +25,7 @@ class RemoteId extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\RemoteId; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/SectionId.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/SectionId.php index 3478fa7867..240875851c 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/SectionId.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/SectionId.php @@ -25,7 +25,7 @@ class SectionId extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\SectionId; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserMetadata.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserMetadata.php index 70c1390471..c03328c58d 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserMetadata.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserMetadata.php @@ -28,7 +28,7 @@ class UserMetadata extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\UserMetadata; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/ContentId.php b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/ContentId.php index 67710f2c2e..da57c5fb4a 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/ContentId.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/ContentId.php @@ -23,7 +23,7 @@ class ContentId extends SortClauseHandler * * @return bool */ - public function accept(SortClause $sortClause) + public function accept(SortClause $sortClause): bool { return $sortClause instanceof SortClause\ContentId; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/ContentName.php b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/ContentName.php index 538c4b3747..74d4743a75 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/ContentName.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/ContentName.php @@ -23,7 +23,7 @@ class ContentName extends SortClauseHandler * * @return bool */ - public function accept(SortClause $sortClause) + public function accept(SortClause $sortClause): bool { return $sortClause instanceof SortClause\ContentName; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/DateModified.php b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/DateModified.php index 6242b440e9..cb0c89a033 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/DateModified.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/DateModified.php @@ -23,7 +23,7 @@ class DateModified extends SortClauseHandler * * @return bool */ - public function accept(SortClause $sortClause) + public function accept(SortClause $sortClause): bool { return $sortClause instanceof SortClause\DateModified; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/DatePublished.php b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/DatePublished.php index ad3c11de0b..b10506094e 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/DatePublished.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/DatePublished.php @@ -23,7 +23,7 @@ class DatePublished extends SortClauseHandler * * @return bool */ - public function accept(SortClause $sortClause) + public function accept(SortClause $sortClause): bool { return $sortClause instanceof SortClause\DatePublished; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/MapLocationDistance.php b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/MapLocationDistance.php index 5c333ed05b..700fe0536d 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/MapLocationDistance.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/MapLocationDistance.php @@ -25,7 +25,7 @@ class MapLocationDistance extends Field * * @return bool */ - public function accept(SortClause $sortClause) + public function accept(SortClause $sortClause): bool { return $sortClause instanceof SortClause\MapLocationDistance; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/SectionIdentifier.php b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/SectionIdentifier.php index 497a7715ba..e645d88680 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/SectionIdentifier.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/SectionIdentifier.php @@ -23,7 +23,7 @@ class SectionIdentifier extends SortClauseHandler * * @return bool */ - public function accept(SortClause $sortClause) + public function accept(SortClause $sortClause): bool { return $sortClause instanceof SortClause\SectionIdentifier; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/SectionName.php b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/SectionName.php index 5f0ccdcd07..dae4c01b63 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/SectionName.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/SectionName.php @@ -23,7 +23,7 @@ class SectionName extends SortClauseHandler * * @return bool */ - public function accept(SortClause $sortClause) + public function accept(SortClause $sortClause): bool { return $sortClause instanceof SortClause\SectionName; } diff --git a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Ancestor.php b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Ancestor.php index e108d9242e..4ebbb3ece3 100644 --- a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Ancestor.php +++ b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Ancestor.php @@ -24,7 +24,7 @@ class Ancestor extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\Ancestor; } diff --git a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/LocationId.php b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/LocationId.php index 7ec9f70a6c..650d1f05e6 100644 --- a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/LocationId.php +++ b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/LocationId.php @@ -25,7 +25,7 @@ class LocationId extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\LocationId; } diff --git a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/LocationRemoteId.php b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/LocationRemoteId.php index 26234bace3..5fa2e4807d 100644 --- a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/LocationRemoteId.php +++ b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/LocationRemoteId.php @@ -25,7 +25,7 @@ class LocationRemoteId extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\LocationRemoteId; } diff --git a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/ParentLocationId.php b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/ParentLocationId.php index 09d97032a1..601ed99448 100644 --- a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/ParentLocationId.php +++ b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/ParentLocationId.php @@ -25,7 +25,7 @@ class ParentLocationId extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\ParentLocationId; } diff --git a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/PermissionSubtree.php b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/PermissionSubtree.php index 0c38ba0e9c..8831758130 100644 --- a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/PermissionSubtree.php +++ b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/PermissionSubtree.php @@ -26,7 +26,7 @@ class PermissionSubtree extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof PermissionSubtreeCriterion; } diff --git a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Subtree.php b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Subtree.php index c3e0ff1b88..a9bf894204 100644 --- a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Subtree.php +++ b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Subtree.php @@ -25,7 +25,7 @@ class Subtree extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\Subtree; } diff --git a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Visibility.php b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Visibility.php index c5b00c9a80..38df55345b 100644 --- a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Visibility.php +++ b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Visibility.php @@ -25,7 +25,7 @@ class Visibility extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\Visibility; } diff --git a/src/lib/Search/Legacy/Content/Gateway/DoctrineDatabase.php b/src/lib/Search/Legacy/Content/Gateway/DoctrineDatabase.php index 06c69651c4..36795787d7 100644 --- a/src/lib/Search/Legacy/Content/Gateway/DoctrineDatabase.php +++ b/src/lib/Search/Legacy/Content/Gateway/DoctrineDatabase.php @@ -105,7 +105,7 @@ public function find( * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - private function getLanguageMask(array $languageSettings) + private function getLanguageMask(array $languageSettings): int { $mask = 0; if ($languageSettings['useAlwaysAvailable']) { @@ -173,7 +173,7 @@ private function getQueryCondition( * * @return int */ - private function getResultCount(Criterion $filter, array $languageFilter) + private function getResultCount(Criterion $filter, array $languageFilter): int { $query = $this->connection->createQueryBuilder(); diff --git a/src/lib/Search/Legacy/Content/Indexer.php b/src/lib/Search/Legacy/Content/Indexer.php index 42c47bd203..51d013a7de 100644 --- a/src/lib/Search/Legacy/Content/Indexer.php +++ b/src/lib/Search/Legacy/Content/Indexer.php @@ -27,7 +27,7 @@ public function __construct( parent::__construct($logger, $persistenceHandler, $connection, $searchHandler); } - public function getName() + public function getName(): string { return 'Ibexa Legacy (SQL) Search Engine'; } diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Ancestor.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Ancestor.php index 048ae7152a..1414e5d66a 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Ancestor.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Ancestor.php @@ -25,7 +25,7 @@ class Ancestor extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\Ancestor; } diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/Depth.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/Depth.php index b1736066f2..8b916642d3 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/Depth.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/Depth.php @@ -26,7 +26,7 @@ class Depth extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\Location\Depth; } diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/IsMainLocation.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/IsMainLocation.php index 1bc1d14497..eb8df8ef18 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/IsMainLocation.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/IsMainLocation.php @@ -25,7 +25,7 @@ class IsMainLocation extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\Location\IsMainLocation; } diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/Priority.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/Priority.php index 1e6727cbd6..7105498bee 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/Priority.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/Priority.php @@ -26,7 +26,7 @@ class Priority extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\Location\Priority; } diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/LocationId.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/LocationId.php index f42581094b..ced1e322d8 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/LocationId.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/LocationId.php @@ -25,7 +25,7 @@ class LocationId extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\LocationId; } diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/LocationRemoteId.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/LocationRemoteId.php index 580b403d07..8ea97ca833 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/LocationRemoteId.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/LocationRemoteId.php @@ -25,7 +25,7 @@ class LocationRemoteId extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\LocationRemoteId; } diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/ParentLocationId.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/ParentLocationId.php index 49afc170d7..f3ef44ee92 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/ParentLocationId.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/ParentLocationId.php @@ -25,7 +25,7 @@ class ParentLocationId extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\ParentLocationId; } diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Subtree.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Subtree.php index 74c444e5d3..0947a19c81 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Subtree.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Subtree.php @@ -42,7 +42,7 @@ public function handle( * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\Subtree; } diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Visibility.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Visibility.php index d5fa065a09..d8fe2ce645 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Visibility.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Visibility.php @@ -26,7 +26,7 @@ class Visibility extends CriterionHandler * * @return bool */ - public function accept(Criterion $criterion) + public function accept(Criterion $criterion): bool { return $criterion instanceof Criterion\Visibility; } diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Depth.php b/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Depth.php index f6b743dd54..ea61b1b653 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Depth.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Depth.php @@ -23,7 +23,7 @@ class Depth extends SortClauseHandler * * @return bool */ - public function accept(SortClause $sortClause) + public function accept(SortClause $sortClause): bool { return $sortClause instanceof SortClause\Location\Depth; } diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Id.php b/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Id.php index e663e12ae4..0923489194 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Id.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Id.php @@ -23,7 +23,7 @@ class Id extends SortClauseHandler * * @return bool */ - public function accept(SortClause $sortClause) + public function accept(SortClause $sortClause): bool { return $sortClause instanceof SortClause\Location\Id; } diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/IsMainLocation.php b/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/IsMainLocation.php index a62299fdb4..f669210fc6 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/IsMainLocation.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/IsMainLocation.php @@ -23,7 +23,7 @@ class IsMainLocation extends SortClauseHandler * * @return bool */ - public function accept(SortClause $sortClause) + public function accept(SortClause $sortClause): bool { return $sortClause instanceof SortClause\Location\IsMainLocation; } diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Path.php b/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Path.php index 9f9dab3ed2..b3742a79fa 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Path.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Path.php @@ -23,7 +23,7 @@ class Path extends SortClauseHandler * * @return bool */ - public function accept(SortClause $sortClause) + public function accept(SortClause $sortClause): bool { return $sortClause instanceof SortClause\Location\Path; } diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Priority.php b/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Priority.php index 5e12144add..2998e5e558 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Priority.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Priority.php @@ -23,7 +23,7 @@ class Priority extends SortClauseHandler * * @return bool */ - public function accept(SortClause $sortClause) + public function accept(SortClause $sortClause): bool { return $sortClause instanceof SortClause\Location\Priority; } diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Visibility.php b/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Visibility.php index 720d7c56c4..8a5936b908 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Visibility.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/SortClauseHandler/Location/Visibility.php @@ -23,7 +23,7 @@ class Visibility extends SortClauseHandler * * @return bool */ - public function accept(SortClause $sortClause) + public function accept(SortClause $sortClause): bool { return $sortClause instanceof SortClause\Location\Visibility; } diff --git a/src/lib/Search/Legacy/Content/Mapper/FullTextMapper.php b/src/lib/Search/Legacy/Content/Mapper/FullTextMapper.php index 4a1e93ef6a..c3c75d702f 100644 --- a/src/lib/Search/Legacy/Content/Mapper/FullTextMapper.php +++ b/src/lib/Search/Legacy/Content/Mapper/FullTextMapper.php @@ -125,7 +125,7 @@ private function extractFullTextField( $fieldType = $this->fieldRegistry->getType($field->type); $fullTextFields = array_filter( $fieldType->getIndexData($field, $fieldDefinition), - static function ($indexField) { + static function ($indexField): bool { return $indexField->type instanceof FieldType\FullTextField; } ); diff --git a/src/lib/Search/Legacy/Content/WordIndexer/Gateway/DoctrineDatabase.php b/src/lib/Search/Legacy/Content/WordIndexer/Gateway/DoctrineDatabase.php index 348572fc21..729388af3e 100644 --- a/src/lib/Search/Legacy/Content/WordIndexer/Gateway/DoctrineDatabase.php +++ b/src/lib/Search/Legacy/Content/WordIndexer/Gateway/DoctrineDatabase.php @@ -196,7 +196,7 @@ public function bulkIndex(array $fullTextBulkData) * * @return bool */ - public function remove($contentId, $versionId = null) + public function remove($contentId, $versionId = null): bool { $doDelete = false; $this->connection->beginTransaction(); diff --git a/tests/bundle/Core/DependencyInjection/Compiler/TranslationCollectorPassTest.php b/tests/bundle/Core/DependencyInjection/Compiler/TranslationCollectorPassTest.php index 53c50adf4d..89ccd8aff1 100644 --- a/tests/bundle/Core/DependencyInjection/Compiler/TranslationCollectorPassTest.php +++ b/tests/bundle/Core/DependencyInjection/Compiler/TranslationCollectorPassTest.php @@ -35,12 +35,7 @@ public function testTranslationCollector( $this->assertContainerBuilderHasParameter('available_translations', $availableTranslations); } - /** - * @param $path - * - * @return mixed - */ - private function normalizePath($path) + private function normalizePath(string $path): string { return str_replace('/', \DIRECTORY_SEPARATOR, $path); } diff --git a/tests/bundle/Core/DependencyInjection/IbexaCoreExtensionTest.php b/tests/bundle/Core/DependencyInjection/IbexaCoreExtensionTest.php index 3ca1386b0b..912da421af 100644 --- a/tests/bundle/Core/DependencyInjection/IbexaCoreExtensionTest.php +++ b/tests/bundle/Core/DependencyInjection/IbexaCoreExtensionTest.php @@ -930,7 +930,7 @@ final public function disableCheckExceptionOnInvalidReferenceBehaviorPass(): voi $compilerPassConfig->setAfterRemovingPasses( array_filter( $compilerPassConfig->getAfterRemovingPasses(), - static function (CompilerPassInterface $pass) { + static function (CompilerPassInterface $pass): bool { return !($pass instanceof CheckExceptionOnInvalidReferenceBehaviorPass); } ) diff --git a/tests/bundle/Core/DependencyInjection/Stub/QueryTypeBundle/QueryType/TestQueryType.php b/tests/bundle/Core/DependencyInjection/Stub/QueryTypeBundle/QueryType/TestQueryType.php index 04df38a82d..2306477800 100644 --- a/tests/bundle/Core/DependencyInjection/Stub/QueryTypeBundle/QueryType/TestQueryType.php +++ b/tests/bundle/Core/DependencyInjection/Stub/QueryTypeBundle/QueryType/TestQueryType.php @@ -19,7 +19,7 @@ public function getSupportedParameters() { } - public static function getName() + public static function getName(): string { return 'Test:Test'; } diff --git a/tests/bundle/Core/EventListener/ExceptionListenerTest.php b/tests/bundle/Core/EventListener/ExceptionListenerTest.php index d0edc08889..d84680b4e6 100644 --- a/tests/bundle/Core/EventListener/ExceptionListenerTest.php +++ b/tests/bundle/Core/EventListener/ExceptionListenerTest.php @@ -69,7 +69,7 @@ private function generateExceptionEvent(Exception $exception) return new ExceptionEvent( $this->createMock(HttpKernelInterface::class), new Request(), - HttpKernelInterface::MASTER_REQUEST, + HttpKernelInterface::MAIN_REQUEST, $exception ); } diff --git a/tests/bundle/Core/EventListener/IndexRequestListenerTest.php b/tests/bundle/Core/EventListener/IndexRequestListenerTest.php index 191710276a..854bcc1947 100644 --- a/tests/bundle/Core/EventListener/IndexRequestListenerTest.php +++ b/tests/bundle/Core/EventListener/IndexRequestListenerTest.php @@ -49,7 +49,7 @@ protected function setUp(): void $this->event = new RequestEvent( $this->httpKernel, $this->request, - HttpKernelInterface::MASTER_REQUEST + HttpKernelInterface::MAIN_REQUEST ); } diff --git a/tests/bundle/Core/EventListener/LocaleListenerTest.php b/tests/bundle/Core/EventListener/LocaleListenerTest.php index 15a685c36b..a54dd44da1 100644 --- a/tests/bundle/Core/EventListener/LocaleListenerTest.php +++ b/tests/bundle/Core/EventListener/LocaleListenerTest.php @@ -71,7 +71,7 @@ public function testOnKernelRequest(array $configuredLanguages, array $converted new RequestEvent( $this->createMock(HttpKernelInterface::class), $request, - HttpKernelInterface::MASTER_REQUEST + HttpKernelInterface::MAIN_REQUEST ) ); self::assertSame($expectedLocale, $request->attributes->get('_locale')); diff --git a/tests/bundle/Core/EventListener/OriginalRequestListenerTest.php b/tests/bundle/Core/EventListener/OriginalRequestListenerTest.php index 808c9f37cb..049931a944 100644 --- a/tests/bundle/Core/EventListener/OriginalRequestListenerTest.php +++ b/tests/bundle/Core/EventListener/OriginalRequestListenerTest.php @@ -47,7 +47,7 @@ public function testOnKernelRequestNoOriginalRequest() $event = new RequestEvent( $this->createMock(HttpKernelInterface::class), $request, - HttpKernelInterface::MASTER_REQUEST + HttpKernelInterface::MAIN_REQUEST ); $listener = new OriginalRequestListener(); @@ -75,7 +75,7 @@ public function testOnKernelRequestWithOriginalRequest() $event = new RequestEvent( $this->createMock(HttpKernelInterface::class), $request, - HttpKernelInterface::MASTER_REQUEST + HttpKernelInterface::MAIN_REQUEST ); $listener = new OriginalRequestListener(); diff --git a/tests/bundle/Core/EventListener/RejectExplicitFrontControllerRequestsListenerTest.php b/tests/bundle/Core/EventListener/RejectExplicitFrontControllerRequestsListenerTest.php index 394da78c70..a3e50db59a 100644 --- a/tests/bundle/Core/EventListener/RejectExplicitFrontControllerRequestsListenerTest.php +++ b/tests/bundle/Core/EventListener/RejectExplicitFrontControllerRequestsListenerTest.php @@ -54,7 +54,7 @@ public function testOnKernelRequest(Request $request): void $event = new RequestEvent( $this->httpKernel, $request, - HttpKernelInterface::MASTER_REQUEST + HttpKernelInterface::MAIN_REQUEST ); $this->eventListener->onKernelRequest($event); @@ -70,7 +70,7 @@ public function testOnKernelRequestThrowsException(Request $request): void $event = new RequestEvent( $this->httpKernel, $request, - HttpKernelInterface::MASTER_REQUEST + HttpKernelInterface::MAIN_REQUEST ); $this->eventListener->onKernelRequest($event); @@ -82,7 +82,7 @@ public function validRequestDataProvider(): array [ Request::create( 'https://example.com', - 'GET', + Request::METHOD_GET, [], [], [], @@ -95,7 +95,7 @@ public function validRequestDataProvider(): array [ Request::create( 'https://example.com/', - 'GET', + Request::METHOD_GET, [], [], [], @@ -108,7 +108,7 @@ public function validRequestDataProvider(): array [ Request::create( 'https://example.com/admin/dashboard', - 'GET', + Request::METHOD_GET, [], [], [], @@ -121,7 +121,7 @@ public function validRequestDataProvider(): array [ Request::create( 'https://example.com/admin/dashboard/', - 'GET', + Request::METHOD_GET, [], [], [], @@ -134,7 +134,7 @@ public function validRequestDataProvider(): array [ Request::create( 'https://example.com/Folder/Content', - 'GET', + Request::METHOD_GET, [], [], [], @@ -147,7 +147,7 @@ public function validRequestDataProvider(): array [ Request::create( 'https://example.com/Folder/Content/', - 'GET', + Request::METHOD_GET, [], [], [], @@ -160,7 +160,7 @@ public function validRequestDataProvider(): array [ Request::create( 'https://example.com/app.php-foo', - 'GET', + Request::METHOD_GET, [], [], [], @@ -173,7 +173,7 @@ public function validRequestDataProvider(): array [ Request::create( 'https://example.com/app.php.foo', - 'GET', + Request::METHOD_GET, [], [], [], @@ -186,7 +186,7 @@ public function validRequestDataProvider(): array [ Request::create( 'https://example.com/folder/folder/app.php', - 'GET', + Request::METHOD_GET, [], [], [], @@ -205,7 +205,7 @@ public function prohibitedRequestDataProvider(): array [ Request::create( 'https://example.com/app.php', - 'GET', + Request::METHOD_GET, [], [], [], @@ -218,7 +218,7 @@ public function prohibitedRequestDataProvider(): array [ Request::create( 'https://example.com/app.php/app.php', - 'GET', + Request::METHOD_GET, [], [], [], @@ -231,7 +231,7 @@ public function prohibitedRequestDataProvider(): array [ Request::create( 'https://example.com/folder/app.php', - 'GET', + Request::METHOD_GET, [], [], [], @@ -244,7 +244,7 @@ public function prohibitedRequestDataProvider(): array [ Request::create( 'https://example.com/app.php/foo', - 'GET', + Request::METHOD_GET, [], [], [], @@ -257,7 +257,7 @@ public function prohibitedRequestDataProvider(): array [ Request::create( 'https://example.com/app.php?foo=bar', - 'GET', + Request::METHOD_GET, [], [], [], @@ -270,7 +270,7 @@ public function prohibitedRequestDataProvider(): array [ Request::create( 'https://example.com/app.php#foo', - 'GET', + Request::METHOD_GET, [], [], [], diff --git a/tests/bundle/Core/EventListener/RequestEventListenerTest.php b/tests/bundle/Core/EventListener/RequestEventListenerTest.php index 4ea0c55102..f3bbd9d5d7 100644 --- a/tests/bundle/Core/EventListener/RequestEventListenerTest.php +++ b/tests/bundle/Core/EventListener/RequestEventListenerTest.php @@ -63,7 +63,7 @@ protected function setUp(): void $this->event = new RequestEvent( $this->httpKernel, $this->request, - HttpKernelInterface::MASTER_REQUEST + HttpKernelInterface::MAIN_REQUEST ); } @@ -96,13 +96,13 @@ public function testOnKernelRequestForward() $queryParameters = ['some' => 'thing']; $cookieParameters = ['cookie' => 'value']; - $request = Request::create('/test_sa/foo/bar', 'GET', $queryParameters, $cookieParameters); + $request = Request::create('/test_sa/foo/bar', Request::METHOD_GET, $queryParameters, $cookieParameters); $semanticPathinfo = '/foo/something'; $request->attributes->set('semanticPathinfo', $semanticPathinfo); $request->attributes->set('needsForward', true); $request->attributes->set('someAttribute', 'someValue'); - $expectedForwardRequest = Request::create($semanticPathinfo, 'GET', $queryParameters, $cookieParameters); + $expectedForwardRequest = Request::create($semanticPathinfo, Request::METHOD_GET, $queryParameters, $cookieParameters); $expectedForwardRequest->attributes->set('semanticPathinfo', $semanticPathinfo); $expectedForwardRequest->attributes->set('someAttribute', 'someValue'); @@ -113,7 +113,7 @@ public function testOnKernelRequestForward() ->with(self::equalTo($expectedForwardRequest)) ->will(self::returnValue($response)); - $event = new RequestEvent($this->httpKernel, $request, HttpKernelInterface::MASTER_REQUEST); + $event = new RequestEvent($this->httpKernel, $request, HttpKernelInterface::MAIN_REQUEST); $this->requestEventListener->onKernelRequestForward($event); self::assertSame($response, $event->getResponse()); self::assertTrue($event->isPropagationStopped()); @@ -132,13 +132,13 @@ public function testOnKernelRequestRedirect() { $queryParameters = ['some' => 'thing']; $cookieParameters = ['cookie' => 'value']; - $request = Request::create('/test_sa/foo/bar', 'GET', $queryParameters, $cookieParameters); + $request = Request::create('/test_sa/foo/bar', Request::METHOD_GET, $queryParameters, $cookieParameters); $semanticPathinfo = '/foo/something'; $request->attributes->set('semanticPathinfo', $semanticPathinfo); $request->attributes->set('needsRedirect', true); $request->attributes->set('siteaccess', new SiteAccess('test')); - $event = new RequestEvent($this->httpKernel, $request, HttpKernelInterface::MASTER_REQUEST); + $event = new RequestEvent($this->httpKernel, $request, HttpKernelInterface::MAIN_REQUEST); $this->requestEventListener->onKernelRequestRedirect($event); self::assertTrue($event->hasResponse()); /** @var \Symfony\Component\HttpFoundation\RedirectResponse $response */ @@ -153,14 +153,14 @@ public function testOnKernelRequestRedirectWithLocationId() { $queryParameters = ['some' => 'thing']; $cookieParameters = ['cookie' => 'value']; - $request = Request::create('/test_sa/foo/bar', 'GET', $queryParameters, $cookieParameters); + $request = Request::create('/test_sa/foo/bar', Request::METHOD_GET, $queryParameters, $cookieParameters); $semanticPathinfo = '/foo/something'; $request->attributes->set('semanticPathinfo', $semanticPathinfo); $request->attributes->set('needsRedirect', true); $request->attributes->set('locationId', 123); $request->attributes->set('siteaccess', new SiteAccess('test')); - $event = new RequestEvent($this->httpKernel, $request, HttpKernelInterface::MASTER_REQUEST); + $event = new RequestEvent($this->httpKernel, $request, HttpKernelInterface::MAIN_REQUEST); $this->requestEventListener->onKernelRequestRedirect($event); self::assertTrue($event->hasResponse()); /** @var \Symfony\Component\HttpFoundation\RedirectResponse $response */ @@ -180,7 +180,7 @@ public function testOnKernelRequestRedirectPrependSiteaccess() $siteaccess = new SiteAccess('test', 'foo', $siteaccessMatcher); $semanticPathinfo = '/foo/something'; - $request = Request::create('/test_sa/foo/bar', 'GET', $queryParameters, $cookieParameters); + $request = Request::create('/test_sa/foo/bar', Request::METHOD_GET, $queryParameters, $cookieParameters); $request->attributes->set('semanticPathinfo', $semanticPathinfo); $request->attributes->set('needsRedirect', true); $request->attributes->set('siteaccess', $siteaccess); @@ -193,7 +193,7 @@ public function testOnKernelRequestRedirectPrependSiteaccess() ->with($semanticPathinfo) ->will(self::returnValue($expectedURI)); - $event = new RequestEvent($this->httpKernel, $request, HttpKernelInterface::MASTER_REQUEST); + $event = new RequestEvent($this->httpKernel, $request, HttpKernelInterface::MAIN_REQUEST); $this->requestEventListener->onKernelRequestRedirect($event); self::assertTrue($event->hasResponse()); /** @var \Symfony\Component\HttpFoundation\RedirectResponse $response */ diff --git a/tests/bundle/Core/EventListener/RoutingListenerTest.php b/tests/bundle/Core/EventListener/RoutingListenerTest.php index 1da1ca1e28..76663ac22f 100644 --- a/tests/bundle/Core/EventListener/RoutingListenerTest.php +++ b/tests/bundle/Core/EventListener/RoutingListenerTest.php @@ -77,7 +77,7 @@ public function testOnSiteAccessMatch() ->method('setExcludedUriPrefixes') ->with($excludedUriPrefixes); - $event = new PostSiteAccessMatchEvent(new SiteAccess('test'), new Request(), HttpKernelInterface::MASTER_REQUEST); + $event = new PostSiteAccessMatchEvent(new SiteAccess('test'), new Request(), HttpKernelInterface::MAIN_REQUEST); $listener = new RoutingListener($this->configResolver, $this->urlAliasRouter, $this->urlAliasGenerator); $listener->onSiteAccessMatch($event); } diff --git a/tests/bundle/Core/EventListener/SessionSetDynamicNameListenerTest.php b/tests/bundle/Core/EventListener/SessionSetDynamicNameListenerTest.php index 8c2bb1650d..1be3172bea 100644 --- a/tests/bundle/Core/EventListener/SessionSetDynamicNameListenerTest.php +++ b/tests/bundle/Core/EventListener/SessionSetDynamicNameListenerTest.php @@ -65,7 +65,7 @@ public function testOnSiteAccessMatchNoSession() ->expects(self::never()) ->method('setOptions'); $listener = new SessionSetDynamicNameListener($this->configResolver, $this->sessionStorageFactory); - $listener->onSiteAccessMatch(new PostSiteAccessMatchEvent(new SiteAccess('test'), $request, HttpKernelInterface::MASTER_REQUEST)); + $listener->onSiteAccessMatch(new PostSiteAccessMatchEvent(new SiteAccess('test'), $request, HttpKernelInterface::MAIN_REQUEST)); } public function testOnSiteAccessMatchSubRequest() diff --git a/tests/bundle/Core/EventListener/SiteAccessListenerTest.php b/tests/bundle/Core/EventListener/SiteAccessListenerTest.php index 3f8aa0ef9f..164d6dbfec 100644 --- a/tests/bundle/Core/EventListener/SiteAccessListenerTest.php +++ b/tests/bundle/Core/EventListener/SiteAccessListenerTest.php @@ -85,7 +85,7 @@ public function testOnSiteAccessMatchMasterRequest( $siteAccess = new SiteAccess('test', 'test', $matcher); $request = Request::create($uri); - $event = new PostSiteAccessMatchEvent($siteAccess, $request, HttpKernelInterface::MASTER_REQUEST); + $event = new PostSiteAccessMatchEvent($siteAccess, $request, HttpKernelInterface::MAIN_REQUEST); $this->listener->onSiteAccessMatch($event); self::assertSame($expectedSemanticPathinfo, $request->attributes->get('semanticPathinfo')); diff --git a/tests/bundle/Core/EventListener/ViewControllerListenerTest.php b/tests/bundle/Core/EventListener/ViewControllerListenerTest.php index cc29ec416c..f9744862d4 100644 --- a/tests/bundle/Core/EventListener/ViewControllerListenerTest.php +++ b/tests/bundle/Core/EventListener/ViewControllerListenerTest.php @@ -198,7 +198,7 @@ protected function createEvent() $this->createMock(HttpKernelInterface::class), static function () {}, $this->request, - HttpKernelInterface::MASTER_REQUEST + HttpKernelInterface::MAIN_REQUEST ); } } diff --git a/tests/bundle/Core/EventSubscriber/CrowdinRequestLocaleSubscriberTest.php b/tests/bundle/Core/EventSubscriber/CrowdinRequestLocaleSubscriberTest.php index e986c9200c..2a6e88ab9a 100644 --- a/tests/bundle/Core/EventSubscriber/CrowdinRequestLocaleSubscriberTest.php +++ b/tests/bundle/Core/EventSubscriber/CrowdinRequestLocaleSubscriberTest.php @@ -23,7 +23,7 @@ public function testSetLocale(Request $request, $shouldHaveCustomLocale) $event = new RequestEvent( $this->getMockBuilder(HttpKernelInterface::class)->getMock(), $request, - HttpKernelInterface::MASTER_REQUEST + HttpKernelInterface::MAIN_REQUEST ); $subscriber = new CrowdinRequestLocaleSubscriber(); diff --git a/tests/bundle/Core/EventSubscriber/TrustedHeaderClientIpEventSubscriberTest.php b/tests/bundle/Core/EventSubscriber/TrustedHeaderClientIpEventSubscriberTest.php index 55446a653d..a934f1fcbf 100644 --- a/tests/bundle/Core/EventSubscriber/TrustedHeaderClientIpEventSubscriberTest.php +++ b/tests/bundle/Core/EventSubscriber/TrustedHeaderClientIpEventSubscriberTest.php @@ -120,7 +120,7 @@ public function testTrustedHeaderEventSubscriberWithoutTrustedProxy(): void new TrustedHeaderClientIpEventSubscriber('X-Custom-Header') ); - $request = Request::create('/', 'GET', [], [], [], array_merge( + $request = Request::create('/', Request::METHOD_GET, [], [], [], array_merge( $_SERVER, ['PLATFORM_RELATIONSHIPS' => true], )); @@ -158,7 +158,7 @@ public function testTrustedHeaderEventSubscriberWithTrustedProxy( new TrustedHeaderClientIpEventSubscriber($trustedHeaderName) ); - $request = Request::create('/', 'GET', [], [], [], array_merge( + $request = Request::create('/', Request::METHOD_GET, [], [], [], array_merge( $server, ['REMOTE_ADDR' => $remoteAddrIp], )); diff --git a/tests/bundle/Core/Fragment/DirectFragmentRendererTest.php b/tests/bundle/Core/Fragment/DirectFragmentRendererTest.php index 3c90267760..291d83a13c 100644 --- a/tests/bundle/Core/Fragment/DirectFragmentRendererTest.php +++ b/tests/bundle/Core/Fragment/DirectFragmentRendererTest.php @@ -31,7 +31,7 @@ public function testSubRequestBuilding(): void $controllerResolver ->expects(self::any()) ->method('getController') - ->with(self::callback(function (Request $request) { + ->with(self::callback(function (Request $request): bool { $this->assertEquals('/_fragment', $request->getPathInfo()); $this->assertEquals('some::controller', $request->attributes->get('_controller')); $this->assertEquals('attribute_value', $request->attributes->get('some')); @@ -41,7 +41,7 @@ public function testSubRequestBuilding(): void return true; })) - ->willReturn(static function () { + ->willReturn(static function (): string { return 'rendered_response'; }); @@ -123,7 +123,7 @@ public function testControllerStringResponse(): void $controllerResolver ->method('getController') - ->willReturn(static function () { + ->willReturn(static function (): string { return 'some_prerendered_response'; }); diff --git a/tests/bundle/Core/Routing/DefaultRouterTest.php b/tests/bundle/Core/Routing/DefaultRouterTest.php index e81a4ddfc6..71609b38cb 100644 --- a/tests/bundle/Core/Routing/DefaultRouterTest.php +++ b/tests/bundle/Core/Routing/DefaultRouterTest.php @@ -42,7 +42,7 @@ protected function setUp(): void /** * @return class-string<\Ibexa\Bundle\Core\Routing\DefaultRouter> */ - protected function getRouterClass() + protected function getRouterClass(): string { return DefaultRouter::class; } diff --git a/tests/bundle/Core/URLChecker/URLCheckerTest.php b/tests/bundle/Core/URLChecker/URLCheckerTest.php index 51e4074e67..e0d6be90ec 100644 --- a/tests/bundle/Core/URLChecker/URLCheckerTest.php +++ b/tests/bundle/Core/URLChecker/URLCheckerTest.php @@ -113,7 +113,7 @@ private function configureUrlHandlerRegistry(array $schemes) { $this->handlerRegistry ->method('supported') - ->willReturnCallback(static function ($scheme) use ($schemes) { + ->willReturnCallback(static function ($scheme) use ($schemes): bool { return isset($schemes[$scheme]); }); diff --git a/tests/bundle/IO/DependencyInjection/ConfigurationFactory/BinarydataHandler/FlysystemTest.php b/tests/bundle/IO/DependencyInjection/ConfigurationFactory/BinarydataHandler/FlysystemTest.php index 7ce7f96664..42a641da82 100644 --- a/tests/bundle/IO/DependencyInjection/ConfigurationFactory/BinarydataHandler/FlysystemTest.php +++ b/tests/bundle/IO/DependencyInjection/ConfigurationFactory/BinarydataHandler/FlysystemTest.php @@ -20,7 +20,7 @@ public function provideTestedFactory(): Flysystem /** * Returns the expected parent service id. */ - public function provideExpectedParentServiceId() + public function provideExpectedParentServiceId(): string { return 'ibexa.core.io.binarydata_handler.flysystem'; } diff --git a/tests/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/FlysystemTest.php b/tests/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/FlysystemTest.php index 51565ab1bf..fb745f670d 100644 --- a/tests/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/FlysystemTest.php +++ b/tests/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/FlysystemTest.php @@ -24,7 +24,7 @@ public function provideTestedFactory() /** * Returns the expected parent service id. */ - public function provideExpectedParentServiceId() + public function provideExpectedParentServiceId(): string { return 'ibexa.core.io.metadata_handler.flysystem'; } diff --git a/tests/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/LegacyDFSClusterTest.php b/tests/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/LegacyDFSClusterTest.php index c6658cc34f..384e18f1df 100644 --- a/tests/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/LegacyDFSClusterTest.php +++ b/tests/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/LegacyDFSClusterTest.php @@ -23,7 +23,7 @@ public function provideTestedFactory() return new LegacyDFSCluster(); } - public function provideExpectedParentServiceId() + public function provideExpectedParentServiceId(): string { return \Ibexa\Core\IO\IOMetadataHandler\LegacyDFSCluster::class; } diff --git a/tests/bundle/IO/DependencyInjection/ConfigurationFactoryTest.php b/tests/bundle/IO/DependencyInjection/ConfigurationFactoryTest.php index 265c7f72cb..6058496e9d 100644 --- a/tests/bundle/IO/DependencyInjection/ConfigurationFactoryTest.php +++ b/tests/bundle/IO/DependencyInjection/ConfigurationFactoryTest.php @@ -72,7 +72,7 @@ public function testConfigureHandler() /** * Registers the handler in the container, like the pass would have done. */ - private function registerHandler($name) + private function registerHandler($name): string { $this->setDefinition($this->provideExpectedParentServiceId(), $this->provideParentServiceDefinition()); $handlerServiceId = sprintf('%s.%s', $this->provideExpectedParentServiceId(), $name); diff --git a/tests/bundle/IO/EventListener/StreamFileListenerTest.php b/tests/bundle/IO/EventListener/StreamFileListenerTest.php index 44965df76e..cce315842e 100644 --- a/tests/bundle/IO/EventListener/StreamFileListenerTest.php +++ b/tests/bundle/IO/EventListener/StreamFileListenerTest.php @@ -158,7 +158,7 @@ protected function createEvent($request) $event = new RequestEvent( $this->createMock(HttpKernelInterface::class), $request, - HttpKernelInterface::MASTER_REQUEST + HttpKernelInterface::MAIN_REQUEST ); return $event; diff --git a/tests/bundle/RepositoryInstaller/IbexaRepositoryInstallerBundleTest.php b/tests/bundle/RepositoryInstaller/IbexaRepositoryInstallerBundleTest.php index aab4504a96..16b396b1b7 100644 --- a/tests/bundle/RepositoryInstaller/IbexaRepositoryInstallerBundleTest.php +++ b/tests/bundle/RepositoryInstaller/IbexaRepositoryInstallerBundleTest.php @@ -39,7 +39,7 @@ public function testBuild(): void self::assertNotEmpty( array_filter( $container->getCompilerPassConfig()->getPasses(), - static function (CompilerPassInterface $compilerPass) { + static function (CompilerPassInterface $compilerPass): bool { return $compilerPass instanceof InstallerTagPass; } ) diff --git a/tests/integration/Core/Repository/BaseTest.php b/tests/integration/Core/Repository/BaseTest.php index f746b8d511..21782516c0 100644 --- a/tests/integration/Core/Repository/BaseTest.php +++ b/tests/integration/Core/Repository/BaseTest.php @@ -275,7 +275,7 @@ protected function assertStructPropertiesCorrect(ValueObject $expectedValues, Va */ private function sortItems(array &$items) { - $sorter = function ($a, $b) { + $sorter = function ($a, $b): int { if (!is_scalar($a) || !is_scalar($b)) { $this->fail('Wrong usage: method ' . __METHOD__ . ' accepts only an array of scalar values'); } diff --git a/tests/integration/Core/Repository/ContentServiceTest.php b/tests/integration/Core/Repository/ContentServiceTest.php index cbe2cc5c4a..00b934058a 100644 --- a/tests/integration/Core/Repository/ContentServiceTest.php +++ b/tests/integration/Core/Repository/ContentServiceTest.php @@ -2769,7 +2769,7 @@ public function testLoadContentByVersionInfoWithSecondParameter() } usort( $actual, - static function ($field1, $field2) { + static function ($field1, $field2): int { if (0 === ($return = strcasecmp($field1->fieldDefIdentifier, $field2->fieldDefIdentifier))) { return strcasecmp($field1->languageCode, $field2->languageCode); } @@ -3665,7 +3665,7 @@ public function testLoadRelations() usort( $relations, - static function ($rel1, $rel2) { + static function ($rel1, $rel2): int { return strcasecmp( $rel2->getDestinationContentInfo()->remoteId, $rel1->getDestinationContentInfo()->remoteId @@ -3985,7 +3985,7 @@ public function testLoadReverseRelations() usort( $reverseRelations, - static function ($rel1, $rel2) { + static function ($rel1, $rel2): int { return strcasecmp( $rel2->getSourceContentInfo()->remoteId, $rel1->getSourceContentInfo()->remoteId @@ -6155,7 +6155,7 @@ private function normalizeFields(array $fields) } usort( $normalized, - static function ($field1, $field2) { + static function ($field1, $field2): int { if (0 === ($return = strcasecmp($field1->fieldDefIdentifier, $field2->fieldDefIdentifier))) { return strcasecmp($field1->languageCode, $field2->languageCode); } diff --git a/tests/integration/Core/Repository/ContentTypeServiceTest.php b/tests/integration/Core/Repository/ContentTypeServiceTest.php index b2ca98cb53..6d066c2752 100644 --- a/tests/integration/Core/Repository/ContentTypeServiceTest.php +++ b/tests/integration/Core/Repository/ContentTypeServiceTest.php @@ -970,7 +970,7 @@ protected function assertFieldDefinitionsCorrect( 'Count of field definition creates did not match count of field definitions.' ); - $sorter = static function ($a, $b) { + $sorter = static function ($a, $b): int { return strcmp($a->identifier, $b->identifier); }; @@ -1011,7 +1011,7 @@ protected function assertFieldDefinitionsEqual( */ protected function assertContentTypeGroupsCorrect($expectedGroups, $actualGroups) { - $sorter = static function ($a, $b) { + $sorter = static function ($a, $b): int { return strcmp($a->id, $b->id); }; @@ -3192,7 +3192,7 @@ public function testLoadContentTypesContent(array $types) usort( $types, - static function ($a, $b) { + static function ($a, $b): int { if ($a->id == $b->id) { return 0; } diff --git a/tests/integration/Core/Repository/FieldType/AuthorIntegrationTest.php b/tests/integration/Core/Repository/FieldType/AuthorIntegrationTest.php index edcb4759ae..a1a200a2f8 100644 --- a/tests/integration/Core/Repository/FieldType/AuthorIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/AuthorIntegrationTest.php @@ -27,7 +27,7 @@ class AuthorIntegrationTest extends SearchMultivaluedBaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezauthor'; } @@ -128,7 +128,7 @@ public function getValidCreationFieldData() * * @return string */ - public function getFieldName() + public function getFieldName(): string { return 'Hans Mueller'; } @@ -422,12 +422,12 @@ protected function getValidSearchValueTwo() ]; } - protected function getSearchTargetValueOne() + protected function getSearchTargetValueOne(): string { return 'Ferdinand'; } - protected function getSearchTargetValueTwo() + protected function getSearchTargetValueTwo(): string { return 'Greta'; } diff --git a/tests/integration/Core/Repository/FieldType/BinaryFileIntegrationTest.php b/tests/integration/Core/Repository/FieldType/BinaryFileIntegrationTest.php index 0d7e51ddfc..d93dcf7dc8 100644 --- a/tests/integration/Core/Repository/FieldType/BinaryFileIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/BinaryFileIntegrationTest.php @@ -48,7 +48,7 @@ protected function getFixtureData(): array * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezbinaryfile'; } diff --git a/tests/integration/Core/Repository/FieldType/CheckboxIntegrationTest.php b/tests/integration/Core/Repository/FieldType/CheckboxIntegrationTest.php index 5e89b06d14..537552f3b5 100644 --- a/tests/integration/Core/Repository/FieldType/CheckboxIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/CheckboxIntegrationTest.php @@ -32,7 +32,7 @@ class CheckboxIntegrationTest extends SearchBaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezboolean'; } @@ -116,7 +116,7 @@ public function getValidCreationFieldData() * * @return string */ - public function getFieldName() + public function getFieldName(): string { return '1'; } @@ -280,12 +280,12 @@ public function providerForTestIsNotEmptyValue() ]; } - protected function getValidSearchValueOne() + protected function getValidSearchValueOne(): bool { return false; } - protected function getValidSearchValueTwo() + protected function getValidSearchValueTwo(): bool { return true; } diff --git a/tests/integration/Core/Repository/FieldType/CountryIntegrationTest.php b/tests/integration/Core/Repository/FieldType/CountryIntegrationTest.php index 624e3dc6e1..b74fb63e7b 100644 --- a/tests/integration/Core/Repository/FieldType/CountryIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/CountryIntegrationTest.php @@ -25,7 +25,7 @@ class CountryIntegrationTest extends SearchMultivaluedBaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezcountry'; } @@ -125,7 +125,7 @@ public function getValidCreationFieldData() * * @return string */ - public function getFieldName() + public function getFieldName(): string { return 'Belgium'; } @@ -382,12 +382,12 @@ protected function getValidSearchValueTwo() return ['Trinidad and Tobago']; } - protected function getSearchTargetValueOne() + protected function getSearchTargetValueOne(): string { return 'Andorra'; } - protected function getSearchTargetValueTwo() + protected function getSearchTargetValueTwo(): string { return 'Trinidad and Tobago'; } diff --git a/tests/integration/Core/Repository/FieldType/DateAndTimeIntegrationTest.php b/tests/integration/Core/Repository/FieldType/DateAndTimeIntegrationTest.php index b73865824d..9c2616cdad 100644 --- a/tests/integration/Core/Repository/FieldType/DateAndTimeIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/DateAndTimeIntegrationTest.php @@ -26,7 +26,7 @@ class DateAndTimeIntegrationTest extends SearchBaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezdatetime'; } @@ -34,7 +34,7 @@ public function getTypeName() /** * {@inheritdoc} */ - protected function supportsLikeWildcard($value) + protected function supportsLikeWildcard($value): bool { parent::supportsLikeWildcard($value); @@ -139,7 +139,7 @@ public function getValidCreationFieldData() * * @return string */ - public function getFieldName() + public function getFieldName(): string { return 'Fri 1970-02-01 10:17:36'; } @@ -325,12 +325,12 @@ public function providerForTestIsNotEmptyValue() ]; } - protected function getValidSearchValueOne() + protected function getValidSearchValueOne(): string { return '2012-04-15T15:43:56Z'; } - protected function getValidSearchValueTwo() + protected function getValidSearchValueTwo(): string { return '2015-04-15T15:43:56Z'; } diff --git a/tests/integration/Core/Repository/FieldType/DateIntegrationTest.php b/tests/integration/Core/Repository/FieldType/DateIntegrationTest.php index d80ff979d8..1c6b88aca5 100644 --- a/tests/integration/Core/Repository/FieldType/DateIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/DateIntegrationTest.php @@ -27,7 +27,7 @@ class DateIntegrationTest extends SearchBaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezdate'; } @@ -35,7 +35,7 @@ public function getTypeName() /** * {@inheritdoc} */ - protected function supportsLikeWildcard($value) + protected function supportsLikeWildcard($value): bool { parent::supportsLikeWildcard($value); @@ -128,7 +128,7 @@ public function getValidCreationFieldData() * * @return string */ - public function getFieldName() + public function getFieldName(): string { return 'Friday 02 January 1970'; } @@ -317,12 +317,12 @@ public function providerForTestIsNotEmptyValue() ]; } - protected function getValidSearchValueOne() + protected function getValidSearchValueOne(): int { return 86400; } - protected function getValidSearchValueTwo() + protected function getValidSearchValueTwo(): int { return 172800; } diff --git a/tests/integration/Core/Repository/FieldType/EmailAddressIntegrationTest.php b/tests/integration/Core/Repository/FieldType/EmailAddressIntegrationTest.php index 9305134166..58ad782a6a 100644 --- a/tests/integration/Core/Repository/FieldType/EmailAddressIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/EmailAddressIntegrationTest.php @@ -25,7 +25,7 @@ class EmailAddressIntegrationTest extends SearchBaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezemail'; } @@ -115,7 +115,7 @@ public function getValidCreationFieldData() * * @return string */ - public function getFieldName() + public function getFieldName(): string { return 'spam@ibexa.co'; } @@ -301,23 +301,23 @@ public function providerForTestIsNotEmptyValue() ]; } - protected function getValidSearchValueOne() + protected function getValidSearchValueOne(): string { return 'holmes4@ibexa.co'; } - protected function getSearchTargetValueOne() + protected function getSearchTargetValueOne(): string { // ensure case-insensitivity return strtoupper($this->getValidSearchValueOne()); } - protected function getValidSearchValueTwo() + protected function getValidSearchValueTwo(): string { return 'wyoming.knott@o2.ru'; } - protected function getSearchTargetValueTwo() + protected function getSearchTargetValueTwo(): string { // ensure case-insensitivity return strtoupper($this->getValidSearchValueTwo()); diff --git a/tests/integration/Core/Repository/FieldType/FloatIntegrationTest.php b/tests/integration/Core/Repository/FieldType/FloatIntegrationTest.php index b9aa74d719..97845f7893 100644 --- a/tests/integration/Core/Repository/FieldType/FloatIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/FloatIntegrationTest.php @@ -25,7 +25,7 @@ class FloatIntegrationTest extends SearchBaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezfloat'; } @@ -127,7 +127,7 @@ public function getValidCreationFieldData() * * @return string */ - public function getFieldName() + public function getFieldName(): string { return '23.5'; } @@ -299,12 +299,12 @@ public function providerForTestIsNotEmptyValue() ]; } - protected function getValidSearchValueOne() + protected function getValidSearchValueOne(): float { return 25.519; } - protected function getValidSearchValueTwo() + protected function getValidSearchValueTwo(): float { return 25.59; } diff --git a/tests/integration/Core/Repository/FieldType/ISBNIntegrationTest.php b/tests/integration/Core/Repository/FieldType/ISBNIntegrationTest.php index 372fd1da89..5e7d747927 100644 --- a/tests/integration/Core/Repository/FieldType/ISBNIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/ISBNIntegrationTest.php @@ -25,7 +25,7 @@ class ISBNIntegrationTest extends SearchBaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezisbn'; } @@ -116,7 +116,7 @@ public function getValidCreationFieldData() * * @return string */ - public function getFieldName() + public function getFieldName(): string { return '9789722514095'; } @@ -310,12 +310,12 @@ public function providerForTestIsNotEmptyValue() ]; } - protected function getValidSearchValueOne() + protected function getValidSearchValueOne(): string { return '9780099067504'; } - protected function getValidSearchValueTwo() + protected function getValidSearchValueTwo(): string { return '9780380448340'; } diff --git a/tests/integration/Core/Repository/FieldType/IntegerIntegrationTest.php b/tests/integration/Core/Repository/FieldType/IntegerIntegrationTest.php index c46c4705bc..6e62427e2d 100644 --- a/tests/integration/Core/Repository/FieldType/IntegerIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/IntegerIntegrationTest.php @@ -25,7 +25,7 @@ class IntegerIntegrationTest extends SearchBaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezinteger'; } @@ -127,7 +127,7 @@ public function getValidCreationFieldData() * * @return string */ - public function getFieldName() + public function getFieldName(): string { return '23'; } @@ -301,12 +301,12 @@ public function providerForTestIsNotEmptyValue() ]; } - protected function getValidSearchValueOne() + protected function getValidSearchValueOne(): int { return 25; } - protected function getValidSearchValueTwo() + protected function getValidSearchValueTwo(): int { return 26; } diff --git a/tests/integration/Core/Repository/FieldType/KeywordIntegrationTest.php b/tests/integration/Core/Repository/FieldType/KeywordIntegrationTest.php index da9e18cd3e..6673e530a9 100644 --- a/tests/integration/Core/Repository/FieldType/KeywordIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/KeywordIntegrationTest.php @@ -27,7 +27,7 @@ class KeywordIntegrationTest extends SearchMultivaluedBaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezkeyword'; } @@ -130,7 +130,7 @@ public function getValidMultilingualFieldData(array $languageCodes) * * @return string */ - public function getFieldName() + public function getFieldName(): string { return 'foo, bar, sindelfingen'; } @@ -441,12 +441,12 @@ protected function createAndPublishContent($fieldData, ContentType $contentType, return $contentService->publishVersion($contentDraft->versionInfo); } - protected function getValidSearchValueOne() + protected function getValidSearchValueOne(): string { return 'add'; } - protected function getValidSearchValueTwo() + protected function getValidSearchValueTwo(): string { return 'branch'; } diff --git a/tests/integration/Core/Repository/FieldType/MapLocationIntegrationTest.php b/tests/integration/Core/Repository/FieldType/MapLocationIntegrationTest.php index 2bba30b21a..240e1a9c6e 100644 --- a/tests/integration/Core/Repository/FieldType/MapLocationIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/MapLocationIntegrationTest.php @@ -24,7 +24,7 @@ class MapLocationIntegrationTest extends BaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezgmaplocation'; } @@ -114,7 +114,7 @@ public function getValidCreationFieldData() * * @return string */ - public function getFieldName() + public function getFieldName(): string { return 'Bielefeld'; } diff --git a/tests/integration/Core/Repository/FieldType/MediaIntegrationTest.php b/tests/integration/Core/Repository/FieldType/MediaIntegrationTest.php index 4ab6d1bed9..e491315b10 100644 --- a/tests/integration/Core/Repository/FieldType/MediaIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/MediaIntegrationTest.php @@ -53,7 +53,7 @@ protected function getFixtureData(): array * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezmedia'; } diff --git a/tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php b/tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php index f7ca3c9568..f1ed678eb4 100644 --- a/tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php @@ -29,7 +29,7 @@ class RelationIntegrationTest extends SearchBaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezobjectrelation'; } @@ -37,7 +37,7 @@ public function getTypeName() /** * {@inheritdoc} */ - protected function supportsLikeWildcard($value) + protected function supportsLikeWildcard($value): bool { parent::supportsLikeWildcard($value); @@ -189,7 +189,7 @@ public function getValidCreationFieldData() * * @return string */ - public function getFieldName() + public function getFieldName(): string { return 'Users'; } @@ -353,7 +353,7 @@ public function providerForTestIsNotEmptyValue() ]; } - protected function getValidSearchValueOne() + protected function getValidSearchValueOne(): int { // Using different values for Legacy Search Engine, in order to demonstrate that sort will // depend on how search engine stores field type's value. Legacy stores it as integer, while @@ -365,7 +365,7 @@ protected function getValidSearchValueOne() return 10; } - protected function getValidSearchValueTwo() + protected function getValidSearchValueTwo(): int { // Using different values for Legacy Search Engine, in order to demonstrate that sort will // depend on how search engine stores field type's value. Legacy stores it as integer, while diff --git a/tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php b/tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php index cfcce0d3bd..19fd77c786 100644 --- a/tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php @@ -29,7 +29,7 @@ class RelationListIntegrationTest extends SearchMultivaluedBaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezobjectrelationlist'; } @@ -37,7 +37,7 @@ public function getTypeName() /** * {@inheritdoc} */ - protected function supportsLikeWildcard($value) + protected function supportsLikeWildcard($value): bool { parent::supportsLikeWildcard($value); @@ -218,7 +218,7 @@ public function getValidCreationFieldData() * * @return string */ - public function getFieldName() + public function getFieldName(): string { return 'Users' . ' ' . 'Images'; } @@ -392,12 +392,12 @@ protected function getValidSearchValueTwo() return [12]; } - protected function getSearchTargetValueOne() + protected function getSearchTargetValueOne(): int { return 11; } - protected function getSearchTargetValueTwo() + protected function getSearchTargetValueTwo(): int { return 12; } diff --git a/tests/integration/Core/Repository/FieldType/RelationSearchBaseIntegrationTestTrait.php b/tests/integration/Core/Repository/FieldType/RelationSearchBaseIntegrationTestTrait.php index f699b6f595..a6acd700d7 100644 --- a/tests/integration/Core/Repository/FieldType/RelationSearchBaseIntegrationTestTrait.php +++ b/tests/integration/Core/Repository/FieldType/RelationSearchBaseIntegrationTestTrait.php @@ -81,7 +81,7 @@ protected function normalizeRelations(array $relations) { usort( $relations, - static function (Relation $a, Relation $b) { + static function (Relation $a, Relation $b): int { if ($a->type == $b->type) { return $a->destinationContentInfo->id < $b->destinationContentInfo->id ? 1 : -1; } diff --git a/tests/integration/Core/Repository/FieldType/SelectionMultilingualIntegrationTest.php b/tests/integration/Core/Repository/FieldType/SelectionMultilingualIntegrationTest.php index f96272f3a3..0cdb894853 100644 --- a/tests/integration/Core/Repository/FieldType/SelectionMultilingualIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/SelectionMultilingualIntegrationTest.php @@ -85,7 +85,7 @@ public function getValidFieldConfiguration(): array ]; } - public function getFieldName() + public function getFieldName(): string { return 'Arkansas' . ' ' . 'Mississippi'; } diff --git a/tests/integration/Core/Repository/FieldType/TextBlockIntegrationTest.php b/tests/integration/Core/Repository/FieldType/TextBlockIntegrationTest.php index c9ec559dae..8d664ba334 100644 --- a/tests/integration/Core/Repository/FieldType/TextBlockIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/TextBlockIntegrationTest.php @@ -24,7 +24,7 @@ class TextBlockIntegrationTest extends SearchBaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'eztext'; } @@ -115,7 +115,7 @@ public function getValidCreationFieldData() * * @return string */ - public function getFieldName() + public function getFieldName(): string { return 'Example'; } @@ -285,23 +285,23 @@ public function providerForTestIsNotEmptyValue() ]; } - protected function getValidSearchValueOne() + protected function getValidSearchValueOne(): string { return 'caution is the " path to mediocrity' . PHP_EOL . 'something completely different'; } - protected function getSearchTargetValueOne() + protected function getSearchTargetValueOne(): string { // ensure case-insensitivity return strtoupper('caution is the " path to mediocrity'); } - protected function getValidSearchValueTwo() + protected function getValidSearchValueTwo(): string { return "truth suffers from ' too much analysis\n hello and goodbye"; } - protected function getSearchTargetValueTwo() + protected function getSearchTargetValueTwo(): string { // ensure case-insensitivity return strtoupper("truth suffers from ' too much analysis"); diff --git a/tests/integration/Core/Repository/FieldType/TextLineIntegrationTest.php b/tests/integration/Core/Repository/FieldType/TextLineIntegrationTest.php index 6e90e1043c..73fb280f23 100644 --- a/tests/integration/Core/Repository/FieldType/TextLineIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/TextLineIntegrationTest.php @@ -25,7 +25,7 @@ class TextLineIntegrationTest extends SearchBaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezstring'; } @@ -127,7 +127,7 @@ public function getValidCreationFieldData() * * @return string */ - public function getFieldName() + public function getFieldName(): string { return 'Example'; } @@ -303,23 +303,23 @@ public function providerForTestIsNotEmptyValue() ]; } - protected function getValidSearchValueOne() + protected function getValidSearchValueOne(): string { return 'aaa'; } - protected function getSearchTargetValueOne() + protected function getSearchTargetValueOne(): string { // ensure case-insensitivity return strtoupper($this->getValidSearchValueOne()); } - protected function getValidSearchValueTwo() + protected function getValidSearchValueTwo(): string { return 'bbb'; } - protected function getSearchTargetValueTwo() + protected function getSearchTargetValueTwo(): string { // ensure case-insensitivity return strtoupper($this->getValidSearchValueTwo()); diff --git a/tests/integration/Core/Repository/FieldType/TimeIntegrationTest.php b/tests/integration/Core/Repository/FieldType/TimeIntegrationTest.php index 246bea5fa6..7bf5f66e29 100644 --- a/tests/integration/Core/Repository/FieldType/TimeIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/TimeIntegrationTest.php @@ -25,7 +25,7 @@ class TimeIntegrationTest extends SearchBaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'eztime'; } @@ -33,7 +33,7 @@ public function getTypeName() /** * {@inheritdoc} */ - protected function supportsLikeWildcard($value) + protected function supportsLikeWildcard($value): bool { parent::supportsLikeWildcard($value); @@ -133,7 +133,7 @@ public function getValidCreationFieldData() * * @return string */ - public function getFieldName() + public function getFieldName(): string { return '1:01:01 am'; } @@ -327,12 +327,12 @@ protected function getValidSearchValueTwo() return new TimeValue($this->getSearchTargetValueTwo()); } - protected function getSearchTargetValueOne() + protected function getSearchTargetValueOne(): int { return 9600; } - protected function getSearchTargetValueTwo() + protected function getSearchTargetValueTwo(): int { return 14400; } diff --git a/tests/integration/Core/Repository/FieldType/UrlIntegrationTest.php b/tests/integration/Core/Repository/FieldType/UrlIntegrationTest.php index 5d0b1aecbd..9a5f34e9ad 100644 --- a/tests/integration/Core/Repository/FieldType/UrlIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/UrlIntegrationTest.php @@ -24,7 +24,7 @@ class UrlIntegrationTest extends SearchBaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezurl'; } @@ -108,7 +108,7 @@ public function getValidCreationFieldData() * * @return string */ - public function getFieldName() + public function getFieldName(): string { return 'Example'; } @@ -309,12 +309,12 @@ protected function getValidSearchValueTwo() return new UrlValue('http://example.com', 'Example'); } - protected function getSearchTargetValueOne() + protected function getSearchTargetValueOne(): string { return 'http://ample.com'; } - protected function getSearchTargetValueTwo() + protected function getSearchTargetValueTwo(): string { return 'http://example.com'; } diff --git a/tests/integration/Core/Repository/FieldType/UserIntegrationTest.php b/tests/integration/Core/Repository/FieldType/UserIntegrationTest.php index 5c798c2f24..432e0a2b8c 100644 --- a/tests/integration/Core/Repository/FieldType/UserIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/UserIntegrationTest.php @@ -33,7 +33,7 @@ class UserIntegrationTest extends BaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezuser'; } @@ -155,7 +155,7 @@ public function getValidCreationFieldData(): UserValue * * @return string */ - public function getFieldName() + public function getFieldName(): string { return self::TEST_LOGIN; } diff --git a/tests/integration/Core/Repository/LocationServiceTest.php b/tests/integration/Core/Repository/LocationServiceTest.php index 794b43676c..63875e9cb3 100644 --- a/tests/integration/Core/Repository/LocationServiceTest.php +++ b/tests/integration/Core/Repository/LocationServiceTest.php @@ -881,7 +881,7 @@ public function testLoadLocationsContent(array $locations) usort( $locations, - static function ($a, $b) { + static function ($a, $b): int { return strcmp($a->id, $b->id); } ); @@ -1824,7 +1824,7 @@ private function assertContentHasExpectedLocations(array $expectedLocations, Con $locationService = $repository->getLocationService(); $expectedLocationIds = array_map( - static function (Location $location) { + static function (Location $location): int { return (int)$location->id; }, $expectedLocations @@ -3750,7 +3750,7 @@ private function assertAliasExists( self::assertNotEmpty( array_filter( $articleAliasesBeforeDelete, - static function (URLAlias $alias) use ($expectedAliasPath) { + static function (URLAlias $alias) use ($expectedAliasPath): bool { return $alias->path === $expectedAliasPath; } ) diff --git a/tests/integration/Core/Repository/ObjectStateServiceTest.php b/tests/integration/Core/Repository/ObjectStateServiceTest.php index bf3a553cb4..9a792115aa 100644 --- a/tests/integration/Core/Repository/ObjectStateServiceTest.php +++ b/tests/integration/Core/Repository/ObjectStateServiceTest.php @@ -577,7 +577,7 @@ public function testLoadObjectStateGroupsWithOffset() * * @return array */ - protected function getGroupIdentifierMap(array $groups) + protected function getGroupIdentifierMap(array $groups): array { $existingGroupIdentifiers = array_map( static function ($group) { diff --git a/tests/integration/Core/Repository/PermissionResolverTest.php b/tests/integration/Core/Repository/PermissionResolverTest.php index 982e898f8f..d07f89a792 100644 --- a/tests/integration/Core/Repository/PermissionResolverTest.php +++ b/tests/integration/Core/Repository/PermissionResolverTest.php @@ -1198,7 +1198,7 @@ public function testLookupLimitationsWithRoleLimitationsWithoutPolicyLimitations $permissionResolver->setCurrentUserReference($user); /* END: Use Case */ - $expectedPolicy = current(array_filter($role->getPolicies(), static function ($policy) use ($module, $function) { + $expectedPolicy = current(array_filter($role->getPolicies(), static function ($policy) use ($module, $function): bool { return $policy->module === $module && $policy->function === $function; })); diff --git a/tests/integration/Core/Repository/Regression/EZP22408DeleteRelatedObjectTest.php b/tests/integration/Core/Repository/Regression/EZP22408DeleteRelatedObjectTest.php index c272748e9d..c4db367886 100644 --- a/tests/integration/Core/Repository/Regression/EZP22408DeleteRelatedObjectTest.php +++ b/tests/integration/Core/Repository/Regression/EZP22408DeleteRelatedObjectTest.php @@ -110,7 +110,7 @@ private function createTestContentType() $contentTypeService->publishContentTypeDraft($this->testContentType); } - private function getMainLanguageCode() + private function getMainLanguageCode(): string { return $this->getRepository()->getContentLanguageService()->getDefaultLanguageCode(); } diff --git a/tests/integration/Core/Repository/RoleServiceTest.php b/tests/integration/Core/Repository/RoleServiceTest.php index 2f7b6ee588..d37e910cb8 100644 --- a/tests/integration/Core/Repository/RoleServiceTest.php +++ b/tests/integration/Core/Repository/RoleServiceTest.php @@ -1206,7 +1206,7 @@ public function testAddPolicyByRoleDraft() } usort( $actual, - static function ($p1, $p2) { + static function ($p1, $p2): int { return strcasecmp($p1['function'], $p2['function']); } ); @@ -3068,7 +3068,7 @@ public function testPublishRoleDraftAddPolicies() } usort( $actual, - static function ($p1, $p2) { + static function ($p1, $p2): int { return strcasecmp($p1['function'], $p2['function']); } ); diff --git a/tests/integration/Core/Repository/SearchServiceFulltextTest.php b/tests/integration/Core/Repository/SearchServiceFulltextTest.php index cf5f7ee188..ff3219f92b 100644 --- a/tests/integration/Core/Repository/SearchServiceFulltextTest.php +++ b/tests/integration/Core/Repository/SearchServiceFulltextTest.php @@ -305,7 +305,7 @@ private function mapKeysToIds(array $expectedKeys, array $idMap) * * @return array */ - private function mapSearchResultToIds(SearchResult $searchResult) + private function mapSearchResultToIds(SearchResult $searchResult): array { $scoreGroupedIds = []; diff --git a/tests/integration/Core/Repository/SearchServiceLocationTest.php b/tests/integration/Core/Repository/SearchServiceLocationTest.php index 889e53b88a..4974ea32d9 100644 --- a/tests/integration/Core/Repository/SearchServiceLocationTest.php +++ b/tests/integration/Core/Repository/SearchServiceLocationTest.php @@ -456,7 +456,7 @@ public function testFindLocationsWithNonSearchableField() /** * @return array */ - protected function mapResultLocationIds(SearchResult $result) + protected function mapResultLocationIds(SearchResult $result): array { return array_map( static function (SearchHit $searchHit) { @@ -1445,7 +1445,7 @@ protected function assertQueryFixture(LocationQuery $query, $fixture, $closure = * * @return string */ - protected function printResult(SearchResult $result) + protected function printResult(SearchResult $result): string { $printed = ''; foreach ($result->searchHits as $hit) { @@ -1485,7 +1485,7 @@ protected function simplifySearchResult(SearchResult $result) * * @return string */ - protected function getFixtureDir() + protected function getFixtureDir(): string { return __DIR__ . '/_fixtures/' . getenv('fixtureDir') . '/'; } diff --git a/tests/integration/Core/Repository/SearchServiceTest.php b/tests/integration/Core/Repository/SearchServiceTest.php index 08c4968cbd..a54b2e5c3a 100644 --- a/tests/integration/Core/Repository/SearchServiceTest.php +++ b/tests/integration/Core/Repository/SearchServiceTest.php @@ -452,7 +452,7 @@ public function getFilterContentSearches() static function (&$data) { usort( $data->searchHits, - static function ($a, $b) { + static function ($a, $b): int { if ($a->score == $b->score) { if ($a->valueObject['id'] == $b->valueObject['id']) { return 0; @@ -1933,7 +1933,7 @@ static function (&$data) { ]; usort( $data->searchHits, - static function ($a, $b) use ($map) { + static function ($a, $b) use ($map): int { return ($map[$a->valueObject['id']] < $map[$b->valueObject['id']]) ? -1 : 1; } ); @@ -2784,7 +2784,7 @@ protected function assertMultilingualFieldFilter( * * @return array */ - protected function mapResultContentIds(SearchResult $result) + protected function mapResultContentIds(SearchResult $result): array { return array_map( static function (SearchHit $searchHit) { @@ -4835,7 +4835,7 @@ protected function assertQueryFixture( * * @return string */ - protected function printResult(SearchResult $result) + protected function printResult(SearchResult $result): string { $printed = ''; foreach ($result->searchHits as $hit) { @@ -4885,7 +4885,7 @@ protected function simplifySearchResult(SearchResult $result) * * @return string */ - protected function getFixtureDir() + protected function getFixtureDir(): string { return __DIR__ . '/_fixtures/' . getenv('fixtureDir') . '/'; } diff --git a/tests/integration/Core/Repository/URLAliasServiceTest.php b/tests/integration/Core/Repository/URLAliasServiceTest.php index 499b2425d8..63dc1e90a7 100644 --- a/tests/integration/Core/Repository/URLAliasServiceTest.php +++ b/tests/integration/Core/Repository/URLAliasServiceTest.php @@ -1757,7 +1757,7 @@ private function assertUrlAliasPropertiesCorrect( * * @return int Number of new rows */ - private function insertBrokenUrlAliasTableFixtures(Connection $connection) + private function insertBrokenUrlAliasTableFixtures(Connection $connection): int { $rows = [ // link to non-existent location diff --git a/tests/lib/Base/Container/Compiler/Stubs/GatewayBasedStorageHandler.php b/tests/lib/Base/Container/Compiler/Stubs/GatewayBasedStorageHandler.php index ab32f39c34..04f9ca0c5a 100644 --- a/tests/lib/Base/Container/Compiler/Stubs/GatewayBasedStorageHandler.php +++ b/tests/lib/Base/Container/Compiler/Stubs/GatewayBasedStorageHandler.php @@ -32,7 +32,8 @@ public function hasFieldData() { } - public function getIndexData(VersionInfo $versionInfo, Field $field, array $context) + public function getIndexData(VersionInfo $versionInfo, Field $field, array $context): array { + return []; } } diff --git a/tests/lib/FieldType/AuthorTest.php b/tests/lib/FieldType/AuthorTest.php index 0ade378c4d..0ce6fcd8b4 100644 --- a/tests/lib/FieldType/AuthorTest.php +++ b/tests/lib/FieldType/AuthorTest.php @@ -519,7 +519,7 @@ public function testRemoveAuthors() * * @return string */ - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezauthor'; } diff --git a/tests/lib/FieldType/BinaryFileTest.php b/tests/lib/FieldType/BinaryFileTest.php index ccfe1d0dac..f0a94eac5d 100644 --- a/tests/lib/FieldType/BinaryFileTest.php +++ b/tests/lib/FieldType/BinaryFileTest.php @@ -506,7 +506,7 @@ public function provideInputForFromHash() ]; } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezbinaryfile'; } diff --git a/tests/lib/FieldType/CheckboxTest.php b/tests/lib/FieldType/CheckboxTest.php index 35e0056c40..10f6963418 100644 --- a/tests/lib/FieldType/CheckboxTest.php +++ b/tests/lib/FieldType/CheckboxTest.php @@ -263,7 +263,7 @@ public function testFieldValueToString() self::assertSame('0', (string)$valueFalse); } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezboolean'; } diff --git a/tests/lib/FieldType/CountryTest.php b/tests/lib/FieldType/CountryTest.php index b4d8ae5653..fbba207340 100644 --- a/tests/lib/FieldType/CountryTest.php +++ b/tests/lib/FieldType/CountryTest.php @@ -19,7 +19,7 @@ */ class CountryTest extends FieldTypeTest { - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezcountry'; } diff --git a/tests/lib/FieldType/DateAndTimeTest.php b/tests/lib/FieldType/DateAndTimeTest.php index 5a03693385..a5d91bf33f 100644 --- a/tests/lib/FieldType/DateAndTimeTest.php +++ b/tests/lib/FieldType/DateAndTimeTest.php @@ -426,7 +426,7 @@ public function provideInValidFieldSettings() ]; } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezdatetime'; } diff --git a/tests/lib/FieldType/DateTest.php b/tests/lib/FieldType/DateTest.php index 3766383aaa..11f9d347db 100644 --- a/tests/lib/FieldType/DateTest.php +++ b/tests/lib/FieldType/DateTest.php @@ -337,7 +337,7 @@ public function provideInValidFieldSettings() ]; } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezdate'; } diff --git a/tests/lib/FieldType/EmailAddressTest.php b/tests/lib/FieldType/EmailAddressTest.php index 157f5a3ed2..31468e09e1 100644 --- a/tests/lib/FieldType/EmailAddressTest.php +++ b/tests/lib/FieldType/EmailAddressTest.php @@ -38,7 +38,7 @@ protected function createFieldTypeUnderTest() ->with(self::anything(), 'lowercase') ->will( self::returnCallback( - static function ($value, $group) { + static function ($value, $group): string { return strtolower($value); } ) @@ -366,7 +366,7 @@ public function provideInvalidValidatorConfiguration() ]; } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezemail'; } diff --git a/tests/lib/FieldType/FileSizeValidatorTest.php b/tests/lib/FieldType/FileSizeValidatorTest.php index 3a06e12bd0..029e074202 100644 --- a/tests/lib/FieldType/FileSizeValidatorTest.php +++ b/tests/lib/FieldType/FileSizeValidatorTest.php @@ -27,7 +27,7 @@ class FileSizeValidatorTest extends TestCase /** * @return int */ - protected function getMaxFileSize() + protected function getMaxFileSize(): int { return 4096; } diff --git a/tests/lib/FieldType/FloatTest.php b/tests/lib/FieldType/FloatTest.php index d76b7d60c3..7200b33660 100644 --- a/tests/lib/FieldType/FloatTest.php +++ b/tests/lib/FieldType/FloatTest.php @@ -400,7 +400,7 @@ public function provideInvalidValidatorConfiguration() ]; } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezfloat'; } diff --git a/tests/lib/FieldType/ISBNTest.php b/tests/lib/FieldType/ISBNTest.php index e4ab6ee633..38cc00a5ff 100644 --- a/tests/lib/FieldType/ISBNTest.php +++ b/tests/lib/FieldType/ISBNTest.php @@ -226,7 +226,7 @@ public function provideInputForFromHash() ]; } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezisbn'; } diff --git a/tests/lib/FieldType/ImageTest.php b/tests/lib/FieldType/ImageTest.php index f1639aeef7..ea81a7caf3 100644 --- a/tests/lib/FieldType/ImageTest.php +++ b/tests/lib/FieldType/ImageTest.php @@ -38,7 +38,7 @@ class ImageTest extends FieldTypeTest 'pgif', ]; - public function getImageInputPath() + public function getImageInputPath(): string { return __DIR__ . '/../_fixtures/squirrel-developers.jpg'; } @@ -483,7 +483,7 @@ public function provideInputForFromHash() ]; } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezimage'; } diff --git a/tests/lib/FieldType/IntegerTest.php b/tests/lib/FieldType/IntegerTest.php index 1e1bd9dc0f..b9c73b56b5 100644 --- a/tests/lib/FieldType/IntegerTest.php +++ b/tests/lib/FieldType/IntegerTest.php @@ -390,7 +390,7 @@ public function provideInvalidValidatorConfiguration() ]; } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezinteger'; } diff --git a/tests/lib/FieldType/KeywordTest.php b/tests/lib/FieldType/KeywordTest.php index e850072e97..953b08311a 100644 --- a/tests/lib/FieldType/KeywordTest.php +++ b/tests/lib/FieldType/KeywordTest.php @@ -227,7 +227,7 @@ public function provideInputForFromHash() ]; } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezkeyword'; } diff --git a/tests/lib/FieldType/MapLocationTest.php b/tests/lib/FieldType/MapLocationTest.php index 345b4362ec..52ff1a046c 100644 --- a/tests/lib/FieldType/MapLocationTest.php +++ b/tests/lib/FieldType/MapLocationTest.php @@ -307,7 +307,7 @@ public function provideInputForFromHash() ]; } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezgmaplocation'; } diff --git a/tests/lib/FieldType/MediaTest.php b/tests/lib/FieldType/MediaTest.php index 4286db0f15..5933628d7a 100644 --- a/tests/lib/FieldType/MediaTest.php +++ b/tests/lib/FieldType/MediaTest.php @@ -664,7 +664,7 @@ public function provideInValidFieldSettings() ]; } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezmedia'; } diff --git a/tests/lib/FieldType/RelationListTest.php b/tests/lib/FieldType/RelationListTest.php index 86b36448ae..d452daec28 100644 --- a/tests/lib/FieldType/RelationListTest.php +++ b/tests/lib/FieldType/RelationListTest.php @@ -850,7 +850,7 @@ public function testGetRelations() ); } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezobjectrelationlist'; } diff --git a/tests/lib/FieldType/RelationTest.php b/tests/lib/FieldType/RelationTest.php index 9fd4197903..54a149a8a1 100644 --- a/tests/lib/FieldType/RelationTest.php +++ b/tests/lib/FieldType/RelationTest.php @@ -451,7 +451,7 @@ private function generateContentTypeValidationError(string $contentTypeIdentifie ); } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezobjectrelation'; } diff --git a/tests/lib/FieldType/SelectionTest.php b/tests/lib/FieldType/SelectionTest.php index 76bd9f71cc..7b05fc327e 100644 --- a/tests/lib/FieldType/SelectionTest.php +++ b/tests/lib/FieldType/SelectionTest.php @@ -328,7 +328,7 @@ public function provideInValidFieldSettings() ]; } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezselection'; } diff --git a/tests/lib/FieldType/TextBlockTest.php b/tests/lib/FieldType/TextBlockTest.php index 59b5a3179b..8bc10e2c72 100644 --- a/tests/lib/FieldType/TextBlockTest.php +++ b/tests/lib/FieldType/TextBlockTest.php @@ -171,7 +171,7 @@ public function provideInValidFieldSettings(): array ]; } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'eztext'; } diff --git a/tests/lib/FieldType/TextLineTest.php b/tests/lib/FieldType/TextLineTest.php index 2e20e03487..c105184f20 100644 --- a/tests/lib/FieldType/TextLineTest.php +++ b/tests/lib/FieldType/TextLineTest.php @@ -270,7 +270,7 @@ public function provideInvalidValidatorConfiguration(): array ]; } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezstring'; } diff --git a/tests/lib/FieldType/TimeTest.php b/tests/lib/FieldType/TimeTest.php index ca3ec0f93d..c7cf1c510d 100644 --- a/tests/lib/FieldType/TimeTest.php +++ b/tests/lib/FieldType/TimeTest.php @@ -346,7 +346,7 @@ public function provideInValidFieldSettings() ]; } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'eztime'; } diff --git a/tests/lib/FieldType/UrlTest.php b/tests/lib/FieldType/UrlTest.php index 98f6d7de64..40de5967cd 100644 --- a/tests/lib/FieldType/UrlTest.php +++ b/tests/lib/FieldType/UrlTest.php @@ -243,7 +243,7 @@ public function provideInputForFromHash() ]; } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezurl'; } diff --git a/tests/lib/FieldType/UserTest.php b/tests/lib/FieldType/UserTest.php index eb00e99d34..eddebb1ef4 100644 --- a/tests/lib/FieldType/UserTest.php +++ b/tests/lib/FieldType/UserTest.php @@ -835,7 +835,7 @@ public function provideInValidFieldSettings(): array ]; } - protected function provideFieldTypeIdentifier() + protected function provideFieldTypeIdentifier(): string { return 'ezuser'; } diff --git a/tests/lib/IO/IOServiceTest.php b/tests/lib/IO/IOServiceTest.php index 80e8f2049b..9d473927c2 100644 --- a/tests/lib/IO/IOServiceTest.php +++ b/tests/lib/IO/IOServiceTest.php @@ -128,7 +128,7 @@ public function testCreateBinaryFile(BinaryFileCreateStruct $createStruct) ->method('create') ->with( self::callback( - static function ($subject) use ($id) { + static function ($subject) use ($id): bool { if (!$subject instanceof SPIBinaryFileCreateStruct) { return false; } @@ -396,7 +396,7 @@ protected function getIOService() */ private function getSPIBinaryFileCreateStructCallback($spiId): \Closure { - return static function ($subject) use ($spiId) { + return static function ($subject) use ($spiId): bool { if (!$subject instanceof SPIBinaryFileCreateStruct) { return false; } diff --git a/tests/lib/IO/MimeTypeDetector/FileInfoTest.php b/tests/lib/IO/MimeTypeDetector/FileInfoTest.php index 3b89c720d1..8bf1beac7b 100644 --- a/tests/lib/IO/MimeTypeDetector/FileInfoTest.php +++ b/tests/lib/IO/MimeTypeDetector/FileInfoTest.php @@ -20,7 +20,7 @@ protected function setUp(): void $this->mimeTypeDetector = new MimeTypeDetector(); } - protected function getFixture() + protected function getFixture(): string { return __DIR__ . '/../../_fixtures/squirrel-developers.jpg'; } diff --git a/tests/lib/MVC/Symfony/Component/Serializer/CompoundMatcherNormalizerTest.php b/tests/lib/MVC/Symfony/Component/Serializer/CompoundMatcherNormalizerTest.php index 9388725b48..f496e68738 100644 --- a/tests/lib/MVC/Symfony/Component/Serializer/CompoundMatcherNormalizerTest.php +++ b/tests/lib/MVC/Symfony/Component/Serializer/CompoundMatcherNormalizerTest.php @@ -15,20 +15,30 @@ use Ibexa\Tests\Core\MVC\Symfony\Component\Serializer\Stubs\MatcherStub; use Ibexa\Tests\Core\MVC\Symfony\Component\Serializer\Stubs\SerializerStub; use PHPUnit\Framework\TestCase; +use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; +use Symfony\Component\Serializer\Serializer; final class CompoundMatcherNormalizerTest extends TestCase { public function testNormalization(): void { $matcher = new CompoundStub([]); - $matcher->setSubMatchers([ - 'foo' => new MatcherStub('foo'), - 'bar' => new MatcherStub('bar'), - 'baz' => new MatcherStub('baz'), - ]); + $matcher->setSubMatchers( + [ + 'foo' => new MatcherStub('foo'), + 'bar' => new MatcherStub('bar'), + 'baz' => new MatcherStub('baz'), + ] + ); $normalizer = new CompoundMatcherNormalizer(); - $normalizer->setSerializer(new SerializerStub()); + $serializer = new Serializer( + [ + $normalizer, + new SerializerStub(), + new ObjectNormalizer(), + ] + ); self::assertEquals( [ @@ -40,7 +50,7 @@ public function testNormalization(): void 'config' => [], 'matchersMap' => [], ], - $normalizer->normalize($matcher) + $serializer->normalize($matcher) ); } @@ -52,6 +62,9 @@ public function testSupportsNormalization(): void self::assertFalse($normalizer->supportsNormalization($this->createMock(Matcher::class))); } + /** + * @throws \JsonException + */ public function testSupportsDenormalization(): void { $normalizer = new CompoundMatcherNormalizer(); @@ -63,7 +76,8 @@ public function testSupportsDenormalization(): void ], 'config' => [], 'matchersMap' => [], - ] + ], + JSON_THROW_ON_ERROR ); self::assertTrue($normalizer->supportsDenormalization($data, Compound::class, 'json')); diff --git a/tests/lib/MVC/Symfony/Component/Serializer/HostElementNormalizerTest.php b/tests/lib/MVC/Symfony/Component/Serializer/HostElementNormalizerTest.php index 6821ad5e24..8f2ace75c3 100644 --- a/tests/lib/MVC/Symfony/Component/Serializer/HostElementNormalizerTest.php +++ b/tests/lib/MVC/Symfony/Component/Serializer/HostElementNormalizerTest.php @@ -12,15 +12,24 @@ use Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest; use Ibexa\Core\MVC\Symfony\SiteAccess\Matcher; use Ibexa\Core\MVC\Symfony\SiteAccess\Matcher\HostElement; -use Ibexa\Tests\Core\MVC\Symfony\Component\Serializer\Stubs\SerializerStub; use PHPUnit\Framework\TestCase; +use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; +use Symfony\Component\Serializer\Serializer; +/** + * @covers \Ibexa\Core\MVC\Symfony\Component\Serializer\HostElementNormalizer + */ final class HostElementNormalizerTest extends TestCase { public function testNormalization(): void { $normalizer = new HostElementNormalizer(); - $normalizer->setSerializer(new SerializerStub()); + $serializer = new Serializer( + [ + $normalizer, + new ObjectNormalizer(), + ] + ); $matcher = new HostElement(2); // Set request and invoke match to initialize HostElement::$hostElements @@ -35,7 +44,7 @@ public function testNormalization(): void 'dev', ], ], - $normalizer->normalize($matcher) + $serializer->normalize($matcher) ); } diff --git a/tests/lib/MVC/Symfony/Component/Serializer/HostTextNormalizerTest.php b/tests/lib/MVC/Symfony/Component/Serializer/HostTextNormalizerTest.php index 6f34cf217f..599f0876f6 100644 --- a/tests/lib/MVC/Symfony/Component/Serializer/HostTextNormalizerTest.php +++ b/tests/lib/MVC/Symfony/Component/Serializer/HostTextNormalizerTest.php @@ -11,15 +11,21 @@ use Ibexa\Core\MVC\Symfony\Component\Serializer\HostTextNormalizer; use Ibexa\Core\MVC\Symfony\SiteAccess\Matcher; use Ibexa\Core\MVC\Symfony\SiteAccess\Matcher\HostText; -use Ibexa\Tests\Core\MVC\Symfony\Component\Serializer\Stubs\SerializerStub; use Ibexa\Tests\Core\Search\TestCase; +use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; +use Symfony\Component\Serializer\Serializer; final class HostTextNormalizerTest extends TestCase { public function testNormalize(): void { $normalizer = new HostTextNormalizer(); - $normalizer->setSerializer(new SerializerStub()); + $serializer = new Serializer( + [ + $normalizer, + new ObjectNormalizer(), + ] + ); $matcher = new HostText([ 'prefix' => 'foo', @@ -33,7 +39,7 @@ public function testNormalize(): void 'suffix' => 'bar', ], ], - $normalizer->normalize($matcher) + $serializer->normalize($matcher) ); } diff --git a/tests/lib/MVC/Symfony/Component/Serializer/RegexHostNormalizerTest.php b/tests/lib/MVC/Symfony/Component/Serializer/RegexHostNormalizerTest.php index 978c74d60b..720a300081 100644 --- a/tests/lib/MVC/Symfony/Component/Serializer/RegexHostNormalizerTest.php +++ b/tests/lib/MVC/Symfony/Component/Serializer/RegexHostNormalizerTest.php @@ -11,15 +11,21 @@ use Ibexa\Core\MVC\Symfony\Component\Serializer\RegexHostNormalizer; use Ibexa\Core\MVC\Symfony\SiteAccess\Matcher; use Ibexa\Core\MVC\Symfony\SiteAccess\Matcher\Regex\Host; -use Ibexa\Tests\Core\MVC\Symfony\Component\Serializer\Stubs\SerializerStub; use Ibexa\Tests\Core\Search\TestCase; +use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; +use Symfony\Component\Serializer\Serializer; final class RegexHostNormalizerTest extends TestCase { public function testNormalize(): void { $normalizer = new RegexHostNormalizer(); - $normalizer->setSerializer(new SerializerStub()); + $serializer = new Serializer( + [ + $normalizer, + new ObjectNormalizer(), + ] + ); $matcher = new Host([ 'regex' => '/^Foo(.*)/(.*)/', @@ -33,7 +39,7 @@ public function testNormalize(): void 'itemNumber' => 2, ], ], - $normalizer->normalize($matcher) + $serializer->normalize($matcher) ); } diff --git a/tests/lib/MVC/Symfony/Component/Serializer/RegexURINormalizerTest.php b/tests/lib/MVC/Symfony/Component/Serializer/RegexURINormalizerTest.php index acdef30d8f..2fa16c2e36 100644 --- a/tests/lib/MVC/Symfony/Component/Serializer/RegexURINormalizerTest.php +++ b/tests/lib/MVC/Symfony/Component/Serializer/RegexURINormalizerTest.php @@ -11,15 +11,21 @@ use Ibexa\Core\MVC\Symfony\Component\Serializer\RegexURINormalizer; use Ibexa\Core\MVC\Symfony\SiteAccess\Matcher; use Ibexa\Core\MVC\Symfony\SiteAccess\Matcher\Regex\URI; -use Ibexa\Tests\Core\MVC\Symfony\Component\Serializer\Stubs\SerializerStub; use Ibexa\Tests\Core\Search\TestCase; +use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; +use Symfony\Component\Serializer\Serializer; final class RegexURINormalizerTest extends TestCase { public function testNormalize(): void { $normalizer = new RegexURINormalizer(); - $normalizer->setSerializer(new SerializerStub()); + $serializer = new Serializer( + [ + $normalizer, + new ObjectNormalizer(), + ] + ); $matcher = new URI([ 'regex' => '/^Foo(.*)/(.*)/', @@ -33,7 +39,7 @@ public function testNormalize(): void 'itemNumber' => 2, ], ], - $normalizer->normalize($matcher) + $serializer->normalize($matcher) ); } diff --git a/tests/lib/MVC/Symfony/Component/Serializer/Stubs/SerializerStub.php b/tests/lib/MVC/Symfony/Component/Serializer/Stubs/SerializerStub.php index 45c5bd79c5..0da03526c4 100644 --- a/tests/lib/MVC/Symfony/Component/Serializer/Stubs/SerializerStub.php +++ b/tests/lib/MVC/Symfony/Component/Serializer/Stubs/SerializerStub.php @@ -23,7 +23,7 @@ public function deserialize($data, $type, $format, array $context = []) throw new NotImplementedException(__METHOD__); } - public function normalize($object, string $format = null, array $context = []) + public function normalize($object, string $format = null, array $context = []): array|bool|string|int|float|null|\ArrayObject { if (is_array($object)) { $result = []; @@ -43,8 +43,8 @@ public function normalize($object, string $format = null, array $context = []) return $object; } - public function supportsNormalization($data, string $format = null) + public function supportsNormalization($data, string $format = null): bool { - return true; + return $data instanceof MatcherStub; } } diff --git a/tests/lib/MVC/Symfony/Component/Serializer/URIElementNormalizerTest.php b/tests/lib/MVC/Symfony/Component/Serializer/URIElementNormalizerTest.php index ee02ddd759..6607fa1901 100644 --- a/tests/lib/MVC/Symfony/Component/Serializer/URIElementNormalizerTest.php +++ b/tests/lib/MVC/Symfony/Component/Serializer/URIElementNormalizerTest.php @@ -12,15 +12,21 @@ use Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest; use Ibexa\Core\MVC\Symfony\SiteAccess\Matcher; use Ibexa\Core\MVC\Symfony\SiteAccess\Matcher\URIElement; -use Ibexa\Tests\Core\MVC\Symfony\Component\Serializer\Stubs\SerializerStub; use PHPUnit\Framework\TestCase; +use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; +use Symfony\Component\Serializer\Serializer; final class URIElementNormalizerTest extends TestCase { public function testNormalization(): void { $normalizer = new URIElementNormalizer(); - $normalizer->setSerializer(new SerializerStub()); + $serializer = new Serializer( + [ + $normalizer, + new ObjectNormalizer(), + ] + ); $matcher = new URIElement(2); // Set request and invoke match to initialize HostElement::$hostElements @@ -32,7 +38,7 @@ public function testNormalization(): void 'elementNumber' => 2, 'uriElements' => ['foo', 'bar'], ], - $normalizer->normalize($matcher) + $serializer->normalize($matcher) ); } diff --git a/tests/lib/MVC/Symfony/Component/Serializer/URITextNormalizerTest.php b/tests/lib/MVC/Symfony/Component/Serializer/URITextNormalizerTest.php index e9940c4c23..e3ebe2fea9 100644 --- a/tests/lib/MVC/Symfony/Component/Serializer/URITextNormalizerTest.php +++ b/tests/lib/MVC/Symfony/Component/Serializer/URITextNormalizerTest.php @@ -11,15 +11,21 @@ use Ibexa\Core\MVC\Symfony\Component\Serializer\URITextNormalizer; use Ibexa\Core\MVC\Symfony\SiteAccess\Matcher; use Ibexa\Core\MVC\Symfony\SiteAccess\Matcher\URIText; -use Ibexa\Tests\Core\MVC\Symfony\Component\Serializer\Stubs\SerializerStub; use Ibexa\Tests\Core\Search\TestCase; +use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; +use Symfony\Component\Serializer\Serializer; final class URITextNormalizerTest extends TestCase { public function testNormalize(): void { $normalizer = new URITextNormalizer(); - $normalizer->setSerializer(new SerializerStub()); + $serializer = new Serializer( + [ + $normalizer, + new ObjectNormalizer(), + ] + ); $matcher = new URIText([ 'prefix' => 'foo', @@ -33,7 +39,7 @@ public function testNormalize(): void 'suffix' => 'bar', ], ], - $normalizer->normalize($matcher) + $serializer->normalize($matcher) ); } diff --git a/tests/lib/MVC/Symfony/EventListener/SiteAccessMatchListenerTest.php b/tests/lib/MVC/Symfony/EventListener/SiteAccessMatchListenerTest.php index f562dd4641..dbe053643c 100644 --- a/tests/lib/MVC/Symfony/EventListener/SiteAccessMatchListenerTest.php +++ b/tests/lib/MVC/Symfony/EventListener/SiteAccessMatchListenerTest.php @@ -82,7 +82,7 @@ public function testOnKernelRequestSerializedSA() $event = new RequestEvent( $this->createMock(HttpKernelInterface::class), $request, - HttpKernelInterface::MASTER_REQUEST + HttpKernelInterface::MAIN_REQUEST ); $this->saRouter @@ -138,7 +138,7 @@ public function testOnKernelRequestSerializedSAWithCompoundMatcher() $event = new RequestEvent( $this->createMock(HttpKernelInterface::class), $request, - HttpKernelInterface::MASTER_REQUEST + HttpKernelInterface::MAIN_REQUEST ); $this->saRouter @@ -164,7 +164,7 @@ public function testOnKernelRequestSiteAccessPresent() $event = new RequestEvent( $this->createMock(HttpKernelInterface::class), $request, - HttpKernelInterface::MASTER_REQUEST + HttpKernelInterface::MAIN_REQUEST ); $this->saRouter @@ -192,7 +192,7 @@ public function testOnKernelRequest() $event = new RequestEvent( $this->createMock(HttpKernelInterface::class), $request, - HttpKernelInterface::MASTER_REQUEST + HttpKernelInterface::MAIN_REQUEST ); $simplifiedRequest = new SimplifiedRequest( @@ -236,7 +236,7 @@ public function testOnKernelRequestUserHashWithOriginalRequest() $event = new RequestEvent( $this->createMock(HttpKernelInterface::class), $request, - HttpKernelInterface::MASTER_REQUEST + HttpKernelInterface::MAIN_REQUEST ); $simplifiedRequest = new SimplifiedRequest( diff --git a/tests/lib/MVC/Symfony/Security/InteractiveLoginTokenTest.php b/tests/lib/MVC/Symfony/Security/InteractiveLoginTokenTest.php index 9b026077b9..e029d0f3c1 100644 --- a/tests/lib/MVC/Symfony/Security/InteractiveLoginTokenTest.php +++ b/tests/lib/MVC/Symfony/Security/InteractiveLoginTokenTest.php @@ -34,7 +34,7 @@ public function testConstruct() self::assertTrue($token->isAuthenticated()); self::assertSame($originalTokenType, $token->getOriginalTokenType()); self::assertSame($credentials, $token->getCredentials()); - self::assertSame($providerKey, $token->getProviderKey()); + self::assertSame($providerKey, $token->getFirewallName()); self::assertEquals($expectedRoles, $token->getRoleNames()); } diff --git a/tests/lib/MVC/Symfony/Templating/RenderContentStrategyTest.php b/tests/lib/MVC/Symfony/Templating/RenderContentStrategyTest.php index b4f5e74957..03a46c3ce3 100644 --- a/tests/lib/MVC/Symfony/Templating/RenderContentStrategyTest.php +++ b/tests/lib/MVC/Symfony/Templating/RenderContentStrategyTest.php @@ -106,7 +106,7 @@ public function testExpectedMethodRenderArgumentsFormat(): void ->method('getName') ->willReturn('method_b'); - $controllerReferenceCallback = self::callback(function (ControllerReference $controllerReference) { + $controllerReferenceCallback = self::callback(function (ControllerReference $controllerReference): bool { $this->assertInstanceOf(ControllerReference::class, $controllerReference); $this->assertEquals('ibexa_content::viewAction', $controllerReference->controller); $this->assertSame([ diff --git a/tests/lib/MVC/Symfony/Templating/RenderLocationStrategyTest.php b/tests/lib/MVC/Symfony/Templating/RenderLocationStrategyTest.php index 39f64bbdd0..0b2c55b949 100644 --- a/tests/lib/MVC/Symfony/Templating/RenderLocationStrategyTest.php +++ b/tests/lib/MVC/Symfony/Templating/RenderLocationStrategyTest.php @@ -107,7 +107,7 @@ public function testExpectedMethodRenderRequestFormat(): void ->method('getName') ->willReturn('method_b'); - $controllerReferenceCallback = self::callback(function (ControllerReference $controllerReference) { + $controllerReferenceCallback = self::callback(function (ControllerReference $controllerReference): bool { $this->assertInstanceOf(ControllerReference::class, $controllerReference); $this->assertEquals('ibexa_content::viewAction', $controllerReference->controller); $this->assertSame([ diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtensionIntegrationTest.php b/tests/lib/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtensionIntegrationTest.php index 238318a116..9314bc9844 100644 --- a/tests/lib/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtensionIntegrationTest.php +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtensionIntegrationTest.php @@ -132,7 +132,7 @@ protected function getContent($contentTypeIdentifier, array $fieldsData, array $ return $content; } - private function getTemplatePath($tpl) + private function getTemplatePath($tpl): string { return 'templates/' . $tpl; } diff --git a/tests/lib/MVC/Symfony/View/AbstractViewTest.php b/tests/lib/MVC/Symfony/View/AbstractViewTest.php index 43ceba3a19..324ee6133f 100644 --- a/tests/lib/MVC/Symfony/View/AbstractViewTest.php +++ b/tests/lib/MVC/Symfony/View/AbstractViewTest.php @@ -102,7 +102,7 @@ public function goodTemplateIdentifierProvider(): array return [ ['foo:bar:baz.html.twig'], [ - static function () { + static function (): string { return 'foo'; }, ], diff --git a/tests/lib/MVC/Symfony/View/ContentViewTest.php b/tests/lib/MVC/Symfony/View/ContentViewTest.php index 34cfe01d98..0708c32dce 100644 --- a/tests/lib/MVC/Symfony/View/ContentViewTest.php +++ b/tests/lib/MVC/Symfony/View/ContentViewTest.php @@ -43,13 +43,13 @@ public function constructProvider() ['another::identifier', []], ['oops:i_did_it:again', ['singer' => 'Britney Spears']], [ - static function () { + static function (): bool { return true; }, [], ], [ - static function () { + static function (): bool { return true; }, ['truc' => 'muche'], diff --git a/tests/lib/MVC/Symfony/View/ViewManagerTest.php b/tests/lib/MVC/Symfony/View/ViewManagerTest.php index 7eec2b1e53..717b0c4caf 100644 --- a/tests/lib/MVC/Symfony/View/ViewManagerTest.php +++ b/tests/lib/MVC/Symfony/View/ViewManagerTest.php @@ -146,7 +146,7 @@ public function testRenderContentWithClosure() ); // Configuring view provider behaviour - $closure = static function ($params) { + $closure = static function ($params): string { return serialize(array_keys($params)); }; $params = ['foo' => 'bar']; @@ -279,7 +279,7 @@ public function testRenderLocationWithClosure() $location = new Location(['contentInfo' => new ContentInfo()]); // Configuring view provider behaviour - $closure = static function ($params) { + $closure = static function ($params): string { return serialize(array_keys($params)); }; $params = ['foo' => 'bar']; diff --git a/tests/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabaseTest.php b/tests/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabaseTest.php index e96a820e97..44a6221750 100644 --- a/tests/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabaseTest.php +++ b/tests/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabaseTest.php @@ -98,11 +98,11 @@ public function dataProviderForLoadUserBookmarks(): array $fixtures = (require __DIR__ . '/../_fixtures/bookmarks.php')[DoctrineDatabase::TABLE_BOOKMARKS]; $expectedRows = static function ($userId) use ($fixtures) { - $rows = array_filter($fixtures, static function (array $row) use ($userId) { + $rows = array_filter($fixtures, static function (array $row) use ($userId): bool { return $row['user_id'] == $userId; }); - usort($rows, static function ($a, $b) { + usort($rows, static function ($a, $b): int { return $b['id'] <=> $a['id']; }); diff --git a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeTest.php b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeTest.php index f34addff09..26e72c3ba8 100644 --- a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeTest.php +++ b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeTest.php @@ -327,7 +327,7 @@ public function testToFieldDefinitionWithAdjustmentNoSeconds() * * @return string */ - private function getXMLStringFromDateInterval(DateInterval $dateInterval) + private function getXMLStringFromDateInterval(DateInterval $dateInterval): string { $xmlString = << diff --git a/tests/lib/Persistence/Legacy/TestCase.php b/tests/lib/Persistence/Legacy/TestCase.php index f93541c59d..69ba684347 100644 --- a/tests/lib/Persistence/Legacy/TestCase.php +++ b/tests/lib/Persistence/Legacy/TestCase.php @@ -165,7 +165,7 @@ protected static function getResultTextRepresentation(array $result) return implode( "\n", array_map( - static function ($row) { + static function ($row): string { return implode(', ', $row); }, $result @@ -297,7 +297,7 @@ protected function getPublicPropertyNames($object) $refl = new ReflectionObject($object); return array_map( - static function ($prop) { + static function ($prop): string { return $prop->getName(); }, $refl->getProperties(ReflectionProperty::IS_PUBLIC) diff --git a/tests/lib/Persistence/Legacy/User/UserHandlerTest.php b/tests/lib/Persistence/Legacy/User/UserHandlerTest.php index 3af2a2eeeb..ae0cfc0d8f 100644 --- a/tests/lib/Persistence/Legacy/User/UserHandlerTest.php +++ b/tests/lib/Persistence/Legacy/User/UserHandlerTest.php @@ -923,12 +923,12 @@ public function testLoadPoliciesForUser() self::assertTrue( array_reduce( array_map( - static function ($policy) { + static function ($policy): bool { return $policy instanceof Persistence\User\Policy; }, $policies ), - static function ($a, $b) { + static function ($a, $b): bool { return $a && $b; }, true diff --git a/tests/lib/Persistence/TransformationProcessor/TransformationProcessorDefinitionBasedParserTest.php b/tests/lib/Persistence/TransformationProcessor/TransformationProcessorDefinitionBasedParserTest.php index c8d8dc9d83..4ad3164640 100644 --- a/tests/lib/Persistence/TransformationProcessor/TransformationProcessorDefinitionBasedParserTest.php +++ b/tests/lib/Persistence/TransformationProcessor/TransformationProcessorDefinitionBasedParserTest.php @@ -15,14 +15,21 @@ */ class TransformationProcessorDefinitionBasedParserTest extends TestCase { - public static function getTestFiles() + /** + * @phpstan-return array + */ + public static function getTestFiles(): array { - return array_map( - static function ($file) { - return [realpath($file)]; - }, - glob(__DIR__ . '/_fixtures/transformations/*.tr') - ); + $glob = glob(__DIR__ . '/_fixtures/transformations/*.tr'); + + return false !== $glob + ? array_map( + static function (string $file) { + return [realpath($file)]; + }, + $glob + ) + : []; } /** diff --git a/tests/lib/Repository/Service/Mock/ContentTest.php b/tests/lib/Repository/Service/Mock/ContentTest.php index 96c2defefd..4e2333084b 100644 --- a/tests/lib/Repository/Service/Mock/ContentTest.php +++ b/tests/lib/Repository/Service/Mock/ContentTest.php @@ -1360,7 +1360,7 @@ protected function assertForTestCreateContentNonRedundantFieldSet( self::equalTo($locationCreateStructs) )->will( self::returnCallback( - static function () use ($that, $contentCreateStruct) { + static function () use ($that, $contentCreateStruct): bool { $that->assertEquals($contentCreateStruct, func_get_arg(2)); return true; @@ -1376,7 +1376,7 @@ static function () use ($that, $contentCreateStruct) { ->method('toPersistenceValue') ->will( self::returnCallback( - static function (ValueStub $value) { + static function (ValueStub $value): string { return (string)$value; } ) @@ -1983,7 +1983,7 @@ static function ($languageCode) { self::equalTo([]) )->will( self::returnCallback( - static function () use ($that, $contentCreateStruct) { + static function () use ($that, $contentCreateStruct): bool { $that->assertEquals($contentCreateStruct, func_get_arg(2)); return true; @@ -1996,7 +1996,7 @@ static function () use ($that, $contentCreateStruct) { ->with(self::isInstanceOf(APIContentCreateStruct::class)) ->will( self::returnCallback( - static function ($object) use ($that, $contentCreateStruct) { + static function ($object) use ($that, $contentCreateStruct): string { $that->assertEquals($contentCreateStruct, $object); return 'hash'; @@ -2268,7 +2268,7 @@ protected function assertForTestCreateContentRequiredField( self::equalTo([]) )->will( self::returnCallback( - static function () use ($that, $contentCreateStruct) { + static function () use ($that, $contentCreateStruct): bool { $that->assertEquals($contentCreateStruct, func_get_arg(2)); return true; @@ -2421,7 +2421,7 @@ protected function assertForTestCreateContentThrowsContentFieldValidationExcepti self::equalTo([]) )->will( self::returnCallback( - static function () use ($that, $contentCreateStruct) { + static function () use ($that, $contentCreateStruct): bool { $that->assertEquals($contentCreateStruct, func_get_arg(2)); return true; @@ -2471,7 +2471,7 @@ static function ($value) { ->method('isEmptyValue') ->will( self::returnCallback( - static function (ValueStub $value) use ($emptyValue) { + static function (ValueStub $value) use ($emptyValue): bool { return (string)$emptyValue === (string)$value; } ) @@ -2570,7 +2570,7 @@ private function isEmptyValueFieldTypeMock(\PHPUnit\Framework\MockObject\MockObj ->method('isEmptyValue') ->will( self::returnCallback( - static function (ValueStub $value) use ($emptyValue) { + static function (ValueStub $value) use ($emptyValue): bool { return (string)$emptyValue === (string)$value; } ) @@ -2587,7 +2587,7 @@ private function getUniqueHashDomainMapperMock( ->with(self::isInstanceOf(APIContentCreateStruct::class)) ->will( self::returnCallback( - static function ($object) use ($that, $contentCreateStruct) { + static function ($object) use ($that, $contentCreateStruct): string { $that->assertEquals($contentCreateStruct, $object); return 'hash'; @@ -2842,7 +2842,7 @@ static function ($valueString) { self::equalTo($locationCreateStructs) )->will( self::returnCallback( - static function () use ($that, $contentCreateStruct) { + static function () use ($that, $contentCreateStruct): bool { $that->assertEquals($contentCreateStruct, func_get_arg(2)); return true; @@ -2855,7 +2855,7 @@ static function () use ($that, $contentCreateStruct) { ->with(self::isInstanceOf(APIContentCreateStruct::class)) ->will( self::returnCallback( - static function ($object) use ($that, $contentCreateStruct) { + static function ($object) use ($that, $contentCreateStruct): string { $that->assertEquals($contentCreateStruct, $object); return 'hash'; @@ -3435,7 +3435,7 @@ static function ($value) { ->method('toPersistenceValue') ->will( self::returnCallback( - static function (ValueStub $value) { + static function (ValueStub $value): string { return (string)$value; } ) @@ -3445,7 +3445,7 @@ static function (ValueStub $value) { ->method('isEmptyValue') ->will( self::returnCallback( - static function (SPIValue $value) use ($emptyValue) { + static function (SPIValue $value) use ($emptyValue): bool { return (string)$emptyValue === (string)$value; } ) @@ -5393,7 +5393,7 @@ static function ($value) { ->method('isEmptyValue') ->will( self::returnCallback( - static function (ValueStub $value) use ($emptyValue) { + static function (ValueStub $value) use ($emptyValue): bool { return (string)$emptyValue === (string)$value; } ) diff --git a/tests/lib/Repository/Service/Mock/RoleTest.php b/tests/lib/Repository/Service/Mock/RoleTest.php index 325bdceec5..d44e615251 100644 --- a/tests/lib/Repository/Service/Mock/RoleTest.php +++ b/tests/lib/Repository/Service/Mock/RoleTest.php @@ -204,7 +204,7 @@ public function testUpdatePolicyThrowsLimitationValidationException() ->method('__get') ->will( self::returnCallback( - static function ($propertyName) { + static function ($propertyName): ?string { switch ($propertyName) { case 'module': return 'mockModule'; diff --git a/tests/lib/Repository/SiteAccessAware/ContentServiceTest.php b/tests/lib/Repository/SiteAccessAware/ContentServiceTest.php index 62446a7ab8..0990be3e1f 100644 --- a/tests/lib/Repository/SiteAccessAware/ContentServiceTest.php +++ b/tests/lib/Repository/SiteAccessAware/ContentServiceTest.php @@ -31,12 +31,12 @@ */ class ContentServiceTest extends AbstractServiceTest { - public function getAPIServiceClassName() + public function getAPIServiceClassName(): string { return APIService::class; } - public function getSiteAccessAwareServiceClassName() + public function getSiteAccessAwareServiceClassName(): string { return ContentService::class; } diff --git a/tests/lib/Repository/SiteAccessAware/ContentTypeServiceTest.php b/tests/lib/Repository/SiteAccessAware/ContentTypeServiceTest.php index a9a7042d79..7327d4eee9 100644 --- a/tests/lib/Repository/SiteAccessAware/ContentTypeServiceTest.php +++ b/tests/lib/Repository/SiteAccessAware/ContentTypeServiceTest.php @@ -23,12 +23,12 @@ class ContentTypeServiceTest extends AbstractServiceTest { - public function getAPIServiceClassName() + public function getAPIServiceClassName(): string { return APIService::class; } - public function getSiteAccessAwareServiceClassName() + public function getSiteAccessAwareServiceClassName(): string { return ContentTypeService::class; } diff --git a/tests/lib/Repository/SiteAccessAware/LanguageServiceTest.php b/tests/lib/Repository/SiteAccessAware/LanguageServiceTest.php index f8848c1c2f..666ee1d01e 100644 --- a/tests/lib/Repository/SiteAccessAware/LanguageServiceTest.php +++ b/tests/lib/Repository/SiteAccessAware/LanguageServiceTest.php @@ -14,12 +14,12 @@ class LanguageServiceTest extends AbstractServiceTest { - public function getAPIServiceClassName() + public function getAPIServiceClassName(): string { return APIService::class; } - public function getSiteAccessAwareServiceClassName() + public function getSiteAccessAwareServiceClassName(): string { return LanguageService::class; } diff --git a/tests/lib/Repository/SiteAccessAware/LocationServiceTest.php b/tests/lib/Repository/SiteAccessAware/LocationServiceTest.php index 54c9dd1099..3ed7b2a8d8 100644 --- a/tests/lib/Repository/SiteAccessAware/LocationServiceTest.php +++ b/tests/lib/Repository/SiteAccessAware/LocationServiceTest.php @@ -20,12 +20,12 @@ class LocationServiceTest extends AbstractServiceTest { - public function getAPIServiceClassName() + public function getAPIServiceClassName(): string { return APIService::class; } - public function getSiteAccessAwareServiceClassName() + public function getSiteAccessAwareServiceClassName(): string { return LocationService::class; } diff --git a/tests/lib/Repository/SiteAccessAware/ObjectStateServiceTest.php b/tests/lib/Repository/SiteAccessAware/ObjectStateServiceTest.php index 20a4cae470..178367644b 100644 --- a/tests/lib/Repository/SiteAccessAware/ObjectStateServiceTest.php +++ b/tests/lib/Repository/SiteAccessAware/ObjectStateServiceTest.php @@ -19,12 +19,12 @@ class ObjectStateServiceTest extends AbstractServiceTest { - public function getAPIServiceClassName() + public function getAPIServiceClassName(): string { return APIService::class; } - public function getSiteAccessAwareServiceClassName() + public function getSiteAccessAwareServiceClassName(): string { return ObjectStateService::class; } diff --git a/tests/lib/Repository/SiteAccessAware/SearchServiceTest.php b/tests/lib/Repository/SiteAccessAware/SearchServiceTest.php index 34ea7e41bf..9d7e85a428 100644 --- a/tests/lib/Repository/SiteAccessAware/SearchServiceTest.php +++ b/tests/lib/Repository/SiteAccessAware/SearchServiceTest.php @@ -16,12 +16,12 @@ class SearchServiceTest extends AbstractServiceTest { - public function getAPIServiceClassName() + public function getAPIServiceClassName(): string { return APIService::class; } - public function getSiteAccessAwareServiceClassName() + public function getSiteAccessAwareServiceClassName(): string { return SearchService::class; } diff --git a/tests/lib/Repository/SiteAccessAware/TrashServiceTest.php b/tests/lib/Repository/SiteAccessAware/TrashServiceTest.php index 5f9980a216..30279d2456 100644 --- a/tests/lib/Repository/SiteAccessAware/TrashServiceTest.php +++ b/tests/lib/Repository/SiteAccessAware/TrashServiceTest.php @@ -18,12 +18,12 @@ class TrashServiceTest extends AbstractServiceTest { - public function getAPIServiceClassName() + public function getAPIServiceClassName(): string { return APIService::class; } - public function getSiteAccessAwareServiceClassName() + public function getSiteAccessAwareServiceClassName(): string { return TrashService::class; } diff --git a/tests/lib/Repository/SiteAccessAware/UrlAliasServiceTest.php b/tests/lib/Repository/SiteAccessAware/UrlAliasServiceTest.php index 160828947f..fc600a2f80 100644 --- a/tests/lib/Repository/SiteAccessAware/UrlAliasServiceTest.php +++ b/tests/lib/Repository/SiteAccessAware/UrlAliasServiceTest.php @@ -14,12 +14,12 @@ class UrlAliasServiceTest extends AbstractServiceTest { - public function getAPIServiceClassName() + public function getAPIServiceClassName(): string { return APIService::class; } - public function getSiteAccessAwareServiceClassName() + public function getSiteAccessAwareServiceClassName(): string { return URLAliasService::class; } diff --git a/tests/lib/Repository/SiteAccessAware/UserServiceTest.php b/tests/lib/Repository/SiteAccessAware/UserServiceTest.php index a27572d3f7..c37cc72a85 100644 --- a/tests/lib/Repository/SiteAccessAware/UserServiceTest.php +++ b/tests/lib/Repository/SiteAccessAware/UserServiceTest.php @@ -24,12 +24,12 @@ class UserServiceTest extends AbstractServiceTest { - public function getAPIServiceClassName() + public function getAPIServiceClassName(): string { return APIService::class; } - public function getSiteAccessAwareServiceClassName() + public function getSiteAccessAwareServiceClassName(): string { return UserService::class; } diff --git a/tests/lib/Search/Legacy/Content/HandlerContentSortTest.php b/tests/lib/Search/Legacy/Content/HandlerContentSortTest.php index be4d4cce44..75c42f537f 100644 --- a/tests/lib/Search/Legacy/Content/HandlerContentSortTest.php +++ b/tests/lib/Search/Legacy/Content/HandlerContentSortTest.php @@ -113,7 +113,7 @@ protected function getContentMapperMock() ->with(self::isType('array')) ->will( self::returnCallback( - static function ($rows) { + static function ($rows): array { $contentInfoObjs = []; foreach ($rows as $row) { $contentId = (int)$row['id']; diff --git a/tests/lib/Search/Legacy/Content/HandlerContentTest.php b/tests/lib/Search/Legacy/Content/HandlerContentTest.php index ac184d25ae..26befbcdcf 100644 --- a/tests/lib/Search/Legacy/Content/HandlerContentTest.php +++ b/tests/lib/Search/Legacy/Content/HandlerContentTest.php @@ -212,7 +212,7 @@ protected function getContentMapperMock() ->with(self::isType('array')) ->will( self::returnCallback( - static function ($rows) { + static function ($rows): array { $contentInfoObjs = []; foreach ($rows as $row) { $contentId = (int)$row['id']; diff --git a/tests/lib/Search/Legacy/Content/HandlerLocationSortTest.php b/tests/lib/Search/Legacy/Content/HandlerLocationSortTest.php index d5264353a4..9c9865ea75 100644 --- a/tests/lib/Search/Legacy/Content/HandlerLocationSortTest.php +++ b/tests/lib/Search/Legacy/Content/HandlerLocationSortTest.php @@ -121,7 +121,7 @@ protected function getLocationMapperMock() ->with(self::isType('array')) ->will( self::returnCallback( - static function ($rows) { + static function ($rows): array { $locations = []; foreach ($rows as $row) { $locationId = (int)$row['node_id']; diff --git a/tests/lib/Search/Legacy/Content/HandlerLocationTest.php b/tests/lib/Search/Legacy/Content/HandlerLocationTest.php index 8761d99507..3d6ef6da82 100644 --- a/tests/lib/Search/Legacy/Content/HandlerLocationTest.php +++ b/tests/lib/Search/Legacy/Content/HandlerLocationTest.php @@ -182,7 +182,7 @@ protected function getLocationMapperMock() ->with(self::isType('array')) ->will( self::returnCallback( - static function ($rows) { + static function ($rows): array { $locations = []; foreach ($rows as $row) { $locationId = (int)$row['node_id'];