Skip to content

Commit a4878ac

Browse files
committed
Revert "Merge pull request #7239 from DeyV/master"
This reverts commit 33628ca, reversing changes made to 216cf6c.
1 parent 760badd commit a4878ac

5 files changed

Lines changed: 9 additions & 28 deletions

File tree

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
"ext-libxml": "*",
2323
"ext-mbstring": "*",
2424
"ext-tokenizer": "*",
25-
"composer-runtime-api": "^2.0.0",
2625
"amphp/amp": "^2.4.2",
2726
"amphp/byte-stream": "^1.5",
27+
"composer/package-versions-deprecated": "^1.8.0",
2828
"composer/semver": "^1.4 || ^2.0 || ^3.0",
2929
"composer/xdebug-handler": "^1.1 || ^2.0 || ^3.0",
3030
"dnoegel/php-xdg-base-dir": "^0.1.1",
@@ -49,7 +49,7 @@
4949
"phpmyadmin/sql-parser": "5.1.0||dev-master",
5050
"phpspec/prophecy": ">=1.9.0",
5151
"phpunit/phpunit": "^9.0",
52-
"psalm/plugin-phpunit": "^0.16.1",
52+
"psalm/plugin-phpunit": "^0.16",
5353
"slevomat/coding-standard": "^7.0",
5454
"squizlabs/php_codesniffer": "^3.5",
5555
"symfony/process": "^4.3 || ^5.0 || ^6.0",

psalm.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
</DeprecatedMethod>
5959
<DeprecatedClass>
6060
<errorLevel type="suppress">
61+
<referencedClass name="PackageVersions\Versions"/>
6162
<referencedClass name="Psalm\Plugin\Hook\*" />
6263
</errorLevel>
6364
</DeprecatedClass>

scoper.inc.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ function ($filePath, $prefix, $contents) {
2727
$contents
2828
);
2929
},
30-
function ($filePath, $prefix, $contents) {
31-
return str_replace(
32-
'\\'.$prefix.'\Composer\InstalledVersions',
33-
'\Composer\InstalledVersions',
34-
$contents
35-
);
36-
},
3730
function ($filePath, $prefix, $contents) {
3831
if (strpos($filePath, 'src/Psalm') === 0) {
3932
return str_replace(

src/Psalm/Internal/Cli/Plugin.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
namespace Psalm\Internal\Cli;
44

5-
use Composer\InstalledVersions;
6-
use OutOfBoundsException;
5+
use PackageVersions\Versions;
76
use Psalm\Internal\CliUtils;
87
use Psalm\Internal\PluginManager\Command\DisableCommand;
98
use Psalm\Internal\PluginManager\Command\EnableCommand;
@@ -30,13 +29,7 @@ public static function run(): void
3029
$vendor_dir = CliUtils::getVendorDir($current_dir);
3130
CliUtils::requireAutoloaders($current_dir, false, $vendor_dir);
3231

33-
$version = null;
34-
try {
35-
$version = InstalledVersions::getVersion('vimeo/psalm') ;
36-
} catch (OutOfBoundsException $e) {
37-
}
38-
39-
$app = new Application('psalm-plugin', $version ?? 'UNKNOWN');
32+
$app = new Application('psalm-plugin', Versions::getVersion('vimeo/psalm'));
4033

4134
$psalm_root = dirname(__DIR__, 4) . DIRECTORY_SEPARATOR;
4235

src/Psalm/Internal/CliUtils.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
namespace Psalm\Internal;
44

55
use Composer\Autoload\ClassLoader;
6-
use Composer\InstalledVersions;
7-
use OutOfBoundsException;
6+
use PackageVersions\Versions;
87
use Phar;
98
use Psalm\Config;
109
use Psalm\Config\Creator;
1110
use Psalm\Exception\ConfigException;
1211
use Psalm\Exception\ConfigNotFoundException;
1312
use Psalm\Internal\Analyzer\ProjectAnalyzer;
13+
use Psalm\Internal\Composer;
1414
use Psalm\Report;
1515

1616
use function array_slice;
@@ -147,14 +147,8 @@ public static function requireAutoloaders(
147147
exit(1);
148148
}
149149

150-
$version = null;
151-
try {
152-
$version = InstalledVersions::getVersion('vimeo/psalm') ;
153-
} catch (OutOfBoundsException $e) {
154-
}
155-
156-
define('PSALM_VERSION', $version ?? 'UNKNOWN');
157-
define('PHP_PARSER_VERSION', InstalledVersions::getVersion('nikic/php-parser'));
150+
define('PSALM_VERSION', Versions::getVersion('vimeo/psalm'));
151+
define('PHP_PARSER_VERSION', Versions::getVersion('nikic/php-parser'));
158152

159153
return $first_autoloader;
160154
}

0 commit comments

Comments
 (0)