Add PHP CS Fixer and PHPStan max to CI; remove abandoned GoutteFactory

- Add friendsofphp/php-cs-fixer ^3.75 and phpstan/phpstan ^2.0 to
  require-dev; add .php-cs-fixer.dist.php (@Symfony ruleset with
  phpdoc_to_comment ignored_tags) and phpstan.neon (level max,
  treatPhpDocTypesAsCertain: false)
- Run CS Fixer and PHPStan in every CI matrix job alongside tests
- Add composer scripts: cs, cs-check, phpstan
- Add .php-cs-fixer.cache to .gitignore
- Fix all PHPStan max violations across src/: add return/param types,
  narrow mixed config values with is_string()/is_array() guards,
  use TaggedNodeInterface for scenario tag access in SessionsListener
- Remove GoutteFactory and its spec — the goutte driver and its
  underlying client library are abandoned

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kamil Kokot
2026-06-12 17:43:01 +02:00
parent dff5cbd479
commit 47a9d45cd1
38 changed files with 436 additions and 720 deletions

View File

@@ -17,26 +17,17 @@ class Selenium4Factory implements DriverFactory
{
use EnvironmentCapabilities;
/**
* {@inheritdoc}
*/
public function getDriverName()
public function getDriverName(): string
{
return 'selenium4';
}
/**
* {@inheritdoc}
*/
public function supportsJavascript()
public function supportsJavascript(): bool
{
return true;
}
/**
* {@inheritdoc}
*/
public function configure(ArrayNodeDefinition $builder)
public function configure(ArrayNodeDefinition $builder): void
{
$builder
->children()
@@ -49,28 +40,25 @@ class Selenium4Factory implements DriverFactory
}
/**
* {@inheritdoc}
* @param array<string, mixed> $config
*/
public function buildDriver(array $config)
public function buildDriver(array $config): Definition
{
if (!class_exists('Behat\Mink\Driver\Selenium4Driver')) {
throw new \RuntimeException(sprintf(
'Install MinkSelenium4Driver in order to use %s driver.',
$this->getDriverName()
));
throw new \RuntimeException(sprintf('Install MinkSelenium4Driver in order to use %s driver.', $this->getDriverName()));
}
return new Definition('Behat\Mink\Driver\Selenium4Driver', array(
return new Definition('Behat\Mink\Driver\Selenium4Driver', [
$config['browser'],
array_merge(
$this->guessEnvironmentCapabilities(),
$config['capabilities']
is_array($config['capabilities']) ? $config['capabilities'] : []
),
$config['wd_host'],
));
]);
}
protected function getCapabilitiesNode()
protected function getCapabilitiesNode(): ArrayNodeDefinition
{
$node = new ArrayNodeDefinition('capabilities');