Commit e6048459 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

Issue #3193835 by Gábor Hojtsy, mrweiner, joachim, theterencechan, sker101,...

Issue #3193835 by Gábor Hojtsy, mrweiner, joachim, theterencechan, sker101, dmitry.korhov: Warning: Illegal string offset 'messages' in Drupal\upgrade_status\ScanResultFormatter->formatResult()
parent b0d5e092
......@@ -276,13 +276,19 @@ final class DeprecationAnalyzer {
$this->logger->error('PHPStan failed: %results', ['%results' => print_r($output, TRUE)]);
$json = [
'files' => [
'PHPStan failed' => 'PHP API deprecations cannot be checked. Reason: ' . print_r($output, TRUE),
'line' => 0,
],
'totals' => [
'errors' => 1,
'file_errors' => 1,
],
// Add a failure message with the nonexistent 'PHPStan failed'
// filename, so the error conforms to the expected format.
'PHPStan failed' => [
'messages' => [
'message' => 'PHP API deprecations cannot be checked. Reason: ' . print_r($output, TRUE),
'line' => 0,
],
]
],
'totals' => [
'errors' => 1,
'file_errors' => 1,
],
];
}
$result = [
......@@ -396,36 +402,34 @@ final class DeprecationAnalyzer {
$result['data']['totals']['upgrade_status_next'] = ProjectCollector::NEXT_RELAX;
foreach ($result['data']['files'] as $path => &$errors) {
if (!empty($errors['messages'])) {
foreach ($errors['messages'] as &$error) {
// Overwrite message with processed text. Save category.
[$message, $category] = $this->categorizeMessage($error['message'], $extension);
$error['message'] = $message;
$error['upgrade_status_category'] = $category;
// If the category was 'rector' that means at least one error was
// identified as covered by rector, so next step should be to run
// rector on this project.
if ($category == 'rector') {
$result['data']['totals']['upgrade_status_next'] = ProjectCollector::NEXT_RECTOR;
}
// If the category was not rector, if the next step is still to
// relax, modify that to fix manually.
elseif ($result['data']['totals']['upgrade_status_next'] == ProjectCollector::NEXT_RELAX) {
$result['data']['totals']['upgrade_status_next'] = ProjectCollector::NEXT_MANUAL;
}
foreach ($errors['messages'] as &$error) {
// Overwrite message with processed text. Save category.
[$message, $category] = $this->categorizeMessage($error['message'], $extension);
$error['message'] = $message;
$error['upgrade_status_category'] = $category;
// If the category was 'rector' that means at least one error was
// identified as covered by rector, so next step should be to run
// rector on this project.
if ($category == 'rector') {
$result['data']['totals']['upgrade_status_next'] = ProjectCollector::NEXT_RECTOR;
}
// If the category was not rector, if the next step is still to
// relax, modify that to fix manually.
elseif ($result['data']['totals']['upgrade_status_next'] == ProjectCollector::NEXT_RELAX) {
$result['data']['totals']['upgrade_status_next'] = ProjectCollector::NEXT_MANUAL;
}
// Sum up the error based on the category it ended up in. Split the
// categories into two high level buckets needing attention now or
// later for Drupal 9 compatibility. Ignore Drupal 10 here.
@$result['data']['totals']['upgrade_status_category'][$category]++;
if (in_array($category, ['safe', 'old', 'rector'])) {
@$result['data']['totals']['upgrade_status_split']['error']++;
}
elseif (in_array($category, ['later', 'uncategorized'])) {
@$result['data']['totals']['upgrade_status_split']['warning']++;
}
// Sum up the error based on the category it ended up in. Split the
// categories into two high level buckets needing attention now or
// later for Drupal 9 compatibility. Ignore Drupal 10 here.
@$result['data']['totals']['upgrade_status_category'][$category]++;
if (in_array($category, ['safe', 'old', 'rector'])) {
@$result['data']['totals']['upgrade_status_split']['error']++;
}
elseif (in_array($category, ['later', 'uncategorized'])) {
@$result['data']['totals']['upgrade_status_split']['warning']++;
}
}
}
......
......@@ -63,3 +63,10 @@ function upgrade_status_update_8101() {
function upgrade_status_update_8301() {
\Drupal::keyValue('upgrade_status_scan_results')->deleteAll();
}
/**
* Delete state, because PHPStan fail state was incorrectly formatted.
*/
function upgrade_status_update_8302() {
\Drupal::keyValue('upgrade_status_scan_results')->deleteAll();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment