1313use Behat \Behat \Hook \Scope \AfterFeatureScope ;
1414use Behat \Behat \Hook \Scope \BeforeFeatureScope ;
1515use Behat \Behat \Hook \Scope \BeforeStepScope ;
16+ use Behat \Hook \AfterFeature ;
17+ use Behat \Hook \AfterScenario ;
18+ use Behat \Hook \AfterSuite ;
19+ use Behat \Hook \BeforeFeature ;
20+ use Behat \Hook \BeforeScenario ;
21+ use Behat \Hook \BeforeStep ;
22+ use Behat \Hook \BeforeSuite ;
1623use SebastianBergmann \CodeCoverage \Report \Clover ;
1724use SebastianBergmann \CodeCoverage \Driver \Selector ;
1825use SebastianBergmann \CodeCoverage \Driver \Xdebug ;
3138/**
3239 * Features context.
3340 */
34- class FeatureContext implements Context {
41+ class FeatureContext implements Context, LegacyAnnotations {
3542
3643 use GivenStepDefinitions;
3744 use ThenStepDefinitions;
@@ -261,38 +268,28 @@ class FeatureContext implements Context {
261268 */
262269 private $ step_line = 0 ;
263270
264- /**
265- * @BeforeFeature
266- */
271+ #[BeforeFeature]
267272 public static function store_feature ( BeforeFeatureScope $ scope ): void {
268273 self ::$ feature = $ scope ->getFeature ();
269274 }
270275
271- /**
272- * @BeforeScenario
273- */
276+ #[BeforeScenario]
274277 public function store_scenario ( BeforeScenarioScope $ scope ): void {
275278 $ this ->scenario = $ scope ->getScenario ();
276279 }
277280
278- /**
279- * @BeforeStep
280- */
281+ #[BeforeStep]
281282 public function store_step ( BeforeStepScope $ scope ): void {
282283 $ this ->step_line = $ scope ->getStep ()->getLine ();
283284 }
284285
285- /**
286- * @AfterScenario
287- */
286+ #[AfterScenario]
288287 public function forget_scenario ( AfterScenarioScope $ scope ): void {
289288 $ this ->step_line = 0 ;
290289 $ this ->scenario = null ;
291290 }
292291
293- /**
294- * @AfterFeature
295- */
292+ #[AfterFeature]
296293 public static function forget_feature ( AfterFeatureScope $ scope ): void {
297294 self ::$ feature = null ;
298295 }
@@ -1105,9 +1102,7 @@ private static function cache_wp_files( $version = '' ): void {
11051102 self ::$ cache_dir = $ cache_dir ;
11061103 }
11071104
1108- /**
1109- * @BeforeSuite
1110- */
1105+ #[BeforeSuite]
11111106 public static function prepare ( BeforeSuiteScope $ scope ): void {
11121107 self ::bootstrap_feature_context ();
11131108
@@ -1141,9 +1136,7 @@ public static function prepare( BeforeSuiteScope $scope ): void {
11411136 }
11421137 }
11431138
1144- /**
1145- * @AfterSuite
1146- */
1139+ #[AfterSuite]
11471140 public static function afterSuite ( AfterSuiteScope $ scope ): void {
11481141 if ( self ::$ composer_local_repository ) {
11491142 self ::remove_dir ( self ::$ composer_local_repository );
@@ -1157,9 +1150,7 @@ public static function afterSuite( AfterSuiteScope $scope ): void {
11571150 self ::merge_coverage_reports ();
11581151 }
11591152
1160- /**
1161- * @BeforeScenario
1162- */
1153+ #[BeforeScenario]
11631154 public function beforeScenario ( BeforeScenarioScope $ scope ): void {
11641155 if ( self ::$ log_run_times ) {
11651156 self ::log_run_times_before_scenario ( $ scope );
@@ -1182,9 +1173,7 @@ public function beforeScenario( BeforeScenarioScope $scope ): void {
11821173 }
11831174 }
11841175
1185- /**
1186- * @AfterScenario
1187- */
1176+ #[AfterScenario]
11881177 public function afterScenario ( AfterScenarioScope $ scope ): void {
11891178
11901179 if ( self ::$ run_dir ) {
0 commit comments