| @@ 8-71 (lines=64) @@ | ||
| 5 | use PhpParser\Node\Stmt\Function_; |
|
| 6 | use PHPSemVerChecker\Node\Statement\Function_ as PFunction; |
|
| 7 | ||
| 8 | class FunctionImplementationChanged extends Operation { |
|
| 9 | /** |
|
| 10 | * @var string |
|
| 11 | */ |
|
| 12 | protected $code = 'V004'; |
|
| 13 | /** |
|
| 14 | * @var string |
|
| 15 | */ |
|
| 16 | protected $reason = 'Function implementation changed.'; |
|
| 17 | /** |
|
| 18 | * @var \PhpParser\Node\Stmt\Function_ |
|
| 19 | */ |
|
| 20 | protected $functionAfter; |
|
| 21 | /** |
|
| 22 | * @var string |
|
| 23 | */ |
|
| 24 | protected $fileAfter; |
|
| 25 | /** |
|
| 26 | * @var \PhpParser\Node\Stmt\Function_ |
|
| 27 | */ |
|
| 28 | protected $functionBefore; |
|
| 29 | /** |
|
| 30 | * @var string |
|
| 31 | */ |
|
| 32 | protected $fileBefore; |
|
| 33 | ||
| 34 | /** |
|
| 35 | * @param string $fileBefore |
|
| 36 | * @param \PhpParser\Node\Stmt\Function_ $functionBefore |
|
| 37 | * @param string $fileAfter |
|
| 38 | * @param \PhpParser\Node\Stmt\Function_ $functionAfter |
|
| 39 | */ |
|
| 40 | public function __construct($fileBefore, Function_ $functionBefore, $fileAfter, Function_ $functionAfter) |
|
| 41 | { |
|
| 42 | $this->functionAfter = $functionAfter; |
|
| 43 | $this->fileAfter = $fileAfter; |
|
| 44 | $this->functionBefore = $functionBefore; |
|
| 45 | $this->fileBefore = $fileBefore; |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * @return string |
|
| 50 | */ |
|
| 51 | public function getLocation() |
|
| 52 | { |
|
| 53 | return $this->fileAfter; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * @return int |
|
| 58 | */ |
|
| 59 | public function getLine() |
|
| 60 | { |
|
| 61 | return $this->functionAfter->getLine(); |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * @return string |
|
| 66 | */ |
|
| 67 | public function getTarget() |
|
| 68 | { |
|
| 69 | return PFunction::getFullyQualifiedName($this->functionAfter); |
|
| 70 | } |
|
| 71 | } |
|
| 72 | ||
| @@ 8-71 (lines=64) @@ | ||
| 5 | use PhpParser\Node\Stmt\Function_; |
|
| 6 | use PHPSemVerChecker\Node\Statement\Function_ as PFunction; |
|
| 7 | ||
| 8 | class FunctionParameterChanged extends Operation { |
|
| 9 | /** |
|
| 10 | * @var string |
|
| 11 | */ |
|
| 12 | protected $code = 'V002'; |
|
| 13 | /** |
|
| 14 | * @var string |
|
| 15 | */ |
|
| 16 | protected $reason = 'Function parameter changed.'; |
|
| 17 | /** |
|
| 18 | * @var string |
|
| 19 | */ |
|
| 20 | protected $fileBefore; |
|
| 21 | /** |
|
| 22 | * @var \PhpParser\Node\Stmt\Function_ |
|
| 23 | */ |
|
| 24 | protected $functionBefore; |
|
| 25 | /** |
|
| 26 | * @var string |
|
| 27 | */ |
|
| 28 | protected $fileAfter; |
|
| 29 | /** |
|
| 30 | * @var \PhpParser\Node\Stmt\Function_ |
|
| 31 | */ |
|
| 32 | protected $functionAfter; |
|
| 33 | ||
| 34 | /** |
|
| 35 | * @param string $fileBefore |
|
| 36 | * @param \PhpParser\Node\Stmt\Function_ $functionBefore |
|
| 37 | * @param string $fileAfter |
|
| 38 | * @param \PhpParser\Node\Stmt\Function_ $functionAfter |
|
| 39 | */ |
|
| 40 | public function __construct($fileBefore, Function_ $functionBefore, $fileAfter, Function_ $functionAfter) |
|
| 41 | { |
|
| 42 | $this->fileBefore = $fileBefore; |
|
| 43 | $this->functionBefore = $functionBefore; |
|
| 44 | $this->fileAfter = $fileAfter; |
|
| 45 | $this->functionAfter = $functionAfter; |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * @return string |
|
| 50 | */ |
|
| 51 | public function getLocation() |
|
| 52 | { |
|
| 53 | return $this->fileBefore; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * @return int |
|
| 58 | */ |
|
| 59 | public function getLine() |
|
| 60 | { |
|
| 61 | return $this->functionAfter->getLine(); |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * @return string |
|
| 66 | */ |
|
| 67 | public function getTarget() |
|
| 68 | { |
|
| 69 | return PFunction::getFullyQualifiedName($this->functionAfter); |
|
| 70 | } |
|
| 71 | } |
|
| 72 | ||
| @@ 8-71 (lines=64) @@ | ||
| 5 | use PhpParser\Node\Stmt\Function_; |
|
| 6 | use PHPSemVerChecker\Node\Statement\Function_ as PFunction; |
|
| 7 | ||
| 8 | class FunctionParameterNameChanged extends Operation { |
|
| 9 | /** |
|
| 10 | * @var string |
|
| 11 | */ |
|
| 12 | protected $code = 'V067'; |
|
| 13 | /** |
|
| 14 | * @var string |
|
| 15 | */ |
|
| 16 | protected $reason = 'Function parameter name changed.'; |
|
| 17 | /** |
|
| 18 | * @var string |
|
| 19 | */ |
|
| 20 | protected $fileBefore; |
|
| 21 | /** |
|
| 22 | * @var \PhpParser\Node\Stmt\Function_ |
|
| 23 | */ |
|
| 24 | protected $functionBefore; |
|
| 25 | /** |
|
| 26 | * @var string |
|
| 27 | */ |
|
| 28 | protected $fileAfter; |
|
| 29 | /** |
|
| 30 | * @var \PhpParser\Node\Stmt\Function_ |
|
| 31 | */ |
|
| 32 | protected $functionAfter; |
|
| 33 | ||
| 34 | /** |
|
| 35 | * @param string $fileBefore |
|
| 36 | * @param \PhpParser\Node\Stmt\Function_ $functionBefore |
|
| 37 | * @param string $fileAfter |
|
| 38 | * @param \PhpParser\Node\Stmt\Function_ $functionAfter |
|
| 39 | */ |
|
| 40 | public function __construct($fileBefore, Function_ $functionBefore, $fileAfter, Function_ $functionAfter) |
|
| 41 | { |
|
| 42 | $this->fileBefore = $fileBefore; |
|
| 43 | $this->functionBefore = $functionBefore; |
|
| 44 | $this->fileAfter = $fileAfter; |
|
| 45 | $this->functionAfter = $functionAfter; |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * @return string |
|
| 50 | */ |
|
| 51 | public function getLocation() |
|
| 52 | { |
|
| 53 | return $this->fileBefore; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * @return int |
|
| 58 | */ |
|
| 59 | public function getLine() |
|
| 60 | { |
|
| 61 | return $this->functionAfter->getLine(); |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * @return string |
|
| 66 | */ |
|
| 67 | public function getTarget() |
|
| 68 | { |
|
| 69 | return PFunction::getFullyQualifiedName($this->functionAfter); |
|
| 70 | } |
|
| 71 | } |
|
| 72 | ||