2
2
3
3
namespace PHPSemVerChecker \Operation ;
4
4
5
+ use PhpParser \Node \Stmt \Class_ ;
5
6
use PhpParser \Node \Stmt \ClassMethod ;
6
7
7
8
class ClassMethodImplementationChanged extends Operation {
@@ -12,31 +13,43 @@ class ClassMethodImplementationChanged extends Operation {
12
13
/**
13
14
* @var string
14
15
*/
15
- private $ fileBefore ;
16
+ protected $ fileBefore ;
17
+ /**
18
+ * @var \PhpParser\Node\Stmt\Class_
19
+ */
20
+ protected $ classBefore ;
16
21
/**
17
22
* @var \PhpParser\Node\Stmt\ClassMethod
18
23
*/
19
- private $ classMethodBefore ;
24
+ protected $ classMethodBefore ;
20
25
/**
21
26
* @var string
22
27
*/
23
- private $ fileAfter ;
28
+ protected $ fileAfter ;
29
+ /**
30
+ * @var \PhpParser\Node\Stmt\Class_
31
+ */
32
+ protected $ classAfter ;
24
33
/**
25
34
* @var \PhpParser\Node\Stmt\ClassMethod
26
35
*/
27
- private $ classMethodAfter ;
36
+ protected $ classMethodAfter ;
28
37
29
38
/**
30
39
* @param string $fileBefore
40
+ * @param \PhpParser\Node\Stmt\Class_ $classBefore
31
41
* @param \PhpParser\Node\Stmt\ClassMethod $classMethodBefore
32
42
* @param string $fileAfter
43
+ * @param \PhpParser\Node\Stmt\Class_ $classAfter
33
44
* @param \PhpParser\Node\Stmt\ClassMethod $classMethodAfter
34
45
*/
35
- public function __construct ($ fileBefore , ClassMethod $ classMethodBefore , $ fileAfter , ClassMethod $ classMethodAfter )
46
+ public function __construct ($ fileBefore , Class_ $ classBefore , ClassMethod $ classMethodBefore , $ fileAfter, Class_ $ classAfter , ClassMethod $ classMethodAfter )
36
47
{
37
48
$ this ->fileBefore = $ fileBefore ;
49
+ $ this ->classBefore = $ classBefore ;
38
50
$ this ->classMethodBefore = $ classMethodBefore ;
39
51
$ this ->fileAfter = $ fileAfter ;
52
+ $ this ->classAfter = $ classAfter ;
40
53
$ this ->classMethodAfter = $ classMethodAfter ;
41
54
}
42
55
@@ -45,6 +58,18 @@ public function __construct($fileBefore, ClassMethod $classMethodBefore, $fileAf
45
58
*/
46
59
public function getLocation ()
47
60
{
48
- return $ this ->fileAfter . '# ' . $ this ->classMethodAfter ->getLine () . ' ' . $ this ->classMethodAfter ->name ;
61
+ return $ this ->fileAfter . '# ' . $ this ->classMethodAfter ->getLine ();
62
+ }
63
+
64
+ /**
65
+ * @return string
66
+ */
67
+ public function getTarget ()
68
+ {
69
+ $ fqcn = $ this ->classAfter ->name ;
70
+ if ($ this ->classAfter ->namespacedName ) {
71
+ $ fqcn = $ this ->classAfter ->namespacedName ->toString ();
72
+ }
73
+ return $ fqcn . ':: ' . $ this ->classMethodBefore ->name ;
49
74
}
50
75
}
0 commit comments