Merge branch '2.1'

* 2.1:
  Replace PHPStan with Psalm
  Improve v2.0.0 blogpost link
  Sort require-dev packages
This commit is contained in:
Kamil Kokot
2020-04-04 20:30:24 +02:00
8 changed files with 34 additions and 20 deletions

View File

@@ -22,7 +22,7 @@ It allows for:
* [Behat/Symfony2Extension differences](DOCUMENTATION.md#differences-from-behatsymfony2extension)
* [Configuration reference](DOCUMENTATION.md#configuration-reference)
For a bit of backstory, take a look at the [SymfonyExtension v2.0.0 release blogpost](https://kamilkokot.com/tame-behat-with-the-brand-new-symfony-extension/?utm_source=github&utm_medium=referral&utm_campaign=readme).
For a bit of backstory, take a look at the [SymfonyExtension v2.0.0 release blogpost](https://kamilkokot.com/tame-behat-with-the-brand-new-symfony-extension).
## Versioning and release cycle

View File

@@ -18,13 +18,13 @@
"symfony/proxy-manager-bridge": "^4.4|^5.0"
},
"require-dev": {
"behat/mink-selenium2-driver": "^1.3",
"friends-of-behat/mink": "^1.7",
"friends-of-behat/mink-browserkit-driver": "^1.3",
"friends-of-behat/mink-extension": "^2.2",
"behat/mink-selenium2-driver": "^1.3",
"friends-of-behat/page-object-extension": "^0.3.1",
"friends-of-behat/service-container-extension": "^1.0",
"phpstan/phpstan-shim": "^0.11",
"vimeo/psalm": "3.10.1",
"sylius-labs/coding-standard": "^3.0",
"symfony/browser-kit": "^4.4|^5.0",
"symfony/framework-bundle": "^4.4|^5.0",
@@ -55,7 +55,7 @@
],
"analyse": [
"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": {

View File

@@ -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
View 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>

View File

@@ -85,8 +85,6 @@ final class ContextServiceEnvironmentHandler implements EnvironmentHandler
}
/**
* @param UninitializedSymfonyExtensionEnvironment $uninitializedEnvironment
*
* @throws EnvironmentIsolationException
*/
public function isolateEnvironment(Environment $uninitializedEnvironment, $testSubject = null): Environment
@@ -174,6 +172,8 @@ final class ContextServiceEnvironmentHandler implements EnvironmentHandler
}
/**
* @psalm-assert UninitializedSymfonyExtensionEnvironment $uninitializedEnvironment
*
* @throws EnvironmentIsolationException
*/
private function assertEnvironmentCanBeIsolated(Environment $uninitializedEnvironment, $testSubject): void

View File

@@ -49,7 +49,7 @@ final class InitializedSymfonyExtensionEnvironment implements SymfonyExtensionEn
{
$callable = $callee->getCallable();
if ($callee->isAnInstanceMethod()) {
if (is_array($callable) && $callee->isAnInstanceMethod()) {
return [$this->getContext($callable[0]), $callable[1]];
}

View File

@@ -26,7 +26,7 @@ final class UninitializedSymfonyExtensionEnvironment extends StaticEnvironment i
/** @var string[] */
private $contexts;
/** @var ContextEnvironment|null */
/** @var ContextEnvironment */
private $delegatedEnvironment;
public function __construct(Suite $suite, array $contexts, ContextEnvironment $delegatedEnvironment)

View File

@@ -36,6 +36,7 @@ final class KernelOrchestrator implements EventSubscriberInterface
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);
}