Skip to content

Commit 4b339bd

Browse files
committed
Rewrite in backward compatibility compliant way
1 parent e2a2caf commit 4b339bd

File tree

2 files changed

+18
-45
lines changed

2 files changed

+18
-45
lines changed

tests/Type/BeberleiAssert/ImpossibleCheckTypeMethodCallRuleTest.php

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace PHPStan\Type\BeberleiAssert;
44

5-
use PHPStan\Rules\Comparison\ImpossibleCheckTypeHelper;
65
use PHPStan\Rules\Comparison\ImpossibleCheckTypeMethodCallRule;
76
use PHPStan\Rules\Rule;
87

@@ -14,37 +13,7 @@ class ImpossibleCheckTypeMethodCallRuleTest extends \PHPStan\Testing\RuleTestCas
1413

1514
protected function getRule(): Rule
1615
{
17-
return new ImpossibleCheckTypeMethodCallRule(new ImpossibleCheckTypeHelper($this->createBroker(), $this->getTypeSpecifier(), [], true), true, true);
18-
}
19-
20-
/**
21-
* @return \PHPStan\Type\MethodTypeSpecifyingExtension[]
22-
*/
23-
protected function getMethodTypeSpecifyingExtensions(): array
24-
{
25-
return [
26-
new AssertionChainTypeSpecifyingExtension(),
27-
];
28-
}
29-
30-
/**
31-
* @return \PHPStan\Type\DynamicMethodReturnTypeExtension[]
32-
*/
33-
public function getDynamicMethodReturnTypeExtensions(): array
34-
{
35-
return [
36-
new AssertionChainDynamicReturnTypeExtension(),
37-
];
38-
}
39-
40-
/**
41-
* @return \PHPStan\Type\DynamicStaticMethodReturnTypeExtension[]
42-
*/
43-
public function getDynamicStaticMethodReturnTypeExtensions(): array
44-
{
45-
return [
46-
new AssertThatDynamicMethodReturnTypeExtension(),
47-
];
16+
return self::getContainer()->getByType(ImpossibleCheckTypeMethodCallRule::class);
4817
}
4918

5019
public function testExtension(): void
@@ -61,4 +30,12 @@ public function testExtension(): void
6130
]);
6231
}
6332

33+
public static function getAdditionalConfigFiles(): array
34+
{
35+
return [
36+
__DIR__ . '/../../../extension.neon',
37+
__DIR__ . '/../../../vendor/phpstan/phpstan-strict-rules/rules.neon',
38+
];
39+
}
40+
6441
}

tests/Type/BeberleiAssert/ImpossibleCheckTypeStaticMethodCallRuleTest.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace PHPStan\Type\BeberleiAssert;
44

5-
use PHPStan\Rules\Comparison\ImpossibleCheckTypeHelper;
65
use PHPStan\Rules\Comparison\ImpossibleCheckTypeStaticMethodCallRule;
76
use PHPStan\Rules\Rule;
87

@@ -14,18 +13,7 @@ class ImpossibleCheckTypeStaticMethodCallRuleTest extends \PHPStan\Testing\RuleT
1413

1514
protected function getRule(): Rule
1615
{
17-
return new ImpossibleCheckTypeStaticMethodCallRule(new ImpossibleCheckTypeHelper($this->createBroker(), $this->getTypeSpecifier(), [], true), true, true);
18-
}
19-
20-
21-
/**
22-
* @return \PHPStan\Type\StaticMethodTypeSpecifyingExtension[]
23-
*/
24-
protected function getStaticMethodTypeSpecifyingExtensions(): array
25-
{
26-
return [
27-
new AssertTypeSpecifyingExtension(),
28-
];
16+
return self::getContainer()->getByType(ImpossibleCheckTypeStaticMethodCallRule::class);
2917
}
3018

3119
public function testExtension(): void
@@ -43,4 +31,12 @@ public function testExtension(): void
4331
]);
4432
}
4533

34+
public static function getAdditionalConfigFiles(): array
35+
{
36+
return [
37+
__DIR__ . '/../../../extension.neon',
38+
__DIR__ . '/../../../vendor/phpstan/phpstan-strict-rules/rules.neon',
39+
];
40+
}
41+
4642
}

0 commit comments

Comments
 (0)