1 | <?php |
||
20 | final class KernelAwareClassGenerator implements ClassGenerator |
||
21 | { |
||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private static $template = <<<'PHP' |
||
26 | <?php |
||
27 | |||
28 | {namespace}use Behat\Behat\Context\SnippetAcceptingContext; |
||
29 | use Behat\Gherkin\Node\PyStringNode; |
||
30 | use Behat\Gherkin\Node\TableNode; |
||
31 | use Behat\Symfony2Extension\Context\KernelAwareContext; |
||
32 | use Symfony\Component\HttpKernel\KernelInterface; |
||
33 | |||
34 | /** |
||
35 | * Behat context class. |
||
36 | */ |
||
37 | class {className} implements SnippetAcceptingContext, KernelAwareContext |
||
38 | { |
||
39 | /** |
||
40 | * @var KernelInterface |
||
41 | */ |
||
42 | private $kernel; |
||
43 | |||
44 | /** |
||
45 | * Sets Kernel instance. |
||
46 | * This method will be automatically called by Symfony2Extension ContextInitializer. |
||
47 | * |
||
48 | * @param KernelInterface $kernel |
||
49 | */ |
||
50 | public function setKernel(KernelInterface $kernel) |
||
51 | { |
||
52 | $this->kernel = $kernel; |
||
53 | } |
||
54 | } |
||
55 | |||
56 | PHP; |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | public function supportsSuiteAndClass(Suite $suite, $classname) |
||
65 | |||
66 | /** |
||
67 | * {@inheritdoc} |
||
68 | */ |
||
69 | public function generateClass(Suite $suite, $contextClass) |
||
87 | } |
||
88 |
Late static binding only has effect in subclasses. A
final
class cannot be extended anymore so late static binding cannot occurr. Consider replacingstatic::
withself::
.To learn more about late static binding, please refer to the PHP core documentation.