Completed
Pull Request — master (#129)
by
unknown
01:24
created

TestClientInjectionContext   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 16
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A clientShouldBePassed() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Tests\Behat\Context;
6
7
use Behat\Behat\Context\Context;
8
use Symfony\Component\BrowserKit\AbstractBrowser;
9
10
final class TestClientInjectionContext implements Context
11
{
12
    private $client;
13
14
    public function __construct(AbstractBrowser $client)
15
    {
16
        $this->client = $client;
17
    }
18
19
    /** @Then the client should be passed */
20
    public function clientShouldBePassed(): void
21
    {
22
        assert(is_object($this->client));
23
        assert($this->client instanceof AbstractBrowser);
0 ignored issues
show
Bug introduced by
The class Symfony\Component\BrowserKit\AbstractBrowser does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
24
    }
25
}