From d434b33075b4b6f3575660acfdb0daafd0b32515 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Mon, 9 Sep 2019 13:32:03 +0200 Subject: [PATCH] Fix issues identified by Psalm --- src/Util/Log/TeamCity.php | 4 ++-- src/Util/Test.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Util/Log/TeamCity.php b/src/Util/Log/TeamCity.php index 4e8f446c4d4..8958ef79068 100644 --- a/src/Util/Log/TeamCity.php +++ b/src/Util/Log/TeamCity.php @@ -212,7 +212,7 @@ public function startTestSuite(TestSuite $suite): void } else { $split = \explode('::', $suiteName); - if (\count($split) === 2 && \method_exists($split[0], $split[1])) { + if (\count($split) === 2 && \class_exists($split[0]) && \method_exists($split[0], $split[1])) { $fileName = self::getFileName($split[0]); $parameters['locationHint'] = "php_qn://$fileName::\\$suiteName"; $parameters['name'] = $split[1]; @@ -238,7 +238,7 @@ public function endTestSuite(TestSuite $suite): void if (!\class_exists($suiteName, false)) { $split = \explode('::', $suiteName); - if (\count($split) === 2 && \method_exists($split[0], $split[1])) { + if (\count($split) === 2 && \class_exists($split[0]) && \method_exists($split[0], $split[1])) { $parameters['name'] = $split[1]; } } diff --git a/src/Util/Test.php b/src/Util/Test.php index 579d1671e08..f583f593bd7 100644 --- a/src/Util/Test.php +++ b/src/Util/Test.php @@ -293,7 +293,7 @@ public static function getMissingRequirements(string $className, string $methodN foreach ($required['functions'] as $function) { $pieces = \explode('::', $function); - if (\count($pieces) === 2 && \method_exists($pieces[0], $pieces[1])) { + if (\count($pieces) === 2 && \class_exists($pieces[0]) && \method_exists($pieces[0], $pieces[1])) { continue; }