Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpstan: Change OpenMage version compare #2839

Merged
merged 1 commit into from
Dec 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -229,6 +227,14 @@ public static function getOpenMageVersionInfo()
];
}

/**
* @return int<19,20>
*/
public static function getOpenMageMajorVersion(): int
{
return 19;
}

/**
* Get current Magento edition
*
Expand Down
5 changes: 0 additions & 5 deletions phpstan.dist.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down