Skip to content

Commit e527747

Browse files
committed
Interface operation extend from Delta
1 parent 50b291d commit e527747

File tree

2 files changed

+52
-46
lines changed

2 files changed

+52
-46
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
namespace PHPSemVerChecker\Operation;
4+
5+
use PhpParser\Node\Stmt\Interface_;
6+
use PHPSemVerChecker\Node\Statement\Interface_ as PInterface;
7+
8+
class InterfaceOperationUnary extends Operation {
9+
/**
10+
* @var string
11+
*/
12+
protected $file;
13+
/**
14+
* @var \PhpParser\Node\Stmt\Interface_
15+
*/
16+
protected $interface;
17+
18+
/**
19+
* @param string $fileAfter
20+
* @param \PhpParser\Node\Stmt\Interface_ $interface
21+
*/
22+
public function __construct($fileAfter, Interface_ $interface)
23+
{
24+
$this->file = $fileAfter;
25+
$this->interface = $interface;
26+
}
27+
28+
/**
29+
* @return string
30+
*/
31+
public function getLocation()
32+
{
33+
return $this->file;
34+
}
35+
36+
/**
37+
* @return int
38+
*/
39+
public function getLine()
40+
{
41+
return $this->interface->getLine();
42+
}
43+
44+
/**
45+
* @return string
46+
*/
47+
public function getTarget()
48+
{
49+
return PInterface::getFullyQualifiedName($this->interface);
50+
}
51+
}

src/PHPSemVerChecker/Operation/InterfaceRenamedCaseOnly.php

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
namespace PHPSemVerChecker\Operation;
44

5-
use PhpParser\Node\Stmt\Interface_;
6-
use PHPSemVerChecker\Node\Statement\Interface_ as PInterface;
7-
8-
class InterfaceRenamedCaseOnly extends Operation {
5+
class InterfaceRenamedCaseOnly extends InterfaceOperationDelta {
96
/**
107
* @var string
118
*/
@@ -14,46 +11,4 @@ class InterfaceRenamedCaseOnly extends Operation {
1411
* @var string
1512
*/
1613
protected $reason = 'Interface was renamed (case only).';
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_ $interfaceAfter
29-
*/
30-
public function __construct($fileAfter, Interface_ $interfaceAfter)
31-
{
32-
$this->fileAfter = $fileAfter;
33-
$this->interfaceAfter = $interfaceAfter;
34-
}
35-
36-
/**
37-
* @return string
38-
*/
39-
public function getLocation()
40-
{
41-
return $this->fileAfter;
42-
}
43-
44-
/**
45-
* @return int
46-
*/
47-
public function getLine()
48-
{
49-
return $this->interfaceAfter->getLine();
50-
}
51-
52-
/**
53-
* @return string
54-
*/
55-
public function getTarget()
56-
{
57-
return PInterface::getFullyQualifiedName($this->interfaceAfter);
58-
}
5914
}

0 commit comments

Comments
 (0)