From 50418cda39de0aefa9976e04caa339518512d001 Mon Sep 17 00:00:00 2001 From: sv3n Date: Fri, 23 Dec 2022 21:49:52 +0100 Subject: [PATCH] Change OpenMage version compare (#2839) --- app/Mage.php | 12 +++++++++--- phpstan.dist.neon | 5 ----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/Mage.php b/app/Mage.php index 5ca97358484..49da26b78d3 100644 --- a/app/Mage.php +++ b/app/Mage.php @@ -202,15 +202,13 @@ public static function getOpenMageVersion() */ public static function getOpenMageVersionInfo() { - $majorVersion = 19; - /** * This code construct is to make merging for forward porting of changes easier. * By having the version numbers of different branches in own lines, they do not provoke a merge conflict * also as releases are usually done together, this could in theory be done at once. * The major Version then needs to be only changed once per branch. */ - if ($majorVersion === 20) { + if (self::getOpenMageMajorVersion() === 20) { return [ 'major' => '20', 'minor' => '1', @@ -229,6 +227,14 @@ public static function getOpenMageVersionInfo() ]; } + /** + * @return int<19,20> + */ + public static function getOpenMageMajorVersion(): int + { + return 19; + } + /** * Get current Magento edition * diff --git a/phpstan.dist.neon b/phpstan.dist.neon index 4d8d8c3be7a..0d7289d7404 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -70,11 +70,6 @@ parameters: # Instantiated class not found - lib/Varien/Image/Adapter.php - ignoreErrors: - # OpenMage version comparison - - - message: "#^Strict comparison using \\=\\=\\= between 19 and 20 will always evaluate to false\\.$#" - path: app/Mage.php level: 4 checkFunctionNameCase: true checkInternalClassCaseSensitivity: true