Skip to content

Commit d9016fe

Browse files
authored
Merge pull request #156 from shochdoerfer/feature/phpstan_1_0_0
Drop support for PHPStan 0.12.x
2 parents 02712e0 + 8b85448 commit d9016fe

9 files changed

+75
-60
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,8 @@ jobs:
1111
strategy:
1212
matrix:
1313
operating-system: ['ubuntu-latest']
14-
php-versions: ['7.3', '7.4']
15-
composer-prefer-lowest: [false]
16-
coveralls: [false]
17-
include:
18-
- operating-system: 'ubuntu-latest'
19-
php-versions: '7.4'
20-
composer-prefer-lowest: true
21-
coveralls: false
22-
- operating-system: 'ubuntu-latest'
23-
php-versions: '7.4'
24-
composer-prefer-lowest: false
25-
coveralls: true
14+
php-versions: ['7.4', '7.4']
15+
coveralls: [false, true]
2616
steps:
2717
- name: Checkout repo
2818
uses: actions/checkout@v2
@@ -38,12 +28,6 @@ jobs:
3828
- name: Install Composer dependencies
3929
run: composer install
4030

41-
- name: Install lowest PHPStan version
42-
if: matrix.composer-prefer-lowest == true
43-
run: |
44-
composer remove --no-update phpstan/phpstan phpstan/phpstan-phpunit phpstan/phpstan-strict-rules
45-
composer require --prefer-lowest phpstan/phpstan:0.12.23 phpstan/phpstan-phpunit:0.12.11 phpstan/phpstan-strict-rules:0.12.3
46-
4731
- name: Composer license check
4832
run: composer check-license
4933

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ work for Magento 2 projects.
66
[![Build Status](https://github.com/bitExpert/phpstan-magento/workflows/ci/badge.svg?branch=master)](https://github.com/bitExpert/phpstan-magento/actions)
77
[![Coverage Status](https://coveralls.io/repos/github/bitExpert/phpstan-magento/badge.svg?branch=master)](https://coveralls.io/github/bitExpert/phpstan-magento?branch=master)
88

9+
## Requirements
10+
11+
This PHPStan extension requires PHPStan 1.1. If you are using a Magento version that requires an older version of PHPStan,
12+
you need to manually upgrade before installing this extension.
13+
914
## Installation
1015

1116
The preferred way of installing `bitexpert/phpstan-magento` is through Composer.
@@ -25,8 +30,6 @@ includes:
2530
- vendor/bitexpert/phpstan-magento/extension.neon
2631
```
2732

28-
⚠️ When you use a version of `phpstan/phpstan` lower than 0.12.26 you should replace `bootstrapFiles` with `autoload_files` in the configuration mentioned above.
29-
3033
## Features
3134

3235
### Class generator for factory & proxy classes

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"require": {
1818
"php": "^7.2.0",
1919
"nette/neon": "^3.3.1",
20-
"phpstan/phpstan": "^0.12.23"
20+
"phpstan/phpstan": "^1.1.0"
2121
},
2222
"conflict": {
2323
"magento/framework": "<101.0.0"
@@ -30,8 +30,8 @@
3030
"mikey179/vfsstream": "^1.6.10",
3131
"nikic/php-parser": "^4.13.1",
3232
"phpstan/extension-installer": "^1.1.0",
33-
"phpstan/phpstan-phpunit": "^0.12.22",
34-
"phpstan/phpstan-strict-rules": "^0.12.11",
33+
"phpstan/phpstan-phpunit": "^1.0.0",
34+
"phpstan/phpstan-strict-rules": "^1.0.0",
3535
"phpunit/phpunit": "^9.5.10",
3636
"roave/security-advisories": "dev-latest",
3737
"squizlabs/php_codesniffer": "^3.6.1"

composer.lock

Lines changed: 28 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan.neon

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,33 @@ parameters:
77
- src/bitExpert
88
- tests/bitExpert
99
ignoreErrors:
10+
-
11+
message: '~is not covered by backward compatibility promise.~'
12+
path: src/bitExpert/PHPStan/Magento/Autoload/Cache/FileCacheStorage.php
13+
-
14+
message: '~is not covered by backward compatibility promise.~'
15+
path: src/bitExpert/PHPStan/Magento/Autoload/FactoryAutoloader.php
1016
-
1117
message: '~Call to an undefined method ReflectionType::getName~'
1218
path: src/bitExpert/PHPStan/Magento/Autoload/ProxyAutoloader.php
1319
-
1420
message: '~Parameter #1 \$argument of class ReflectionClass constructor expects~'
1521
path: src/bitExpert/PHPStan/Magento/Autoload/ProxyAutoloader.php
22+
-
23+
message: '~is not covered by backward compatibility promise.~'
24+
path: src/bitExpert/PHPStan/Magento/Autoload/ProxyAutoloader.php
25+
-
26+
message: '~is not covered by backward compatibility promise.~'
27+
path: src/bitExpert/PHPStan/Magento/Reflection/Framework/Session/SessionManagerMagicMethodReflectionExtension.php
28+
-
29+
message: '~is not covered by backward compatibility promise.~'
30+
path: src/bitExpert/PHPStan/Magento/Reflection/AbstractMagicMethodReflectionExtension.php
31+
-
32+
message: '~is not covered by backward compatibility promise.~'
33+
path: tests/bitExpert/PHPStan/Magento/Autoload/FactoryAutoloaderUnitTest.php
34+
-
35+
message: '~is not covered by backward compatibility promise.~'
36+
path: tests/bitExpert/PHPStan/Magento/Autoload/ProxyAutoloaderUnitTest.php
1637
-
1738
message: '~bitExpert\\PHPStan\\Magento\\Rules\\Helper\\SampleModel::__construct\(\) does not call parent constructor~'
1839
path: tests/bitExpert/PHPStan/Magento/Rules/Helper/SampleModel.php

tests/bitExpert/PHPStan/Magento/Rules/GetCollectionMockMethodNeedsCollectionSubclassRuleUnitTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ protected function getRule(): Rule
3131
return new GetCollectionMockMethodNeedsCollectionSubclassRule();
3232
}
3333

34-
/**
35-
* @return \PHPStan\Type\DynamicMethodReturnTypeExtension[]
36-
*/
37-
public function getDynamicMethodReturnTypeExtensions() : array
34+
public static function getAdditionalConfigFiles(): array
3835
{
39-
return [
40-
new TestFrameworkObjectManagerDynamicReturnTypeExtension(),
41-
];
36+
// make sure to load \bitExpert\PHPStan\Magento\Type\TestFrameworkObjectManagerDynamicReturnTypeExtension
37+
// which is needed for the integration test
38+
return array_merge(
39+
parent::getAdditionalConfigFiles(),
40+
[__DIR__ . '/Helper/dynamic_method_returntype_extension.neon']
41+
);
4242
}
4343

4444
/**
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
services:
2+
-
3+
class: bitExpert\PHPStan\Magento\Type\TestFrameworkObjectManagerDynamicReturnTypeExtension
4+
tags:
5+
- phpstan.broker.dynamicMethodReturnTypeExtension

tests/bitExpert/PHPStan/Magento/Type/ObjectManagerDynamicReturnTypeExtensionUnitTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
use PhpParser\Node\Expr\MethodCall;
1616
use PHPStan\Analyser\Scope;
1717
use PHPStan\Reflection\MethodReflection;
18-
use PHPStan\Testing\TestCase;
18+
use PHPStan\Testing\PHPStanTestCase;
1919
use PHPStan\Type\MixedType;
2020

21-
class ObjectManagerDynamicReturnTypeExtensionUnitTest extends TestCase
21+
class ObjectManagerDynamicReturnTypeExtensionUnitTest extends PHPStanTestCase
2222
{
2323
/**
2424
* @var ObjectManagerDynamicReturnTypeExtension

tests/bitExpert/PHPStan/Magento/Type/TestFrameworkObjectManagerDynamicReturnTypeExtensionUnitTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use PHPStan\Analyser\Scope;
2121
use PHPStan\Reflection\MethodReflection;
2222
use PHPStan\ShouldNotHappenException;
23-
use PHPStan\Testing\TestCase;
23+
use PHPStan\Testing\PHPStanTestCase;
2424
use PHPStan\Type\ArrayType;
2525
use PHPStan\Type\Constant\ConstantStringType;
2626
use PHPStan\Type\ErrorType;
@@ -31,7 +31,7 @@
3131
use PHPStan\Type\StringType;
3232
use PHPStan\Type\UnionType;
3333

34-
class TestFrameworkObjectManagerDynamicReturnTypeExtensionUnitTest extends TestCase
34+
class TestFrameworkObjectManagerDynamicReturnTypeExtensionUnitTest extends PHPStanTestCase
3535
{
3636
/**
3737
* @var TestFrameworkObjectManagerDynamicReturnTypeExtension

0 commit comments

Comments
 (0)