| @@ 10-29 (lines=20) @@ | ||
| 7 | use StaticReview\Review\AbstractFileReview; |
|
| 8 | use StaticReview\Review\ReviewableInterface; |
|
| 9 | ||
| 10 | class DdReview extends AbstractFileReview |
|
| 11 | { |
|
| 12 | public function canReviewFile(FileInterface $file) |
|
| 13 | { |
|
| 14 | $extension = $file->getExtension(); |
|
| 15 | return ($extension === 'php' || $extension === 'phtml'); |
|
| 16 | } |
|
| 17 | ||
| 18 | public function review(ReporterInterface $reporter, ReviewableInterface $file) |
|
| 19 | { |
|
| 20 | $cmd = sprintf('grep --fixed-strings --ignore-case --quiet "dd" %s', $file->getFullPath()); |
|
| 21 | $process = $this->getProcess($cmd); |
|
| 22 | $process->run(); |
|
| 23 | ||
| 24 | if ($process->isSuccessful()) { |
|
| 25 | $message = 'A call to `dd()` was found'; |
|
| 26 | $reporter->error($message, $this, $file); |
|
| 27 | } |
|
| 28 | } |
|
| 29 | } |
|
| 30 | ||
| @@ 10-29 (lines=20) @@ | ||
| 7 | use StaticReview\Review\AbstractFileReview; |
|
| 8 | use StaticReview\Review\ReviewableInterface; |
|
| 9 | ||
| 10 | class VarDumpReview extends AbstractFileReview |
|
| 11 | { |
|
| 12 | public function canReviewFile(FileInterface $file) |
|
| 13 | { |
|
| 14 | $extension = $file->getExtension(); |
|
| 15 | return ($extension === 'php' || $extension === 'phtml'); |
|
| 16 | } |
|
| 17 | ||
| 18 | public function review(ReporterInterface $reporter, ReviewableInterface $file) |
|
| 19 | { |
|
| 20 | $cmd = sprintf('grep --fixed-strings --ignore-case --quiet "var_dump" %s', $file->getFullPath()); |
|
| 21 | $process = $this->getProcess($cmd); |
|
| 22 | $process->run(); |
|
| 23 | ||
| 24 | if ($process->isSuccessful()) { |
|
| 25 | $message = 'A call to `var_dump()` was found'; |
|
| 26 | $reporter->error($message, $this, $file); |
|
| 27 | } |
|
| 28 | } |
|
| 29 | } |
|
| 30 | ||