Completed
Pull Request — master (#99)
by
unknown
02:14
created

InterfaceOperationDelta::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 7
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 7
loc 7
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 4
crap 1
1
<?php
2
3
namespace PHPSemVerChecker\Operation;
4
5
use PhpParser\Node\Stmt\Interface_;
6
use PHPSemVerChecker\Node\Statement\Interface_ as PInterface;
7
8 View Code Duplication
class InterfaceOperationDelta extends Operation {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
	/**
10
	 * @var string
11
	 */
12
	protected $fileBefore;
13
	/**
14
	 * @var \PhpParser\Node\Stmt\Interface_
15
	 */
16
	protected $interfaceBefore;
17
	/**
18
	 * @var string
19
	 */
20
	protected $fileAfter;
21
	/**
22
	 * @var \PhpParser\Node\Stmt\Interface_
23
	 */
24
	protected $interfaceAfter;
25
26
	/**
27
	 * @param string                          $fileAfter
28
	 * @param \PhpParser\Node\Stmt\Interface_ $interface
0 ignored issues
show
Documentation introduced by
There is no parameter named $interface. Did you maybe mean $interfaceBefore?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
29
	 */
30 1
	public function __construct($fileBefore, Interface_ $interfaceBefore, $fileAfter, Interface_ $interfaceAfter)
31
	{
32 1
		$this->fileBefore = $fileBefore;
33 1
		$this->interfaceBefore = $interfaceBefore;
34 1
		$this->fileAfter = $fileAfter;
35 1
		$this->interfaceAfter = $interfaceAfter;
36 1
	}
37
38
	/**
39
	 * @return string
40
	 */
41
	public function getLocation()
42
	{
43
		return $this->fileAfter;
44
	}
45
46
	/**
47
	 * @return int
48
	 */
49
	public function getLine()
50
	{
51
		return $this->interfaceAfter->getLine();
52
	}
53
54
	/**
55
	 * @return string
56
	 */
57
	public function getTarget()
58
	{
59
		return PInterface::getFullyQualifiedName($this->interfaceAfter);
60
	}
61
}
62