Skip to content

Commit

Permalink
fix files
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin Courcier committed Jun 4, 2023
1 parent 0e06d4b commit 59dbff8
Show file tree
Hide file tree
Showing 439 changed files with 3,394 additions and 4,741 deletions.
4 changes: 2 additions & 2 deletions features/error_reporting.feature
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,6 @@ Feature: Error Reporting
When an exception is thrown # features/exception_in_scenario.feature:7
Exception: Exception is thrown in features/bootstrap/FeatureContext.php:59
Stack trace:
#0 src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php(110): FeatureContext->anExceptionIsThrown()
#1 src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php(64): Behat\Testwork\Call\Handler\RuntimeCallHandler->executeCall(
#0 src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php(108): FeatureContext->anExceptionIsThrown()
#1 src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php(65): Behat\Testwork\Call\Handler\RuntimeCallHandler->executeCall(
"""
20 changes: 9 additions & 11 deletions src/Behat/Behat/ApplicationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
use Behat\Behat\Definition\ServiceContainer\DefinitionExtension;
use Behat\Behat\EventDispatcher\ServiceContainer\EventDispatcherExtension;
use Behat\Behat\Gherkin\ServiceContainer\GherkinExtension;
use Behat\Behat\HelperContainer\ServiceContainer\HelperContainerExtension;
use Behat\Behat\Hook\ServiceContainer\HookExtension;
use Behat\Behat\Output\ServiceContainer\Formatter\JUnitFormatterFactory;
use Behat\Behat\Output\ServiceContainer\Formatter\PrettyFormatterFactory;
use Behat\Behat\Output\ServiceContainer\Formatter\ProgressFormatterFactory;
use Behat\Behat\HelperContainer\ServiceContainer\HelperContainerExtension;
use Behat\Behat\Snippet\ServiceContainer\SnippetExtension;
use Behat\Behat\Tester\ServiceContainer\TesterExtension;
use Behat\Behat\Transformation\ServiceContainer\TransformationExtension;
Expand Down Expand Up @@ -71,9 +71,9 @@ protected function getDefaultExtensions()
{
$processor = new ServiceProcessor();

return array(
return [
new ArgumentExtension(),
new AutoloaderExtension(array('' => '%paths.base%/features/bootstrap')),
new AutoloaderExtension(['' => '%paths.base%/features/bootstrap']),
new SuiteExtension($processor),
new OutputExtension('pretty', $this->getDefaultFormatterFactories($processor), $processor),
new ExceptionExtension($processor),
Expand All @@ -93,8 +93,8 @@ protected function getDefaultExtensions()
new HookExtension(),
new TransformationExtension($processor),
new OrderingExtension($processor),
new HelperContainerExtension($processor)
);
new HelperContainerExtension($processor),
];
}

/**
Expand All @@ -112,7 +112,7 @@ protected function getConfigPath()
{
$cwd = rtrim(getcwd(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$configDir = $cwd . 'config' . DIRECTORY_SEPARATOR;
$paths = array(
$paths = [
$cwd . 'behat.yaml',
$cwd . 'behat.yml',
$cwd . 'behat.yaml.dist',
Expand All @@ -121,7 +121,7 @@ protected function getConfigPath()
$configDir . 'behat.yml',
$configDir . 'behat.yaml.dist',
$configDir . 'behat.yml.dist',
);
];

foreach ($paths as $path) {
if (is_file($path)) {
Expand All @@ -135,16 +135,14 @@ protected function getConfigPath()
/**
* Returns default formatter factories.
*
* @param ServiceProcessor $processor
*
* @return FormatterFactory[]
*/
private function getDefaultFormatterFactories(ServiceProcessor $processor)
{
return array(
return [
new PrettyFormatterFactory($processor),
new ProgressFormatterFactory($processor),
new JUnitFormatterFactory(),
);
];
}
}
10 changes: 4 additions & 6 deletions src/Behat/Behat/Context/Annotation/AnnotationReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

use Behat\Behat\Context\Reader\AnnotatedContextReader;
use Behat\Testwork\Call\Callee;
use ReflectionMethod;

/**
* Reads custom annotation of a provided context method into a Callee.
Expand All @@ -26,12 +25,11 @@ interface AnnotationReader
/**
* Reads all callees associated with a provided method.
*
* @param string $contextClass
* @param ReflectionMethod $method
* @param string $docLine
* @param string $description
* @param string $contextClass
* @param string $docLine
* @param string $description
*
* @return null|Callee
*/
public function readCallee($contextClass, ReflectionMethod $method, $docLine, $description);
public function readCallee($contextClass, \ReflectionMethod $method, $docLine, $description);
}
2 changes: 1 addition & 1 deletion src/Behat/Behat/Context/Annotation/DocBlockHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Behat\Behat\Context\Annotation;

/**
* Helper class for DocBlock parsing
* Helper class for DocBlock parsing.
*/
class DocBlockHelper
{
Expand Down
6 changes: 2 additions & 4 deletions src/Behat/Behat/Context/Argument/ArgumentResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
namespace Behat\Behat\Context\Argument;

use Behat\Behat\Context\Environment\Handler\ContextEnvironmentHandler;
use ReflectionClass;

/**
* Resolves arguments of context constructors.
Expand All @@ -25,10 +24,9 @@ interface ArgumentResolver
/**
* Resolves context constructor arguments.
*
* @param ReflectionClass $classReflection
* @param mixed[] $arguments
* @param mixed[] $arguments
*
* @return mixed[]
*/
public function resolveArguments(ReflectionClass $classReflection, array $arguments);
public function resolveArguments(\ReflectionClass $classReflection, array $arguments);
}
2 changes: 0 additions & 2 deletions src/Behat/Behat/Context/Argument/ArgumentResolverFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ interface ArgumentResolverFactory
/**
* Builds argument resolvers for provided suite.
*
* @param Environment $environment
*
* @return ArgumentResolver[]
*/
public function createArgumentResolvers(Environment $environment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ final class CompositeArgumentResolverFactory implements ArgumentResolverFactory
/**
* @var ArgumentResolverFactory[]
*/
private $factories = array();
private $factories = [];

/**
* Registers factory.
*
* @param ArgumentResolverFactory $factory
*/
public function registerFactory(ArgumentResolverFactory $factory)
{
Expand All @@ -46,7 +44,7 @@ public function createArgumentResolvers(Environment $environment)
function (array $resolvers, ArgumentResolverFactory $factory) use ($environment) {
return array_merge($resolvers, $factory->createArgumentResolvers($environment));
},
array()
[]
);
}
}
6 changes: 2 additions & 4 deletions src/Behat/Behat/Context/Argument/CompositeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ final class CompositeFactory implements SuiteScopedResolverFactory
/**
* @var SuiteScopedResolverFactory[]
*/
private $factories = array();
private $factories = [];

/**
* Registers factory.
*
* @param SuiteScopedResolverFactory $factory
*/
public function registerFactory(SuiteScopedResolverFactory $factory)
{
Expand All @@ -48,7 +46,7 @@ public function generateArgumentResolvers(Suite $suite)
function (array $resolvers, SuiteScopedResolverFactory $factory) use ($suite) {
return array_merge($resolvers, $factory->generateArgumentResolvers($suite));
},
array()
[]
);
}
}
4 changes: 2 additions & 2 deletions src/Behat/Behat/Context/Argument/NullFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ final class NullFactory implements ArgumentResolverFactory, SuiteScopedResolverF
*/
public function generateArgumentResolvers(Suite $suite)
{
return array();
return [];
}

/**
* {@inheritdoc}
*/
public function createArgumentResolvers(Environment $environment)
{
return array();
return [];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ interface SuiteScopedResolverFactory
/**
* Creates argument resolvers for provided suite.
*
* @param Suite $suite
*
* @return ArgumentResolver[]
*/
public function generateArgumentResolvers(Suite $suite);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ final class SuiteScopedResolverFactoryAdapter implements ArgumentResolverFactory

/**
* Initialises adapter.
*
* @param SuiteScopedResolverFactory $factory
*/
public function __construct(SuiteScopedResolverFactory $factory)
{
Expand Down
7 changes: 1 addition & 6 deletions src/Behat/Behat/Context/Attribute/AttributeReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

namespace Behat\Behat\Context\Attribute;

use ReflectionMethod;

/**
* Reads Attributes of a provided context method into a Callee.
*
Expand All @@ -24,10 +22,7 @@ interface AttributeReader
/**
* Reads all callees associated with a provided method.
*
* @param string $contextClass
* @param ReflectionMethod $method
*
* @return array
*/
public function readCallees(string $contextClass, ReflectionMethod $method);
public function readCallees(string $contextClass, \ReflectionMethod $method);
}
30 changes: 16 additions & 14 deletions src/Behat/Behat/Context/Cli/ContextSnippetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

namespace Behat\Behat\Context\Cli;

use Behat\Behat\Context\Snippet\Generator\AggregateContextIdentifier;
use Behat\Behat\Context\Snippet\Generator\AggregatePatternIdentifier;
use Behat\Behat\Context\Snippet\Generator\ContextInterfaceBasedContextIdentifier;
use Behat\Behat\Context\Snippet\Generator\ContextInterfaceBasedPatternIdentifier;
use Behat\Behat\Context\Snippet\Generator\ContextSnippetGenerator;
use Behat\Behat\Context\Snippet\Generator\FixedContextIdentifier;
use Behat\Behat\Context\Snippet\Generator\FixedPatternIdentifier;
use Behat\Behat\Context\Snippet\Generator\AggregateContextIdentifier;
use Behat\Behat\Definition\Translator\TranslatorInterface;
use Behat\Testwork\Cli\Controller;
use Symfony\Component\Console\Command\Command as SymfonyCommand;
Expand All @@ -35,16 +35,14 @@ final class ContextSnippetsController implements Controller
* @var ContextSnippetGenerator
*/
private $generator;

/**
* @var TranslatorInterface
*/
private $translator;

/**
* Initialises controller.
*
* @param ContextSnippetGenerator $generator
* @param TranslatorInterface $translator
*/
public function __construct(ContextSnippetGenerator $generator, TranslatorInterface $translator)
{
Expand All @@ -59,12 +57,16 @@ public function configure(SymfonyCommand $command)
{
$command
->addOption(
'--snippets-for', null, InputOption::VALUE_OPTIONAL,
"Specifies which context class to generate snippets for."
'--snippets-for',
null,
InputOption::VALUE_OPTIONAL,
'Specifies which context class to generate snippets for.'
)
->addOption(
'--snippets-type', null, InputOption::VALUE_REQUIRED,
"Specifies which type of snippets (turnip, regex) to generate."
'--snippets-type',
null,
InputOption::VALUE_REQUIRED,
'Specifies which type of snippets (turnip, regex) to generate.'
);
}

Expand All @@ -74,18 +76,18 @@ public function configure(SymfonyCommand $command)
public function execute(InputInterface $input, OutputInterface $output)
{
$this->generator->setContextIdentifier(
new AggregateContextIdentifier(array(
new AggregateContextIdentifier([
new ContextInterfaceBasedContextIdentifier(),
new FixedContextIdentifier($input->getOption('snippets-for')),
new InteractiveContextIdentifier($this->translator, $input, $output)
))
new InteractiveContextIdentifier($this->translator, $input, $output),
])
);

$this->generator->setPatternIdentifier(
new AggregatePatternIdentifier(array(
new AggregatePatternIdentifier([
new ContextInterfaceBasedPatternIdentifier(),
new FixedPatternIdentifier($input->getOption('snippets-type'))
))
new FixedPatternIdentifier($input->getOption('snippets-type')),
])
);
}
}
10 changes: 4 additions & 6 deletions src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,19 @@ final class InteractiveContextIdentifier implements TargetContextIdentifier
* @var TranslatorInterface
*/
private $translator;

/**
* @var InputInterface
*/
private $input;

/**
* @var OutputInterface
*/
private $output;

/**
* Initialises identifier.
*
* @param TranslatorInterface $translator
* @param InputInterface $input
* @param OutputInterface $output
*/
public function __construct(TranslatorInterface $translator, InputInterface $input, OutputInterface $output)
{
Expand All @@ -68,8 +66,8 @@ public function guessTargetContextClass(ContextEnvironment $environment)
return null;
}

$message = $this->translator->trans('snippet_context_choice', array('%count%' => $suiteName), 'output');
$choices = array_values(array_merge(array('None'), $contextClasses));
$message = $this->translator->trans('snippet_context_choice', ['%count%' => $suiteName], 'output');
$choices = array_values(array_merge(['None'], $contextClasses));
$default = 1;

$answer = $this->askQuestion('>> ' . $message, $choices, $default);
Expand Down
2 changes: 0 additions & 2 deletions src/Behat/Behat/Context/ContextClass/ClassGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ interface ClassGenerator
/**
* Checks if generator supports provided context class.
*
* @param Suite $suite
* @param string $contextClass
*
* @return bool
Expand All @@ -35,7 +34,6 @@ public function supportsSuiteAndClass(Suite $suite, $contextClass);
/**
* Generates context class code.
*
* @param Suite $suite
* @param string $contextClass
*
* @return string The context class source code
Expand Down
6 changes: 3 additions & 3 deletions src/Behat/Behat/Context/ContextClass/SimpleClassGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class SimpleClassGenerator implements ClassGenerator
/**
* @var string
*/
protected static $template = <<<'PHP'
private static $template = <<<'PHP'
<?php
{namespace}use Behat\Behat\Context\Context;
Expand Down Expand Up @@ -71,10 +71,10 @@ public function generateClass(Suite $suite, $contextClass)

return strtr(
static::$template,
array(
[
'{namespace}' => $namespace,
'{className}' => $contextClass,
)
]
);
}
}
Loading

0 comments on commit 59dbff8

Please sign in to comment.