Remove inline @var annotations; fix spec session name; fix @var placement
- Replace all local-variable @var annotations with proper type guards:
- MinkExtension configure closure: build inner array directly
($sessions[$driverType] = [$driverType => ...]) to avoid mixed offset access
- MinkExtension loadSessions: add is_array($session) guard inside foreach
so PHPStan narrows $session from mixed to array before key() call
- DriverFactory::buildDriver @param broadened from array<string, mixed>
to array<mixed> — is_array() only narrows to array<mixed> (key type
unknown), so array<string, mixed> was unreachable at the call site
- MinkAwareInitializer: move @var from inside constructor parameter list
to a proper @param on the method docblock
- SessionsListenerSpec: replace 'goutte' (deleted driver) with
'browserkit_http' as the example default session name
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@ class SessionsListenerSpec extends ObjectBehavior
|
||||
{
|
||||
public function let(Mink $mink, ScenarioTested $event, FeatureNode $feature, ScenarioNode $scenario, Suite $suite)
|
||||
{
|
||||
$this->beConstructedWith($mink, 'goutte', 'selenium2', ['selenium2', 'sahi']);
|
||||
$this->beConstructedWith($mink, 'browserkit_http', 'selenium2', ['selenium2', 'sahi']);
|
||||
|
||||
$event->getSuite()->willReturn($suite);
|
||||
$event->getFeature()->willReturn($feature);
|
||||
@@ -38,7 +38,7 @@ class SessionsListenerSpec extends ObjectBehavior
|
||||
public function it_resets_the_default_session_before_scenarios($event, $mink)
|
||||
{
|
||||
$mink->resetSessions()->shouldBeCalled();
|
||||
$mink->setDefaultSessionName('goutte')->shouldBeCalled();
|
||||
$mink->setDefaultSessionName('browserkit_http')->shouldBeCalled();
|
||||
|
||||
$this->prepareDefaultMinkSession($event);
|
||||
}
|
||||
@@ -120,7 +120,7 @@ class SessionsListenerSpec extends ObjectBehavior
|
||||
public function it_fails_when_the_javascript_session_is_used_but_not_defined($event, $mink, $feature, $suite)
|
||||
{
|
||||
$suite->hasSetting('mink_javascript_session')->willReturn(false);
|
||||
$this->beConstructedWith($mink, 'goutte', null);
|
||||
$this->beConstructedWith($mink, 'browserkit_http', null);
|
||||
$feature->getTags()->willReturn(['javascript']);
|
||||
|
||||
$this->shouldThrow(new ProcessingException('The @javascript tag cannot be used without enabling a javascript session'))
|
||||
@@ -151,7 +151,7 @@ class SessionsListenerSpec extends ObjectBehavior
|
||||
{
|
||||
$scenario->hasTag('insulated')->willReturn(true);
|
||||
$mink->stopSessions()->shouldBeCalled();
|
||||
$mink->setDefaultSessionName('goutte')->shouldBeCalled();
|
||||
$mink->setDefaultSessionName('browserkit_http')->shouldBeCalled();
|
||||
|
||||
$this->prepareDefaultMinkSession($event);
|
||||
}
|
||||
@@ -160,7 +160,7 @@ class SessionsListenerSpec extends ObjectBehavior
|
||||
{
|
||||
$feature->hasTag('insulated')->willReturn(true);
|
||||
$mink->stopSessions()->shouldBeCalled();
|
||||
$mink->setDefaultSessionName('goutte')->shouldBeCalled();
|
||||
$mink->setDefaultSessionName('browserkit_http')->shouldBeCalled();
|
||||
|
||||
$this->prepareDefaultMinkSession($event);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user