| @@ 8-59 (lines=52) @@ | ||
| 5 | use PhpParser\Node\Stmt\Class_; |
|
| 6 | use PHPSemVerChecker\Node\Statement\Class_ as PClass; |
|
| 7 | ||
| 8 | class ClassAdded extends Operation { |
|
| 9 | /** |
|
| 10 | * @var string |
|
| 11 | */ |
|
| 12 | protected $code = 'V014'; |
|
| 13 | /** |
|
| 14 | * @var string |
|
| 15 | */ |
|
| 16 | protected $reason = 'Class was added.'; |
|
| 17 | /** |
|
| 18 | * @var string |
|
| 19 | */ |
|
| 20 | protected $fileAfter; |
|
| 21 | /** |
|
| 22 | * @var \PhpParser\Node\Stmt\Class_ |
|
| 23 | */ |
|
| 24 | protected $classAfter; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @param string $fileAfter |
|
| 28 | * @param \PhpParser\Node\Stmt\Class_ $classAfter |
|
| 29 | */ |
|
| 30 | public function __construct($fileAfter, Class_ $classAfter) |
|
| 31 | { |
|
| 32 | $this->fileAfter = $fileAfter; |
|
| 33 | $this->classAfter = $classAfter; |
|
| 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->classAfter->getLine(); |
|
| 50 | } |
|
| 51 | ||
| 52 | /** |
|
| 53 | * @return string |
|
| 54 | */ |
|
| 55 | public function getTarget() |
|
| 56 | { |
|
| 57 | return PClass::getFullyQualifiedName($this->classAfter); |
|
| 58 | } |
|
| 59 | } |
|
| 60 | ||
| @@ 8-59 (lines=52) @@ | ||
| 5 | use PhpParser\Node\Stmt\Class_; |
|
| 6 | use PHPSemVerChecker\Node\Statement\Class_ as PClass; |
|
| 7 | ||
| 8 | class ClassRenamedCaseOnly extends Operation { |
|
| 9 | /** |
|
| 10 | * @var string |
|
| 11 | */ |
|
| 12 | protected $code = 'V154'; |
|
| 13 | /** |
|
| 14 | * @var string |
|
| 15 | */ |
|
| 16 | protected $reason = 'Class was renamed (case only).'; |
|
| 17 | /** |
|
| 18 | * @var string |
|
| 19 | */ |
|
| 20 | protected $fileAfter; |
|
| 21 | /** |
|
| 22 | * @var \PhpParser\Node\Stmt\Class_ |
|
| 23 | */ |
|
| 24 | protected $classAfter; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @param string $fileAfter |
|
| 28 | * @param \PhpParser\Node\Stmt\Class_ $classAfter |
|
| 29 | */ |
|
| 30 | public function __construct($fileAfter, Class_ $classAfter) |
|
| 31 | { |
|
| 32 | $this->fileAfter = $fileAfter; |
|
| 33 | $this->classAfter = $classAfter; |
|
| 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->classAfter->getLine(); |
|
| 50 | } |
|
| 51 | ||
| 52 | /** |
|
| 53 | * @return string |
|
| 54 | */ |
|
| 55 | public function getTarget() |
|
| 56 | { |
|
| 57 | return PClass::getFullyQualifiedName($this->classAfter); |
|
| 58 | } |
|
| 59 | } |
|
| 60 | ||