Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 38 additions & 7 deletions src/PHPCensor/Plugin/PhpDocblockChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,48 @@ public function execute()

/**
* Report all of the errors we've encountered line-by-line.
* @param $output
* @param array $output
*/
protected function reportErrors($output)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class PHPCensor\Plugin\PhpDocblockChecker::reportErrors is missing a docblock.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^ Exactly 😁

{
foreach ($output as $error) {
$message = 'Class ' . $error['class'] . ' is missing a docblock.';
$severity = BuildError::SEVERITY_LOW;

if ($error['type'] == 'method') {
$message = $error['class'] . '::' . $error['method'] . ' is missing a docblock.';
$severity = BuildError::SEVERITY_NORMAL;
switch ($error['type']) {
case 'class':
$message = 'Class ' . $error['class'] . ' is missing a docblock.';
$severity = BuildError::SEVERITY_NORMAL;
break;

case 'method':
$message = $error['class'] . '::' . $error['method'] . ' is missing a docblock.';
$severity = BuildError::SEVERITY_NORMAL;
break;

case 'param-missing':
$message = $error['class'] . '::' . $error['method'] . ' @param ' . $error['param'] . ' missing.';
$severity = BuildError::SEVERITY_LOW;
break;

case 'param-mismatch':
$message = $error['class'] . '::' . $error['method'] . ' @param ' . $error['param'] .
'(' . $error['doc-type'] . ') does not match method signature (' . $error['param-type'] . ')';
$severity = BuildError::SEVERITY_LOW;
break;

case 'return-missing':
$message = $error['class'] . '::' . $error['method'] . ' @return missing.';
$severity = BuildError::SEVERITY_LOW;
break;

case 'return-mismatch':
$message = $error['class'] . '::' . $error['method'] . ' @return ' . $error['doc-type'] .
' does not match method signature (' . $error['return-type'] . ')';
$severity = BuildError::SEVERITY_LOW;
break;

default:
$message = 'Class ' . $error['class'] . ' invalid/missing a docblock.';
$severity = BuildError::SEVERITY_LOW;
break;
}

$this->build->reportError(
Expand Down