Fixed PHPDockblockChecker for PHP 7.2. Issue #170.

This commit is contained in:
Dmitry Khomutov 2018-04-20 07:37:02 +07:00
parent 0ad9bd836e
commit 3cebeb784e
No known key found for this signature in database
GPG key ID: EC19426474B37AAC

View file

@ -133,12 +133,17 @@ class PhpDocblockChecker extends Plugin implements ZeroConfigPluginInterface
// Re-enable exec output logging:
$this->builder->logExecOutput(true);
$output = json_decode($this->builder->getLastOutput(), true);
$errors = count($output);
$success = true;
$output = json_decode($this->builder->getLastOutput(), true);
$errors = 0;
if ($output && is_array($output)) {
$errors = count($output);
$this->reportErrors($output);
}
$this->build->storeMeta('phpdoccheck-warnings', $errors);
$this->reportErrors($output);
$success = true;
if ($this->allowedWarnings != -1 && $errors > $this->allowedWarnings) {
$success = false;
@ -151,7 +156,7 @@ class PhpDocblockChecker extends Plugin implements ZeroConfigPluginInterface
* Report all of the errors we've encountered line-by-line.
* @param array $output
*/
protected function reportErrors($output)
protected function reportErrors(array $output)
{
foreach ($output as $error) {
switch ($error['type']) {