Skip to content

Commit

Permalink
Rewrite in backward compatibility compliant way
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jun 9, 2021
1 parent e2a2caf commit 4b339bd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 45 deletions.
Expand Up @@ -2,7 +2,6 @@

namespace PHPStan\Type\BeberleiAssert;

use PHPStan\Rules\Comparison\ImpossibleCheckTypeHelper;
use PHPStan\Rules\Comparison\ImpossibleCheckTypeMethodCallRule;
use PHPStan\Rules\Rule;

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

protected function getRule(): Rule
{
return new ImpossibleCheckTypeMethodCallRule(new ImpossibleCheckTypeHelper($this->createBroker(), $this->getTypeSpecifier(), [], true), true, true);
}

/**
* @return \PHPStan\Type\MethodTypeSpecifyingExtension[]
*/
protected function getMethodTypeSpecifyingExtensions(): array
{
return [
new AssertionChainTypeSpecifyingExtension(),
];
}

/**
* @return \PHPStan\Type\DynamicMethodReturnTypeExtension[]
*/
public function getDynamicMethodReturnTypeExtensions(): array
{
return [
new AssertionChainDynamicReturnTypeExtension(),
];
}

/**
* @return \PHPStan\Type\DynamicStaticMethodReturnTypeExtension[]
*/
public function getDynamicStaticMethodReturnTypeExtensions(): array
{
return [
new AssertThatDynamicMethodReturnTypeExtension(),
];
return self::getContainer()->getByType(ImpossibleCheckTypeMethodCallRule::class);
}

public function testExtension(): void
Expand All @@ -61,4 +30,12 @@ public function testExtension(): void
]);
}

public static function getAdditionalConfigFiles(): array
{
return [
__DIR__ . '/../../../extension.neon',
__DIR__ . '/../../../vendor/phpstan/phpstan-strict-rules/rules.neon',
];
}

}
Expand Up @@ -2,7 +2,6 @@

namespace PHPStan\Type\BeberleiAssert;

use PHPStan\Rules\Comparison\ImpossibleCheckTypeHelper;
use PHPStan\Rules\Comparison\ImpossibleCheckTypeStaticMethodCallRule;
use PHPStan\Rules\Rule;

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

protected function getRule(): Rule
{
return new ImpossibleCheckTypeStaticMethodCallRule(new ImpossibleCheckTypeHelper($this->createBroker(), $this->getTypeSpecifier(), [], true), true, true);
}


/**
* @return \PHPStan\Type\StaticMethodTypeSpecifyingExtension[]
*/
protected function getStaticMethodTypeSpecifyingExtensions(): array
{
return [
new AssertTypeSpecifyingExtension(),
];
return self::getContainer()->getByType(ImpossibleCheckTypeStaticMethodCallRule::class);
}

public function testExtension(): void
Expand All @@ -43,4 +31,12 @@ public function testExtension(): void
]);
}

public static function getAdditionalConfigFiles(): array
{
return [
__DIR__ . '/../../../extension.neon',
__DIR__ . '/../../../vendor/phpstan/phpstan-strict-rules/rules.neon',
];
}

}

0 comments on commit 4b339bd

Please sign in to comment.