diff --git a/phpstan-baseline-8.0.neon b/phpstan-baseline-8.0.neon deleted file mode 100644 index b404e32542..0000000000 --- a/phpstan-baseline-8.0.neon +++ /dev/null @@ -1,32 +0,0 @@ -parameters: - ignoreErrors: - - - - message: '#^Parameter \#1 \$array of function array_filter expects array, list\\|false given\.$#' - identifier: argument.type - count: 1 - path: src/bundle/RepositoryInstaller/Installer/DbBasedInstaller.php - - - - message: '#^Parameter \#1 \$array of function array_keys expects array, array\\|ArrayObject\<\(int\|string\), mixed\>\|bool\|float\|int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: src/lib/MVC/Symfony/Component/Serializer/AbstractPropertyWhitelistNormalizer.php - - - - message: '#^Parameter \#1 \$array of class Ibexa\\Core\\FieldType\\FieldSettings constructor expects array\\|object, array\|null given\.$#' - identifier: argument.type - count: 1 - path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/SerializableConverter.php - - - - message: '#^Parameter \#2 \.\.\.\$arrays of function array_diff expects array, array\\|null given\.$#' - identifier: argument.type - count: 1 - path: src/lib/Repository/RoleService.php - - - - message: '#^Parameter \#1 \$array of function sort contains unresolvable type\.$#' - identifier: argument.unresolvableType - count: 1 - path: tests/integration/Core/Repository/LocationServiceTest.php diff --git a/phpstan-baseline-8.1.neon b/phpstan-baseline-8.1.neon deleted file mode 100644 index b404e32542..0000000000 --- a/phpstan-baseline-8.1.neon +++ /dev/null @@ -1,32 +0,0 @@ -parameters: - ignoreErrors: - - - - message: '#^Parameter \#1 \$array of function array_filter expects array, list\\|false given\.$#' - identifier: argument.type - count: 1 - path: src/bundle/RepositoryInstaller/Installer/DbBasedInstaller.php - - - - message: '#^Parameter \#1 \$array of function array_keys expects array, array\\|ArrayObject\<\(int\|string\), mixed\>\|bool\|float\|int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: src/lib/MVC/Symfony/Component/Serializer/AbstractPropertyWhitelistNormalizer.php - - - - message: '#^Parameter \#1 \$array of class Ibexa\\Core\\FieldType\\FieldSettings constructor expects array\\|object, array\|null given\.$#' - identifier: argument.type - count: 1 - path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/SerializableConverter.php - - - - message: '#^Parameter \#2 \.\.\.\$arrays of function array_diff expects array, array\\|null given\.$#' - identifier: argument.type - count: 1 - path: src/lib/Repository/RoleService.php - - - - message: '#^Parameter \#1 \$array of function sort contains unresolvable type\.$#' - identifier: argument.unresolvableType - count: 1 - path: tests/integration/Core/Repository/LocationServiceTest.php diff --git a/phpstan-baseline-8.2.neon b/phpstan-baseline-8.2.neon deleted file mode 100644 index b404e32542..0000000000 --- a/phpstan-baseline-8.2.neon +++ /dev/null @@ -1,32 +0,0 @@ -parameters: - ignoreErrors: - - - - message: '#^Parameter \#1 \$array of function array_filter expects array, list\\|false given\.$#' - identifier: argument.type - count: 1 - path: src/bundle/RepositoryInstaller/Installer/DbBasedInstaller.php - - - - message: '#^Parameter \#1 \$array of function array_keys expects array, array\\|ArrayObject\<\(int\|string\), mixed\>\|bool\|float\|int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: src/lib/MVC/Symfony/Component/Serializer/AbstractPropertyWhitelistNormalizer.php - - - - message: '#^Parameter \#1 \$array of class Ibexa\\Core\\FieldType\\FieldSettings constructor expects array\\|object, array\|null given\.$#' - identifier: argument.type - count: 1 - path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/SerializableConverter.php - - - - message: '#^Parameter \#2 \.\.\.\$arrays of function array_diff expects array, array\\|null given\.$#' - identifier: argument.type - count: 1 - path: src/lib/Repository/RoleService.php - - - - message: '#^Parameter \#1 \$array of function sort contains unresolvable type\.$#' - identifier: argument.unresolvableType - count: 1 - path: tests/integration/Core/Repository/LocationServiceTest.php diff --git a/phpstan-baseline-gte-8.0.neon b/phpstan-baseline-gte-8.0.neon index 66ecc07e72..bf7a5398fc 100644 --- a/phpstan-baseline-gte-8.0.neon +++ b/phpstan-baseline-gte-8.0.neon @@ -61,7 +61,7 @@ parameters: path: src/bundle/Core/Imagine/IORepositoryResolver.php - - message: '#^Method Ibexa\\Bundle\\Core\\URLChecker\\Handler\\HTTPHandler\:\:createCurlHandlerForUrl\(\) should return resource but returns \(CurlHandle\|false\)\.$#' + message: '#^Method Ibexa\\Bundle\\Core\\URLChecker\\Handler\\HTTPHandler\:\:createCurlHandlerForUrl\(\) should return resource but returns CurlHandle\.$#' identifier: return.type count: 1 path: src/bundle/Core/URLChecker/Handler/HTTPHandler.php @@ -114,6 +114,12 @@ parameters: count: 1 path: src/bundle/LegacySearchEngine/ApiLoader/ConnectionFactory.php + - + message: '#^Parameter \#1 \$array of function array_filter expects array, list\\|false given\.$#' + identifier: argument.type + count: 1 + path: src/bundle/RepositoryInstaller/Installer/DbBasedInstaller.php + - message: '#^Parameter \#1 \$object_or_class of function is_a expects object\|string, string\|null given\.$#' identifier: argument.type @@ -174,6 +180,12 @@ parameters: count: 1 path: src/lib/Limitation/LanguageLimitationType.php + - + message: '#^Parameter \#1 \$array of function array_keys expects array, array\\|ArrayObject\<\(int\|string\), mixed\>\|bool\|float\|int\|string\|null given\.$#' + identifier: argument.type + count: 1 + path: src/lib/MVC/Symfony/Component/Serializer/AbstractPropertyWhitelistNormalizer.php + - message: '#^Parameter \#1 \.\.\.\$arrays of function array_merge expects array, iterable\ given\.$#' identifier: argument.type @@ -186,6 +198,12 @@ parameters: count: 1 path: src/lib/MVC/Symfony/Matcher/ContentBased/UrlAlias.php + - + message: '#^Parameter \#1 \$array of class Ibexa\\Core\\FieldType\\FieldSettings constructor expects array\\|object, array\|null given\.$#' + identifier: argument.type + count: 1 + path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/SerializableConverter.php + - message: '#^Parameter \#1 \$array of function array_keys expects array, iterable\ given\.$#' identifier: argument.type @@ -234,6 +252,12 @@ parameters: count: 1 path: src/lib/Repository/ProxyFactory/ProxyGenerator.php + - + message: '#^Parameter \#2 \.\.\.\$arrays of function array_diff expects array, array\\|null given\.$#' + identifier: argument.type + count: 1 + path: src/lib/Repository/RoleService.php + - message: '#^Parameter \#1 \$value of function count expects array\|Countable, iterable\ given\.$#' identifier: argument.type @@ -354,6 +378,12 @@ parameters: count: 3 path: tests/integration/Core/Repository/LocationServiceTest.php + - + message: '#^Parameter \#1 \$array of function sort contains unresolvable type\.$#' + identifier: argument.unresolvableType + count: 1 + path: tests/integration/Core/Repository/LocationServiceTest.php + - message: '#^Parameter \#1 \$array of function array_filter expects array, iterable\ given\.$#' identifier: argument.type diff --git a/phpstan-baseline-gte-8.1.neon b/phpstan-baseline-gte-8.1.neon new file mode 100644 index 0000000000..ff8e210b8c --- /dev/null +++ b/phpstan-baseline-gte-8.1.neon @@ -0,0 +1,13 @@ +parameters: + ignoreErrors: + - + message: '#^Possibly invalid array key type bool\|float\|int\|string\.$#' + identifier: offsetAccess.invalidOffset + count: 3 + path: src/lib/Persistence/Legacy/Content/Mapper.php + + - + message: '#^Possibly invalid array key type bool\|float\|int\|string\.$#' + identifier: offsetAccess.invalidOffset + count: 2 + path: tests/integration/Core/Repository/SearchService/RemoteIdIndexingTest.php diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 9ab6b0278e..3194d21298 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -8436,12 +8436,6 @@ parameters: count: 1 path: src/contracts/Repository/Values/Content/Query/Criterion/FullText.php - - - message: '#^Method Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Query\\Criterion\\IsFieldEmpty\:\:__construct\(\) has Ibexa\\Contracts\\Core\\Repository\\Exceptions\\InvalidArgumentException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: src/contracts/Repository/Values/Content/Query/Criterion/IsFieldEmpty.php - - message: '#^Call to function is_bool\(\) with bool will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -8496,12 +8490,6 @@ parameters: count: 1 path: src/contracts/Repository/Values/Content/Query/Criterion/Location/Priority.php - - - message: '#^Method Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Query\\Criterion\\LogicalNot\:\:__construct\(\) has InvalidArgumentException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: src/contracts/Repository/Values/Content/Query/Criterion/LogicalNot.php - - message: '#^PHPDoc tag @param references unknown parameter\: \$criteria$#' identifier: parameter.notFound @@ -8874,12 +8862,6 @@ parameters: count: 1 path: src/contracts/Repository/Values/ObjectState/ObjectStateCreateStruct.php - - - message: '#^Method Ibexa\\Contracts\\Core\\Repository\\Values\\URL\\Query\\Criterion\\LogicalNot\:\:__construct\(\) has InvalidArgumentException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: src/contracts/Repository/Values/URL/Query/Criterion/LogicalNot.php - - message: '#^Class Ibexa\\Contracts\\Core\\Repository\\Values\\URL\\SearchResult implements generic interface IteratorAggregate but does not specify its types\: TKey, TValue$#' identifier: missingType.generics @@ -10956,12 +10938,6 @@ parameters: count: 1 path: src/lib/FieldType/FieldType.php - - - message: '#^Method Ibexa\\Core\\FieldType\\FieldType\:\:validate\(\) has Ibexa\\Contracts\\Core\\Repository\\Exceptions\\InvalidArgumentException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: src/lib/FieldType/FieldType.php - - message: '#^Method Ibexa\\Core\\FieldType\\FieldType\:\:validatorConfigurationFromHash\(\) has parameter \$validatorConfigurationHash with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -11910,12 +11886,6 @@ parameters: count: 1 path: src/lib/FieldType/Null/Type.php - - - message: '#^Method Ibexa\\Core\\FieldType\\Null\\Type\:\:checkValueStructure\(\) has Ibexa\\Contracts\\Core\\Repository\\Exceptions\\InvalidArgumentException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: src/lib/FieldType/Null/Type.php - - message: '#^Method Ibexa\\Core\\FieldType\\Null\\Type\:\:checkValueStructure\(\) has no return type specified\.$#' identifier: missingType.return @@ -12348,12 +12318,6 @@ parameters: count: 1 path: src/lib/FieldType/User/Type.php - - - message: '#^Method Ibexa\\Core\\FieldType\\User\\Type\:\:checkValueStructure\(\) has Ibexa\\Contracts\\Core\\Repository\\Exceptions\\InvalidArgumentException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: src/lib/FieldType/User/Type.php - - message: '#^Method Ibexa\\Core\\FieldType\\User\\Type\:\:checkValueStructure\(\) has no return type specified\.$#' identifier: missingType.return @@ -13296,12 +13260,6 @@ parameters: count: 1 path: src/lib/Limitation/BlockingLimitationType.php - - - message: '#^Method Ibexa\\Core\\Limitation\\BlockingLimitationType\:\:evaluate\(\) has Ibexa\\Contracts\\Core\\Repository\\Exceptions\\BadStateException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: src/lib/Limitation/BlockingLimitationType.php - - message: '#^Return type \(void\) of method Ibexa\\Core\\Limitation\\ChangeOwnerLimitationType\:\:valueSchema\(\) should be compatible with return type \(array\\|int\) of method Ibexa\\Contracts\\Core\\Limitation\\Type\:\:valueSchema\(\)$#' identifier: method.childReturnType @@ -13404,12 +13362,6 @@ parameters: count: 1 path: src/lib/Limitation/NewSectionLimitationType.php - - - message: '#^Method Ibexa\\Core\\Limitation\\NewSectionLimitationType\:\:evaluate\(\) has Ibexa\\Contracts\\Core\\Repository\\Exceptions\\BadStateException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: src/lib/Limitation/NewSectionLimitationType.php - - message: '#^Method Ibexa\\Core\\Limitation\\NewSectionLimitationType\:\:getCriterionByTarget\(\) has parameter \$targets with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -15252,12 +15204,6 @@ parameters: count: 1 path: src/lib/MVC/Symfony/SiteAccess/Matcher/URIElement.php - - - message: '#^Method Ibexa\\Core\\MVC\\Symfony\\SiteAccess\\Matcher\\URIElement\:\:getURIElements\(\) has LogicException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: src/lib/MVC/Symfony/SiteAccess/Matcher/URIElement.php - - message: '#^Method Ibexa\\Core\\MVC\\Symfony\\SiteAccess\\Matcher\\URIElement\:\:getURIElements\(\) return type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -15384,12 +15330,6 @@ parameters: count: 1 path: src/lib/MVC/Symfony/SiteAccess/Router.php - - - message: '#^Method Ibexa\\Core\\MVC\\Symfony\\SiteAccess\\Router\:\:match\(\) has Ibexa\\Core\\MVC\\Exception\\InvalidSiteAccessException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: src/lib/MVC/Symfony/SiteAccess/Router.php - - message: '#^Method Ibexa\\Core\\MVC\\Symfony\\SiteAccess\\Router\:\:matchByName\(\) should return Ibexa\\Core\\MVC\\Symfony\\SiteAccess\|null but returns object\.$#' identifier: return.type @@ -19170,12 +19110,6 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/Content/Gateway.php - - - message: '#^Argument of an invalid type DOMNodeList\\|false supplied for foreach, only iterables are supported\.$#' - identifier: foreach.nonIterable - count: 1 - path: src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php - - message: '#^Cannot call method fetch\(\) on Doctrine\\DBAL\\ForwardCompatibility\\Result\|int\|string\.$#' identifier: method.nonObject @@ -19188,12 +19122,6 @@ parameters: count: 16 path: src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php - - - message: '#^Cannot call method removeChild\(\) on DOMNode\|null\.$#' - identifier: method.nonObject - count: 1 - path: src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php - - message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\Gateway\\DoctrineDatabase\:\:deleteTranslationFromContentNames\(\) has no return type specified\.$#' identifier: missingType.return @@ -20898,12 +20826,6 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/Content/Type/Handler.php - - - message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\Handler\:\:link\(\) has Ibexa\\Contracts\\Core\\Repository\\Exceptions\\BadStateException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - 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\.$#' identifier: missingType.return @@ -61908,12 +61830,6 @@ parameters: count: 1 path: tests/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabaseTest.php - - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Gateway\\DoctrineDatabaseTest\:\:getDatabaseGateway\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: tests/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabaseTest.php - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Gateway\\DoctrineDatabaseTest\:\:insertRelationFixture\(\) has no return type specified\.$#' identifier: missingType.return @@ -62298,12 +62214,6 @@ parameters: count: 1 path: tests/lib/Persistence/Legacy/Content/Language/CachingLanguageHandlerTest.php - - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Language\\Gateway\\DoctrineDatabaseTest\:\:getDatabaseGateway\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: tests/lib/Persistence/Legacy/Content/Language/Gateway/DoctrineDatabaseTest.php - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Language\\Gateway\\DoctrineDatabaseTest\:\:testDeleteLanguage\(\) has no return type specified\.$#' identifier: missingType.return @@ -63636,12 +63546,6 @@ parameters: count: 1 path: tests/lib/Persistence/Legacy/Content/MapperTest.php - - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\ObjectState\\Gateway\\DoctrineDatabaseTest\:\:getDatabaseGateway\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: tests/lib/Persistence/Legacy/Content/ObjectState/Gateway/DoctrineDatabaseTest.php - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\ObjectState\\Gateway\\DoctrineDatabaseTest\:\:testDeleteObjectState\(\) has no return type specified\.$#' identifier: missingType.return @@ -63978,12 +63882,6 @@ parameters: count: 1 path: tests/lib/Persistence/Legacy/Content/ObjectState/ObjectStateHandlerTest.php - - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Section\\Gateway\\DoctrineDatabaseTest\:\:getDatabaseGateway\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: tests/lib/Persistence/Legacy/Content/Section/Gateway/DoctrineDatabaseTest.php - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Section\\Gateway\\DoctrineDatabaseTest\:\:testAssignSectionToContent\(\) has no return type specified\.$#' identifier: missingType.return @@ -64728,12 +64626,6 @@ parameters: count: 2 path: tests/lib/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabaseTest.php - - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Type\\Gateway\\DoctrineDatabaseTest\:\:getGateway\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: tests/lib/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabaseTest.php - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Type\\Gateway\\DoctrineDatabaseTest\:\:getTypeCreationContentClassNameExpectations\(\) should return array\\> but returns array\\|string\>\>\.$#' identifier: return.type @@ -65106,12 +64998,6 @@ parameters: count: 1 path: tests/lib/Persistence/Legacy/Content/Type/Update/Handler/DoctrineDatabaseTest.php - - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\UrlAlias\\Gateway\\DoctrineDatabaseTest\:\:getGateway\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: tests/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabaseTest.php - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\UrlAlias\\Gateway\\DoctrineDatabaseTest\:\:getGateway\(\) should return Ibexa\\Core\\Persistence\\Legacy\\Content\\UrlAlias\\Gateway\\DoctrineDatabase but returns Ibexa\\Core\\Persistence\\Legacy\\Content\\UrlAlias\\Gateway\.$#' identifier: return.type @@ -65496,12 +65382,6 @@ parameters: count: 1 path: tests/lib/Persistence/Legacy/Content/UrlAlias/UrlAliasHandlerTest.php - - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\UrlAlias\\UrlAliasHandlerTest\:\:getLanguageHandler\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: tests/lib/Persistence/Legacy/Content/UrlAlias/UrlAliasHandlerTest.php - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\UrlAlias\\UrlAliasHandlerTest\:\:getPartlyMockedHandler\(\) has parameter \$methods with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -66546,12 +66426,6 @@ parameters: count: 1 path: tests/lib/Persistence/Legacy/Content/UrlAlias/UrlAliasMapperTest.php - - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\UrlWildcard\\Gateway\\DoctrineDatabaseTest\:\:getGateway\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: tests/lib/Persistence/Legacy/Content/UrlWildcard/Gateway/DoctrineDatabaseTest.php - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\UrlWildcard\\Gateway\\DoctrineDatabaseTest\:\:testDeleteUrlWildcard\(\) has no return type specified\.$#' identifier: missingType.return @@ -66600,12 +66474,6 @@ parameters: count: 1 path: tests/lib/Persistence/Legacy/Content/UrlWildcard/Gateway/DoctrineDatabaseTest.php - - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\UrlWildcard\\UrlWildcardHandlerTest\:\:getHandler\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: tests/lib/Persistence/Legacy/Content/UrlWildcard/UrlWildcardHandlerTest.php - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\UrlWildcard\\UrlWildcardHandlerTest\:\:testCreate\(\) has no return type specified\.$#' identifier: missingType.return @@ -67218,24 +67086,12 @@ parameters: count: 1 path: tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/ValidityTest.php - - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\User\\Gateway\\DoctrineDatabaseTest\:\:getDatabaseGateway\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: tests/lib/Persistence/Legacy/User/Gateway/DoctrineDatabaseTest.php - - message: '#^Property Ibexa\\Tests\\Core\\Persistence\\Legacy\\User\\Gateway\\DoctrineDatabaseTest\:\:\$databaseGateway \(Ibexa\\Core\\Persistence\\Legacy\\User\\Gateway\\DoctrineDatabase\) in isset\(\) is not nullable\.$#' identifier: isset.property count: 1 path: tests/lib/Persistence/Legacy/User/Gateway/DoctrineDatabaseTest.php - - - message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\User\\Role\\Gateway\\DoctrineDatabaseTest\:\:getDatabaseGateway\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: tests/lib/Persistence/Legacy/User/Role/Gateway/DoctrineDatabaseTest.php - - message: '#^Property Ibexa\\Tests\\Core\\Persistence\\Legacy\\User\\Role\\Gateway\\DoctrineDatabaseTest\:\:\$databaseGateway \(Ibexa\\Core\\Persistence\\Legacy\\User\\Role\\Gateway\\DoctrineDatabase\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -74892,12 +74748,6 @@ parameters: count: 1 path: tests/lib/Search/Legacy/Content/AbstractTestCase.php - - - message: '#^Method Ibexa\\Tests\\Core\\Search\\Legacy\\Content\\AbstractTestCase\:\:getContentTypeHandler\(\) has Doctrine\\DBAL\\DBALException in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: tests/lib/Search/Legacy/Content/AbstractTestCase.php - - message: '#^Method Ibexa\\Tests\\Core\\Search\\Legacy\\Content\\AbstractTestCase\:\:getConverterRegistry\(\) has no return type specified\.$#' identifier: missingType.return diff --git a/phpstan-baseline.neon.php b/phpstan-baseline.neon.php index 69f97de240..eaab20f250 100644 --- a/phpstan-baseline.neon.php +++ b/phpstan-baseline.neon.php @@ -13,6 +13,10 @@ $includes[] = __DIR__ . '/phpstan-baseline-gte-8.0.neon'; } +if (PHP_VERSION_ID >= 80100) { + $includes[] = __DIR__ . '/phpstan-baseline-gte-8.1.neon'; +} + if (PHP_VERSION_ID < 80200) { $includes[] = __DIR__ . '/phpstan-baseline-lte-8.1.neon'; } @@ -23,18 +27,6 @@ $includes[] = __DIR__ . '/phpstan-baseline-lte-8.2.neon'; } -if (PHP_VERSION_ID >= 80000 && PHP_VERSION_ID < 80100) { - $includes[] = __DIR__ . '/phpstan-baseline-8.0.neon'; -} - -if (PHP_VERSION_ID >= 80100 && PHP_VERSION_ID < 80200) { - $includes[] = __DIR__ . '/phpstan-baseline-8.1.neon'; -} - -if (PHP_VERSION_ID >= 80200 && PHP_VERSION_ID < 80300) { - $includes[] = __DIR__ . '/phpstan-baseline-8.2.neon'; -} - $config = []; $config['includes'] = $includes; diff --git a/src/bundle/Core/Imagine/PlaceholderProvider/RemoteProvider.php b/src/bundle/Core/Imagine/PlaceholderProvider/RemoteProvider.php index f85ad9d29e..805fc19538 100644 --- a/src/bundle/Core/Imagine/PlaceholderProvider/RemoteProvider.php +++ b/src/bundle/Core/Imagine/PlaceholderProvider/RemoteProvider.php @@ -24,23 +24,43 @@ public function getPlaceholder(ImageValue $value, array $options = []): string $options = $this->resolveOptions($options); $path = $this->getTemporaryPath(); + if ($path === '') { + throw new RuntimeException('Temporary file path is empty.'); + } + $placeholderUrl = $this->getPlaceholderUrl($options['url_pattern'], $value); + if ($placeholderUrl === '') { + throw new RuntimeException('Placeholder URL must be a non-empty string.'); + } - try { - $handler = curl_init(); + $fp = fopen($path, 'wb'); + if ($fp === false) { + throw new RuntimeException("Unable to open temp file for writing: {$path}"); + } - curl_setopt_array($handler, [ - CURLOPT_URL => $placeholderUrl, - CURLOPT_FILE => fopen($path, 'wb'), - CURLOPT_TIMEOUT => $options['timeout'], - CURLOPT_FAILONERROR => true, - ]); + $handler = \curl_init(); + if ($handler === false) { + throw new RuntimeException('Unable to initialize cURL.'); + } + + $timeout = $options['timeout']; + curl_setopt_array($handler, [ + CURLOPT_URL => $placeholderUrl, // non-empty-string + CURLOPT_FILE => $fp, // resource + CURLOPT_TIMEOUT => $timeout, // int + CURLOPT_FAILONERROR => true, // bool + ]); + + try { if (curl_exec($handler) === false) { - throw new RuntimeException("Unable to download placeholder for {$value->id} ($placeholderUrl): " . curl_error($handler)); + throw new RuntimeException( + "Unable to download placeholder for {$value->id} ({$placeholderUrl}): " . curl_error($handler) + ); } } finally { curl_close($handler); + fclose($fp); } return $path; diff --git a/src/bundle/Core/URLChecker/Handler/HTTPHandler.php b/src/bundle/Core/URLChecker/Handler/HTTPHandler.php index 12977be304..50e1140807 100644 --- a/src/bundle/Core/URLChecker/Handler/HTTPHandler.php +++ b/src/bundle/Core/URLChecker/Handler/HTTPHandler.php @@ -7,6 +7,8 @@ namespace Ibexa\Bundle\Core\URLChecker\Handler; use Ibexa\Contracts\Core\Repository\Values\URL\URL; +use InvalidArgumentException; +use RuntimeException; use Symfony\Component\OptionsResolver\OptionsResolver; class HTTPHandler extends AbstractConfigResolverBasedURLHandler @@ -118,9 +120,18 @@ private function createCurlHandlerForUrl(URL $url, array &$handlers, int $connec { $options = $this->getOptions(); $handler = curl_init(); + if ($handler === false) { + throw new RuntimeException('Unable to initialize cURL handler.'); + } + + $urlString = $url->url; + if ($urlString === '') { + throw new InvalidArgumentException('URL must be a non-empty string.'); + } + /** @var non-empty-string $urlString */ curl_setopt_array($handler, [ - CURLOPT_URL => $url->url, + CURLOPT_URL => $urlString, CURLOPT_RETURNTRANSFER => false, CURLOPT_FOLLOWLOCATION => true, CURLOPT_CONNECTTIMEOUT => $connectionTimeout, @@ -129,14 +140,14 @@ private function createCurlHandlerForUrl(URL $url, array &$handlers, int $connec CURLOPT_NOBODY => true, ]); - if ($options['ignore_certificate']) { + if (!empty($options['ignore_certificate'])) { curl_setopt_array($handler, [ CURLOPT_SSL_VERIFYPEER => false, - CURLOPT_SSL_VERIFYHOST => false, + CURLOPT_SSL_VERIFYHOST => 0, ]); } - $handlers[(int)$handler] = $url; + $handlers[(int) $handler] = $url; return $handler; } diff --git a/src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php index 6aa235b9d0..908003748e 100644 --- a/src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php @@ -12,6 +12,7 @@ use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Query\QueryBuilder as DoctrineQueryBuilder; use DOMDocument; +use DOMElement; use DOMXPath; use Ibexa\Contracts\Core\Persistence\Content; use Ibexa\Contracts\Core\Persistence\Content\ContentInfo; @@ -33,6 +34,7 @@ use Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue; use Ibexa\Core\Persistence\Legacy\SharedGateway\Gateway as SharedGateway; use LogicException; +use RuntimeException; /** * Doctrine database based content gateway. @@ -1230,8 +1232,14 @@ private function removeRelationFromRelationListField(int $contentId, array $row) $xpathExpression = "//related-objects/relation-list/relation-item[@contentobject-id='{$contentId}']"; $relationItems = $xpath->query($xpathExpression); + if ($relationItems === false) { + throw new RuntimeException('Invalid XPath: ' . $xpathExpression); + } + foreach ($relationItems as $relationItem) { - $relationItem->parentNode->removeChild($relationItem); + if ($relationItem instanceof DOMElement && $relationItem->parentNode !== null) { + $relationItem->parentNode->removeChild($relationItem); + } } $query = $this->connection->createQueryBuilder();