minor #122 Replace PHPStan with Psalm (pamil)
This PR was merged into the 2.1 branch.
Discussion
----------
Commits
-------
5de4ce6389 Replace PHPStan with Psalm
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
"friends-of-behat/mink-extension": "^2.2",
|
"friends-of-behat/mink-extension": "^2.2",
|
||||||
"friends-of-behat/page-object-extension": "^0.3.1",
|
"friends-of-behat/page-object-extension": "^0.3.1",
|
||||||
"friends-of-behat/service-container-extension": "^1.0",
|
"friends-of-behat/service-container-extension": "^1.0",
|
||||||
"phpstan/phpstan-shim": "^0.11",
|
"vimeo/psalm": "3.10.1",
|
||||||
"sylius-labs/coding-standard": "^3.0",
|
"sylius-labs/coding-standard": "^3.0",
|
||||||
"symfony/browser-kit": "^4.4|^5.0",
|
"symfony/browser-kit": "^4.4|^5.0",
|
||||||
"symfony/framework-bundle": "^4.4|^5.0",
|
"symfony/framework-bundle": "^4.4|^5.0",
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
],
|
],
|
||||||
"analyse": [
|
"analyse": [
|
||||||
"vendor/bin/ecs check --ansi --no-progress-bar src tests",
|
"vendor/bin/ecs check --ansi --no-progress-bar src tests",
|
||||||
"vendor/bin/phpstan analyse --ansi --no-progress -c phpstan.neon -l max src"
|
"vendor/bin/psalm src --no-progress"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
|
|||||||
12
phpstan.neon
12
phpstan.neon
@@ -1,12 +0,0 @@
|
|||||||
parameters:
|
|
||||||
reportUnmatchedIgnoredErrors: false
|
|
||||||
|
|
||||||
ignoreErrors:
|
|
||||||
- '/Cannot access offset 0 on callable/'
|
|
||||||
- '/Cannot access offset 1 on callable/'
|
|
||||||
- '/Cannot call method [a-zA-Z0-9]+\(\) on Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface|null\./'
|
|
||||||
- '/Method FriendsOfBehat\\SymfonyExtension\\Context\\Environment\\InitializedSymfonyExtensionEnvironment::bindCallee\(\) should return callable/'
|
|
||||||
- '/Strict comparison using === between 0\|1 and 2 will always evaluate to false\./'
|
|
||||||
- '/Class Symfony\\Component\\BrowserKit\\Client not found\./'
|
|
||||||
- '/Class Symfony\\Component\\BrowserKit\\AbstractBrowser not found\./'
|
|
||||||
- '/Parameter \#1 \$client of method Behat\\Mink\\Driver\\BrowserKitDriver::__construct\(\) expects/'
|
|
||||||
25
psalm.xml
Normal file
25
psalm.xml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<psalm
|
||||||
|
totallyTyped="true"
|
||||||
|
errorLevel="4"
|
||||||
|
resolveFromConfigFile="true"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="https://getpsalm.org/schema/config"
|
||||||
|
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||||
|
>
|
||||||
|
<projectFiles>
|
||||||
|
<directory name="src" />
|
||||||
|
<ignoreFiles>
|
||||||
|
<directory name="vendor" />
|
||||||
|
</ignoreFiles>
|
||||||
|
</projectFiles>
|
||||||
|
|
||||||
|
<issueHandlers>
|
||||||
|
<UndefinedClass>
|
||||||
|
<errorLevel type="suppress">
|
||||||
|
<referencedClass name="Symfony\Component\BrowserKit\AbstractBrowser" />
|
||||||
|
<referencedClass name="Symfony\Component\BrowserKit\Client" />
|
||||||
|
</errorLevel>
|
||||||
|
</UndefinedClass>
|
||||||
|
</issueHandlers>
|
||||||
|
</psalm>
|
||||||
@@ -85,8 +85,6 @@ final class ContextServiceEnvironmentHandler implements EnvironmentHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param UninitializedSymfonyExtensionEnvironment $uninitializedEnvironment
|
|
||||||
*
|
|
||||||
* @throws EnvironmentIsolationException
|
* @throws EnvironmentIsolationException
|
||||||
*/
|
*/
|
||||||
public function isolateEnvironment(Environment $uninitializedEnvironment, $testSubject = null): Environment
|
public function isolateEnvironment(Environment $uninitializedEnvironment, $testSubject = null): Environment
|
||||||
@@ -174,6 +172,8 @@ final class ContextServiceEnvironmentHandler implements EnvironmentHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @psalm-assert UninitializedSymfonyExtensionEnvironment $uninitializedEnvironment
|
||||||
|
*
|
||||||
* @throws EnvironmentIsolationException
|
* @throws EnvironmentIsolationException
|
||||||
*/
|
*/
|
||||||
private function assertEnvironmentCanBeIsolated(Environment $uninitializedEnvironment, $testSubject): void
|
private function assertEnvironmentCanBeIsolated(Environment $uninitializedEnvironment, $testSubject): void
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ final class InitializedSymfonyExtensionEnvironment implements SymfonyExtensionEn
|
|||||||
{
|
{
|
||||||
$callable = $callee->getCallable();
|
$callable = $callee->getCallable();
|
||||||
|
|
||||||
if ($callee->isAnInstanceMethod()) {
|
if (is_array($callable) && $callee->isAnInstanceMethod()) {
|
||||||
return [$this->getContext($callable[0]), $callable[1]];
|
return [$this->getContext($callable[0]), $callable[1]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ final class UninitializedSymfonyExtensionEnvironment extends StaticEnvironment i
|
|||||||
/** @var string[] */
|
/** @var string[] */
|
||||||
private $contexts;
|
private $contexts;
|
||||||
|
|
||||||
/** @var ContextEnvironment|null */
|
/** @var ContextEnvironment */
|
||||||
private $delegatedEnvironment;
|
private $delegatedEnvironment;
|
||||||
|
|
||||||
public function __construct(Suite $suite, array $contexts, ContextEnvironment $delegatedEnvironment)
|
public function __construct(Suite $suite, array $contexts, ContextEnvironment $delegatedEnvironment)
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ final class KernelOrchestrator implements EventSubscriberInterface
|
|||||||
|
|
||||||
public function setUp(): void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
|
/** @psalm-suppress InvalidArgument Psalm complains that ContainerInterface does not match object|null */
|
||||||
$this->symfonyKernel->getContainer()->set('behat.service_container', $this->behatContainer);
|
$this->symfonyKernel->getContainer()->set('behat.service_container', $this->behatContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user