Skip to content
This repository has been archived by the owner on Dec 26, 2021. It is now read-only.

Commit

Permalink
capture php-parser errors
Browse files Browse the repository at this point in the history
  • Loading branch information
llaville committed Dec 11, 2017
1 parent 4f39fee commit 74e8204
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Bartlett/Reflect.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ function ($a) {
}
}

$files = array();
$files = $parserErrors = array();

// generate a data source identifier if not provided
if (!isset($this->dataSourceId)) {
Expand Down Expand Up @@ -307,6 +307,7 @@ function ($a) {
'error' => $e->getMessage()
)
);
$parserErrors[$file->getPathname()] = $e->getMessage();
continue; // skip to next file of the data source
}
}
Expand Down Expand Up @@ -338,6 +339,9 @@ function ($a) {
// list of files parsed
$metrics['files'] = $files;

// list of PHP-Parser errors
$metrics['errors'] = $parserErrors;

// collect metrics of each analyser selected
foreach ($this->analysers as $analyser) {
if ($analyser instanceof VisitorInterface) {
Expand Down

0 comments on commit 74e8204

Please sign in to comment.