From 897520019e01ad5fc24c5c1e6a4be606af76ed05 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Aug 2024 04:28:56 +0000 Subject: [PATCH 1/3] Update phpstan/phpstan requirement from ~1.11.1 to ~1.12.0 Updates the requirements on [phpstan/phpstan](https://github.com/phpstan/phpstan) to permit the latest version. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.12.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.11.1...1.12.0) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index cf3f972..d29ee49 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "php": "^7.2.0 || ^8.1.0", "ext-dom": "*", "laminas/laminas-code": "~3.3.0 || ~3.4.1 || ~3.5.1 || ^4.5 || ^4.10", - "phpstan/phpstan": "~1.11.1", + "phpstan/phpstan": "~1.12.0", "symfony/finder": "^3.0 || ^4.0 || ^5.0 || ^6.0" }, "conflict": { From 2b23d81a29c91fa2132ac51fadc9ad2f1c80a725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20Hochd=C3=B6rfer?= Date: Sat, 31 Aug 2024 18:41:11 +0200 Subject: [PATCH 2/3] Update README.md file --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 81d3863..e7ec08a 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,10 @@ PHP: PHP 7.2 or higher Magento: Magento 2.3.0 or higher -PHPStan: PHPStan 1.11 +PHPStan: PHPStan 1.12 If you are using a Magento version that requires an older version of PHPStan (e.g. 0.12.77), you need to manually upgrade it before -installing this extension. in your composer.json Change the PHPStan version to `~1.11` and run: +installing this extension. in your composer.json Change the PHPStan version to `~1.12` and run: ``` composer update phpstan/phpstan --with-all-dependencies From 6b7e7cf76c9cbae36c46cffe406a30cbe3e10456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20Hochd=C3=B6rfer?= Date: Sat, 31 Aug 2024 18:41:21 +0200 Subject: [PATCH 3/3] Fix CI errors --- .../Autoload/ExtensionAutoloaderUnitTest.php | 22 ++++++++++------- .../ExtensionInterfaceAutoloaderUnitTest.php | 24 ++++++++++++------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/tests/bitExpert/PHPStan/Magento/Autoload/ExtensionAutoloaderUnitTest.php b/tests/bitExpert/PHPStan/Magento/Autoload/ExtensionAutoloaderUnitTest.php index cd1bca7..8c4a93b 100644 --- a/tests/bitExpert/PHPStan/Magento/Autoload/ExtensionAutoloaderUnitTest.php +++ b/tests/bitExpert/PHPStan/Magento/Autoload/ExtensionAutoloaderUnitTest.php @@ -7,20 +7,25 @@ use bitExpert\PHPStan\Magento\Autoload\DataProvider\ExtensionAttributeDataProvider; use org\bovigo\vfs\vfsStream; use PHPStan\Cache\Cache; +use PHPStan\Cache\CacheStorage; use PHPUnit\Framework\TestCase; class ExtensionAutoloaderUnitTest extends TestCase { /** - * @var Cache|\PHPUnit\Framework\MockObject\MockObject + * @var Cache */ private $cache; /** - * @var ClassLoaderProvider|\PHPUnit\Framework\MockObject\MockObject + * @var CacheStorage&\PHPUnit\Framework\MockObject\MockObject + */ + private $cacheStorage; + /** + * @var ClassLoaderProvider&\PHPUnit\Framework\MockObject\MockObject */ private $classLoader; /** - * @var ExtensionAttributeDataProvider|\PHPUnit\Framework\MockObject\MockObject + * @var ExtensionAttributeDataProvider&\PHPUnit\Framework\MockObject\MockObject */ private $extAttrDataProvider; /** @@ -30,7 +35,8 @@ class ExtensionAutoloaderUnitTest extends TestCase protected function setUp(): void { - $this->cache = $this->createMock(Cache::class); + $this->cacheStorage = $this->createMock(CacheStorage::class); + $this->cache = new Cache($this->cacheStorage); $this->classLoader = $this->createMock(ClassLoaderProvider::class); $this->extAttrDataProvider = $this->createMock(ExtensionAttributeDataProvider::class); $this->autoloader = new ExtensionAutoloader( @@ -47,7 +53,7 @@ public function autoloaderIgnoresClassesWithoutExtensionInterfacePostfix(): void { $this->classLoader->expects(self::never()) ->method('findFile'); - $this->cache->expects(self::never()) + $this->cacheStorage->expects(self::never()) ->method('load'); $this->autoloader->autoload('SomeClass'); @@ -61,7 +67,7 @@ public function autoloaderPrefersLocalFile(): void $this->classLoader->expects(self::once()) ->method('findFile') ->willReturn(__DIR__ . '/HelperExtension.php'); - $this->cache->expects(self::never()) + $this->cacheStorage->expects(self::never()) ->method('load'); $this->autoloader->autoload(HelperExtension::class); @@ -77,11 +83,11 @@ public function autoloaderUsesCachedFileWhenFound(): void $this->classLoader->expects(self::once()) ->method('findFile') ->willReturn(false); - $this->cache->expects(self::once()) + $this->cacheStorage->expects(self::once()) ->method('load') ->willReturn(__DIR__ . '/HelperExtension.php'); - $this->cache->expects(self::never()) + $this->cacheStorage->expects(self::never()) ->method('save'); $this->autoloader->autoload(HelperExtension::class); diff --git a/tests/bitExpert/PHPStan/Magento/Autoload/ExtensionInterfaceAutoloaderUnitTest.php b/tests/bitExpert/PHPStan/Magento/Autoload/ExtensionInterfaceAutoloaderUnitTest.php index f62ba1a..2f0e750 100644 --- a/tests/bitExpert/PHPStan/Magento/Autoload/ExtensionInterfaceAutoloaderUnitTest.php +++ b/tests/bitExpert/PHPStan/Magento/Autoload/ExtensionInterfaceAutoloaderUnitTest.php @@ -8,20 +8,25 @@ use InvalidArgumentException; use org\bovigo\vfs\vfsStream; use PHPStan\Cache\Cache; +use PHPStan\Cache\CacheStorage; use PHPUnit\Framework\TestCase; class ExtensionInterfaceAutoloaderUnitTest extends TestCase { /** - * @var Cache|\PHPUnit\Framework\MockObject\MockObject + * @var Cache */ private $cache; /** - * @var ExtensionAttributeDataProvider|\PHPUnit\Framework\MockObject\MockObject + * @var CacheStorage&\PHPUnit\Framework\MockObject\MockObject + */ + private $cacheStorage; + /** + * @var ExtensionAttributeDataProvider&\PHPUnit\Framework\MockObject\MockObject */ private $extAttrDataProvider; /** - * @var ClassLoaderProvider|\PHPUnit\Framework\MockObject\MockObject + * @var ClassLoaderProvider&\PHPUnit\Framework\MockObject\MockObject */ private $classLoader; /** @@ -31,7 +36,8 @@ class ExtensionInterfaceAutoloaderUnitTest extends TestCase protected function setUp(): void { - $this->cache = $this->createMock(Cache::class); + $this->cacheStorage = $this->createMock(CacheStorage::class); + $this->cache = new Cache($this->cacheStorage); $this->classLoader = $this->createMock(ClassLoaderProvider::class); $this->extAttrDataProvider = $this->createMock(ExtensionAttributeDataProvider::class); $this->autoloader = new ExtensionInterfaceAutoloader( @@ -48,7 +54,7 @@ public function autoloaderIgnoresClassesWithoutExtensionInterfacePostfix(): void { $this->classLoader->expects(self::never()) ->method('findFile'); - $this->cache->expects(self::never()) + $this->cacheStorage->expects(self::never()) ->method('load'); $this->autoloader->autoload('SomeClass'); @@ -62,7 +68,7 @@ public function autoloaderPrefersLocalFile(): void $this->classLoader->expects(self::once()) ->method('findFile') ->willReturn(__DIR__ . '/HelperExtensionInterface.php'); - $this->cache->expects(self::never()) + $this->cacheStorage->expects(self::never()) ->method('load'); $this->autoloader->autoload(HelperExtensionInterface::class); @@ -78,11 +84,11 @@ public function autoloaderUsesCachedFileWhenFound(): void $this->classLoader->expects(self::once()) ->method('findFile') ->willReturn(false); - $this->cache->expects(self::once()) + $this->cacheStorage->expects(self::once()) ->method('load') ->willReturn(__DIR__ . '/HelperExtensionInterface.php'); - $this->cache->expects(self::never()) + $this->cacheStorage->expects(self::never()) ->method('save'); $this->autoloader->autoload(HelperExtensionInterface::class); @@ -103,7 +109,7 @@ public function autoloadDoesNotGenerateInterfaceWhenNoAttributesExist(): void $this->classLoader->expects(self::once()) ->method('findFile') ->willReturn(false); - $this->cache->expects(self::once()) + $this->cacheStorage->expects(self::once()) ->method('load') ->willReturn(null);