GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 66c291...444f0e )
by Bruno
03:49
created

PlaceholdersTransformer::transformArgument()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 8
nc 2
nop 3
1
<?php
2
3
namespace Ciandt\Behat\PlaceholdersExtension\Transformer;
4
5
use Behat\Behat\Transformation\Transformer\ArgumentTransformer;
6
use Ciandt\Behat\PlaceholdersExtension\PlaceholderContainer\PlaceholderContainerStepNode;
7
use Ciandt\Behat\PlaceholdersExtension\Transformation\RuntimePlaceholdersTransformation;
8
use Behat\Behat\Definition\Call\DefinitionCall;
9
use Ciandt\Behat\PlaceholdersExtension\Config\PlaceholdersRepository;
10
11
/**
12
 * Transforms a single argument value.
13
14
 */
15
class PlaceholdersTransformer implements ArgumentTransformer
16
{
17
    
18
    private $placeholdersRepository;
19
    
20
    public function __construct(PlaceholdersRepository $placeholdersRepository) {
21
        $this->placeholdersRepository = $placeholdersRepository;
22
    }
23
24
    
25
    public function supportsDefinitionAndArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue) {
26
        return RuntimePlaceholdersTransformation::supportsDefinitionAndArgument($definitionCall, $argumentValue);        
27
    }
28
29
    public function transformArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue) {
30
        $transformedArgument = $argumentValue;
31
        if (RuntimePlaceholdersTransformation::supportsDefinitionAndArgument($definitionCall, $argumentValue)){
32
            $transformedArgument = RuntimePlaceholdersTransformation::transformArgument(
33
                    $transformedArgument,
34
                    $this->placeholdersRepository,
35
                    $definitionCall->getStep());
0 ignored issues
show
Documentation introduced by
$definitionCall->getStep() is of type object<Behat\Gherkin\Node\StepNode>, but the function expects a object<Ciandt\Behat\Plac...r\PlaceholderContainer>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
36
        }
37
        
38
        return $transformedArgument;
39
    }
40
41
}
42