Skip to content

Commit

Permalink
Fix improper version definition in prod env (introduced by ab5faf8)
Browse files Browse the repository at this point in the history
  • Loading branch information
flavioheleno committed Apr 10, 2023
1 parent 9512dca commit 98b32e9
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 221 deletions.
21 changes: 13 additions & 8 deletions bin/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,19 @@
$dotenv->safeLoad();
}

define(
'__VERSION__',
sprintf(
'%s@%s',
InstalledVersions::getPrettyVersion('package-health/php'),
substr(InstalledVersions::getReference('package-health/php'), 0, 7)
)
);
$version = $_ENV['VERSION'] ?? '';
if ($version === '') {
$version = InstalledVersions::getVersion('package-health/php');
if (str_starts_with(InstalledVersions::getPrettyVersion('package-health/php'), 'dev-')) {
$version = sprintf(
'%s-%s',
substr(InstalledVersions::getPrettyVersion('package-health/php'), 4),
substr(InstalledVersions::getReference('package-health/php'), 0, 7)
);
}
}

define('__VERSION__', $version);

// Instantiate PHP-DI ContainerBuilder
$containerBuilder = new ContainerBuilder();
Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"nyholm/dsn": "^2.0",
"nyholm/psr7": "^1.5",
"nyholm/psr7-server": "^1.0",
"ocramius/package-versions": "*",
"php-di/php-di": "^7.0",
"phpunit/php-timer": "^6.0",
"psr/cache": "^3.0",
Expand Down
Loading

0 comments on commit 98b32e9

Please sign in to comment.