Skip to content

Commit

Permalink
Merge pull request #326 from bitExpert/dependabot/composer/phpstan/ph…
Browse files Browse the repository at this point in the history
…pstan-approx-1.12.0

Update phpstan/phpstan requirement from ~1.11.1 to ~1.12.0
  • Loading branch information
shochdoerfer authored Aug 31, 2024
2 parents 4190f43 + 6b7e7cf commit 34c1ea5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/**
Expand All @@ -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(
Expand All @@ -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');
Expand All @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/**
Expand All @@ -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(
Expand All @@ -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');
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);

Expand Down

0 comments on commit 34c1ea5

Please sign in to comment.