Add known property types to Behat context static properties
use Behat\Behat\Context\Context;
final class FeatureContext implements Context
{
- /**
- * @var SomeObject
- */
- public static $someStaticProperty;
+ public static ?SomeObject $someStaticProperty = null;
}
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\Class_\TypedStaticPropertyInBehatContextRector;
return RectorConfig::configure()
->withRules([
TypedStaticPropertyInBehatContextRector::class,
]);