diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c3e0d67f11..581ded6b90 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,6 +42,7 @@ jobs: matrix: php: - '8.3' + - '8.4' steps: - uses: actions/checkout@v5 @@ -90,6 +91,7 @@ jobs: matrix: php: - '8.3' + - '8.4' image: - 'postgres:14' - 'postgres:18' @@ -141,6 +143,7 @@ jobs: matrix: php: - '8.3' + - '8.4' image: - 'mysql:8.0' - 'mysql:8.4' @@ -192,6 +195,7 @@ jobs: matrix: php: - '8.3' + - '8.4' steps: - uses: actions/checkout@v5 with: diff --git a/phpstan-baseline-8.3.neon b/phpstan-baseline-8.3.neon new file mode 100644 index 0000000000..7df68615ee --- /dev/null +++ b/phpstan-baseline-8.3.neon @@ -0,0 +1,67 @@ +parameters: + ignoreErrors: + - + message: '#^Dead catch \- Ibexa\\Contracts\\Core\\Repository\\Exceptions\\NotFoundException is never thrown in the try block\.$#' + identifier: catch.neverThrown + count: 1 + path: src/bundle/Core/Features/Context/ContentTypeContext.php + + - + message: '#^Dead catch \- Ibexa\\Contracts\\Core\\Repository\\Exceptions\\NotFoundException is never thrown in the try block\.$#' + identifier: catch.neverThrown + count: 1 + path: src/bundle/Core/Features/Context/UserContext.php + + - + message: '#^Dead catch \- Doctrine\\DBAL\\Exception is never thrown in the try block\.$#' + identifier: catch.neverThrown + count: 1 + path: src/lib/Persistence/Legacy/Notification/Gateway/ExceptionConversion.php + + - + message: '#^Dead catch \- PDOException is never thrown in the try block\.$#' + identifier: catch.neverThrown + count: 1 + path: src/lib/Persistence/Legacy/Notification/Gateway/ExceptionConversion.php + + - + message: '#^Dead catch \- Doctrine\\DBAL\\Exception is never thrown in the try block\.$#' + identifier: catch.neverThrown + count: 1 + path: src/lib/Persistence/Legacy/URL/Gateway/ExceptionConversion.php + + - + message: '#^Dead catch \- PDOException is never thrown in the try block\.$#' + identifier: catch.neverThrown + count: 1 + path: src/lib/Persistence/Legacy/URL/Gateway/ExceptionConversion.php + + - + message: '#^Dead catch \- Exception is never thrown in the try block\.$#' + identifier: catch.neverThrown + count: 1 + path: src/lib/Repository/UserPreferenceService.php + + - + message: '#^Dead catch \- Doctrine\\DBAL\\Exception is never thrown in the try block\.$#' + identifier: catch.neverThrown + count: 1 + path: src/lib/Search/Legacy/Content/Gateway/ExceptionConversion.php + + - + message: '#^Dead catch \- PDOException is never thrown in the try block\.$#' + identifier: catch.neverThrown + count: 1 + path: src/lib/Search/Legacy/Content/Gateway/ExceptionConversion.php + + - + message: '#^Dead catch \- Doctrine\\DBAL\\Exception is never thrown in the try block\.$#' + identifier: catch.neverThrown + count: 1 + path: src/lib/Search/Legacy/Content/Location/Gateway/ExceptionConversion.php + + - + message: '#^Dead catch \- PDOException is never thrown in the try block\.$#' + identifier: catch.neverThrown + count: 1 + path: src/lib/Search/Legacy/Content/Location/Gateway/ExceptionConversion.php diff --git a/phpstan-baseline-8.4.neon b/phpstan-baseline-8.4.neon new file mode 100644 index 0000000000..5e88abf565 --- /dev/null +++ b/phpstan-baseline-8.4.neon @@ -0,0 +1,37 @@ +parameters: + ignoreErrors: + - + message: '#^Cannot unset property Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\:\:\$id because it might have hooks in a subclass\.$#' + identifier: unset.possiblyHookedProperty + count: 1 + path: tests/lib/Repository/Values/Content/LocationTest.php + + - + message: '#^Cannot unset property Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\:\:\$id because it might have hooks in a subclass\.$#' + identifier: unset.possiblyHookedProperty + count: 1 + path: tests/lib/Repository/Values/Content/TrashItemTest.php + + - + message: '#^Cannot unset property Ibexa\\Contracts\\Core\\Repository\\Values\\User\\Policy\:\:\$id because it might have hooks in a subclass\.$#' + identifier: unset.possiblyHookedProperty + count: 1 + path: tests/lib/Repository/Values/User/PolicyTest.php + + - + message: '#^Cannot unset property Ibexa\\Contracts\\Core\\Repository\\Values\\User\\Role\:\:\$id because it might have hooks in a subclass\.$#' + identifier: unset.possiblyHookedProperty + count: 1 + path: tests/lib/Repository/Values/User/RoleTest.php + + - + message: '#^Cannot unset property Ibexa\\Contracts\\Core\\Repository\\Values\\User\\UserGroup\:\:\$parentId because it might have hooks in a subclass\.$#' + identifier: unset.possiblyHookedProperty + count: 1 + path: tests/lib/Repository/Values/User/UserGroupTest.php + + - + message: '#^Cannot unset property Ibexa\\Contracts\\Core\\Repository\\Values\\User\\User\:\:\$login because it might have hooks in a subclass\.$#' + identifier: unset.possiblyHookedProperty + count: 1 + path: tests/lib/Repository/Values/User/UserTest.php diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 0250f1e9ba..e12317d9c5 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -2292,12 +2292,6 @@ parameters: count: 1 path: src/bundle/Core/Features/Context/ContentTypeContext.php - - - message: '#^Dead catch \- Ibexa\\Contracts\\Core\\Repository\\Exceptions\\NotFoundException is never thrown in the try block\.$#' - identifier: catch.neverThrown - count: 1 - path: src/bundle/Core/Features/Context/ContentTypeContext.php - - message: '#^Method Ibexa\\Bundle\\Core\\Features\\Context\\ContentTypeContext\:\:assertContentTypeDoesntExistsByIdentifier\(\) has no return type specified\.$#' identifier: missingType.return @@ -2748,12 +2742,6 @@ parameters: count: 1 path: src/bundle/Core/Features/Context/RoleContext.php - - - message: '#^Dead catch \- Ibexa\\Contracts\\Core\\Repository\\Exceptions\\NotFoundException is never thrown in the try block\.$#' - identifier: catch.neverThrown - count: 1 - path: src/bundle/Core/Features/Context/UserContext.php - - message: '#^Method Ibexa\\Bundle\\Core\\Features\\Context\\UserContext\:\:assertUserWithNameDoesntExist\(\) has no return type specified\.$#' identifier: missingType.return @@ -15000,18 +14988,6 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/Notification/Gateway/DoctrineDatabase.php - - - message: '#^Dead catch \- Doctrine\\DBAL\\Exception is never thrown in the try block\.$#' - identifier: catch.neverThrown - count: 1 - path: src/lib/Persistence/Legacy/Notification/Gateway/ExceptionConversion.php - - - - message: '#^Dead catch \- PDOException is never thrown in the try block\.$#' - identifier: catch.neverThrown - count: 1 - path: src/lib/Persistence/Legacy/Notification/Gateway/ExceptionConversion.php - - message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Notification\\Mapper\:\:extractNotificationFromRow\(\) has parameter \$row with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -15240,18 +15216,6 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/URL/Gateway/DoctrineDatabase.php - - - message: '#^Dead catch \- Doctrine\\DBAL\\Exception is never thrown in the try block\.$#' - identifier: catch.neverThrown - count: 1 - path: src/lib/Persistence/Legacy/URL/Gateway/ExceptionConversion.php - - - - message: '#^Dead catch \- PDOException is never thrown in the try block\.$#' - identifier: catch.neverThrown - count: 1 - path: src/lib/Persistence/Legacy/URL/Gateway/ExceptionConversion.php - - message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\URL\\Gateway\\ExceptionConversion\:\:findUsages\(\) return type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -17916,12 +17880,6 @@ parameters: count: 1 path: src/lib/Repository/User/PasswordValidator.php - - - message: '#^Dead catch \- Exception is never thrown in the try block\.$#' - identifier: catch.neverThrown - count: 1 - path: src/lib/Repository/UserPreferenceService.php - - message: '#^Call to an undefined method Ibexa\\Contracts\\Core\\Repository\\ContentService\:\:internalLoadContentById\(\)\.$#' identifier: method.notFound @@ -19434,18 +19392,6 @@ parameters: count: 1 path: src/lib/Search/Legacy/Content/Gateway/DoctrineDatabase.php - - - message: '#^Dead catch \- Doctrine\\DBAL\\Exception is never thrown in the try block\.$#' - identifier: catch.neverThrown - count: 1 - path: src/lib/Search/Legacy/Content/Gateway/ExceptionConversion.php - - - - message: '#^Dead catch \- PDOException is never thrown in the try block\.$#' - identifier: catch.neverThrown - count: 1 - path: src/lib/Search/Legacy/Content/Gateway/ExceptionConversion.php - - message: '#^Method Ibexa\\Core\\Search\\Legacy\\Content\\Gateway\\ExceptionConversion\:\:find\(\) has parameter \$languageFilter with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -19722,18 +19668,6 @@ parameters: count: 1 path: src/lib/Search/Legacy/Content/Location/Gateway/DoctrineDatabase.php - - - message: '#^Dead catch \- Doctrine\\DBAL\\Exception is never thrown in the try block\.$#' - identifier: catch.neverThrown - count: 1 - path: src/lib/Search/Legacy/Content/Location/Gateway/ExceptionConversion.php - - - - message: '#^Dead catch \- PDOException is never thrown in the try block\.$#' - identifier: catch.neverThrown - count: 1 - path: src/lib/Search/Legacy/Content/Location/Gateway/ExceptionConversion.php - - message: '#^Method Ibexa\\Core\\Search\\Legacy\\Content\\Location\\Gateway\\ExceptionConversion\:\:find\(\) has parameter \$languageFilter with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue diff --git a/phpstan-baseline.neon.php b/phpstan-baseline.neon.php new file mode 100644 index 0000000000..99a1abfbf3 --- /dev/null +++ b/phpstan-baseline.neon.php @@ -0,0 +1,19 @@ +persistenceMock, $this->searchMock, $this->listener); - parent::tearDown(); - } - public function testGetSubscribedEvents() { self::assertSame( diff --git a/tests/lib/Persistence/Cache/AbstractBaseHandlerTestCase.php b/tests/lib/Persistence/Cache/AbstractBaseHandlerTestCase.php index 3afb04afb9..513150549c 100644 --- a/tests/lib/Persistence/Cache/AbstractBaseHandlerTestCase.php +++ b/tests/lib/Persistence/Cache/AbstractBaseHandlerTestCase.php @@ -127,26 +127,6 @@ static function ($key, $value, $isHit, $defaultLifetime = 0) { ); } - /** - * Tear down test (properties). - */ - protected function tearDown(): void - { - unset( - $this->cacheMock, - $this->persistenceHandlerMock, - $this->persistenceCacheHandler, - $this->loggerMock, - $this->cacheItemsClosure, - $this->inMemoryMock, - $this->cacheIdentifierGeneratorMock, - $this->cacheIdentifierSanitizer, - $this->locationPathConverter - ); - - parent::tearDown(); - } - /** * @param $key * @param null $value If null the cache item will be assumed to be a cache miss here. diff --git a/tests/lib/Persistence/Cache/Adapter/InMemoryClearingProxyAdapterTest.php b/tests/lib/Persistence/Cache/Adapter/InMemoryClearingProxyAdapterTest.php index a27674cb6d..e46859e535 100644 --- a/tests/lib/Persistence/Cache/Adapter/InMemoryClearingProxyAdapterTest.php +++ b/tests/lib/Persistence/Cache/Adapter/InMemoryClearingProxyAdapterTest.php @@ -63,18 +63,6 @@ static function ($key, $value, $isHit, $defaultLifetime = 0, $tags = []) { ); } - /** - * Tear down test (properties). - */ - protected function tearDown(): void - { - unset($this->cache); - unset($this->innerPool); - unset($this->inMemory); - - parent::tearDown(); - } - public function testGetItem() { $item = $this->createCacheItem('first'); diff --git a/tests/lib/Persistence/Cache/InMemory/InMemoryCacheTest.php b/tests/lib/Persistence/Cache/InMemory/InMemoryCacheTest.php index 4ae79bdc3d..e4f689fb9f 100644 --- a/tests/lib/Persistence/Cache/InMemory/InMemoryCacheTest.php +++ b/tests/lib/Persistence/Cache/InMemory/InMemoryCacheTest.php @@ -39,7 +39,6 @@ protected function tearDown(): void { $this->cache->clear(); - unset($this->cache); unset($GLOBALS['override_time']); parent::tearDown(); } diff --git a/tests/lib/Persistence/Cache/PersistenceLoggerTest.php b/tests/lib/Persistence/Cache/PersistenceLoggerTest.php index d6f928cf64..87ddd4a887 100644 --- a/tests/lib/Persistence/Cache/PersistenceLoggerTest.php +++ b/tests/lib/Persistence/Cache/PersistenceLoggerTest.php @@ -24,12 +24,6 @@ protected function setUp(): void $this->logger = new PersistenceLogger(); } - protected function tearDown(): void - { - unset($this->logger); - parent::tearDown(); - } - public function testGetName(): void { self::assertEquals(PersistenceLogger::NAME, $this->logger->getName()); diff --git a/tests/lib/Persistence/Legacy/TestCase.php b/tests/lib/Persistence/Legacy/TestCase.php index f3e006b230..ecee615f53 100644 --- a/tests/lib/Persistence/Legacy/TestCase.php +++ b/tests/lib/Persistence/Legacy/TestCase.php @@ -148,11 +148,6 @@ protected function setUp(): void } } - protected function tearDown(): void - { - unset($this->connection); - } - /** * Get a text representation of a result set. * diff --git a/tests/lib/Repository/SiteAccessAware/AbstractServiceTestCase.php b/tests/lib/Repository/SiteAccessAware/AbstractServiceTestCase.php index 672dd03a11..183101ac40 100644 --- a/tests/lib/Repository/SiteAccessAware/AbstractServiceTestCase.php +++ b/tests/lib/Repository/SiteAccessAware/AbstractServiceTestCase.php @@ -59,14 +59,6 @@ protected function setUp(): void ); } - protected function tearDown(): void - { - unset($this->service); - unset($this->languageResolverMock); - unset($this->innerApiServiceMock); - parent::tearDown(); - } - /** * @return array See signature on {@link testForPassTrough} for arguments and their type. */