From aab8eed2196786e3016089d4273f5e53db20068e Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Mon, 17 Feb 2020 19:06:37 -0500 Subject: [PATCH] Fix Phar-scoped issue checks --- scoper.inc.php | 4 ++-- src/Psalm/Config.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scoper.inc.php b/scoper.inc.php index c6d60fbae02..eed8a264b1c 100644 --- a/scoper.inc.php +++ b/scoper.inc.php @@ -28,8 +28,8 @@ function ($filePath, $prefix, $contents) { function ($filePath, $prefix, $contents) { if ($filePath === 'src/Psalm/Config.php') { return str_replace( - $prefix . '\Composer\Autoload\ClassLoader', - 'Composer\Autoload\ClassLoader', + [$prefix . '\Composer\Autoload\ClassLoader', '\'Psalm\\\\Issue\\\\\''], + ['Composer\Autoload\ClassLoader', '\'' . $prefix . '\\\\Psalm\\\\Issue\\\\\''], $contents ); } diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index 52aadcb057c..1981f03007f 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -1469,6 +1469,7 @@ public function getReportingLevelForFile($issue_type, $file_path) return $this->issue_handlers[$issue_type]->getReportingLevelForFile($file_path); } + // this string is replaced by scoper for Phars, so be careful $issue_class = 'Psalm\\Issue\\' . $issue_type; if (!class_exists($issue_class) || !is_a($issue_class, \Psalm\Issue\CodeIssue::class, true)) {