From 1778079f392a5127fd50b462384a05ce1ea6397c Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 10 Jul 2020 17:12:44 +0200 Subject: [PATCH] Sync with v1.10 of upstream package --- composer.json | 2 +- composer.lock | 73 +++++++--- src/PackageVersions/FallbackVersions.php | 6 +- src/PackageVersions/Installer.php | 47 +++++- src/PackageVersions/Versions.php | 17 ++- test/PackageVersionsTest/E2EInstallerTest.php | 47 ++++++ .../FallbackVersionsTest.php | 1 + test/PackageVersionsTest/InstallerTest.php | 137 +++++++++++++++++- test/PackageVersionsTest/VersionsTest.php | 1 + .../happy-path/expected-package-name.php | 2 +- 10 files changed, 294 insertions(+), 39 deletions(-) diff --git a/composer.json b/composer.json index 40451c8..dca30d0 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "composer-plugin-api": "^1.1.0 || ^2.0" }, "replace": { - "ocramius/package-versions": "1.8.99" + "ocramius/package-versions": "1.10.99" }, "require-dev": { "phpunit/phpunit": "^6.5 || ^7", diff --git a/composer.lock b/composer.lock index fa881de..b711f6b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b5eddb9b561a808c78b24b7faa9dcc5d", + "content-hash": "6bfe0a7d7a51c4bdf14a2d7ea1d22d11", "packages": [], "packages-dev": [ { @@ -61,11 +61,6 @@ "ssl", "tls" ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.2.7" - }, "funding": [ { "url": "https://packagist.com", @@ -297,11 +292,6 @@ "spdx", "validator" ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/spdx-licenses/issues", - "source": "https://github.com/composer/spdx-licenses/tree/1.5.3" - }, "time": "2020-02-14T07:44:31+00:00" }, { @@ -576,6 +566,23 @@ "license": [ "BSD-3-Clause" ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "time": "2018-07-08T19:23:20+00:00" }, @@ -606,6 +613,23 @@ "license": [ "BSD-3-Clause" ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], "description": "Library for handling version information and constraints", "time": "2018-07-08T19:19:57+00:00" }, @@ -699,10 +723,6 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.1.0" - }, "time": "2020-02-22T12:28:44+00:00" }, { @@ -1190,8 +1210,21 @@ "license": [ "MIT" ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], "description": "Common Container Interface (PHP FIG PSR-11)", "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], "time": "2017-02-14T16:28:37+00:00" }, { @@ -1239,9 +1272,6 @@ "psr", "psr-3" ], - "support": { - "source": "https://github.com/php-fig/log/tree/1.1.3" - }, "time": "2020-03-23T09:12:05+00:00" }, { @@ -2492,6 +2522,13 @@ "license": [ "BSD-3-Clause" ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "time": "2019-06-13T22:48:21+00:00" }, diff --git a/src/PackageVersions/FallbackVersions.php b/src/PackageVersions/FallbackVersions.php index fe2e3c4..18e5fe6 100644 --- a/src/PackageVersions/FallbackVersions.php +++ b/src/PackageVersions/FallbackVersions.php @@ -38,7 +38,7 @@ private function __construct() * @throws OutOfBoundsException If a version cannot be located. * @throws UnexpectedValueException If the composer.lock file could not be located. */ - public static function getVersion(string $packageName) : string + public static function getVersion(string $packageName): string { $versions = iterator_to_array(self::getVersions(self::getPackageData())); @@ -56,7 +56,7 @@ public static function getVersion(string $packageName) : string * * @throws UnexpectedValueException */ - private static function getPackageData() : array + private static function getPackageData(): array { $checkedPaths = [ // The top-level project's ./vendor/composer/installed.json @@ -115,7 +115,7 @@ private static function getPackageData() : array * * @psalm-return Generator */ - private static function getVersions(array $packageData) : Generator + private static function getVersions(array $packageData): Generator { foreach ($packageData as $package) { yield $package['name'] => $package['version'] . '@' . ( diff --git a/src/PackageVersions/Installer.php b/src/PackageVersions/Installer.php index 62bc29b..a0a2616 100644 --- a/src/PackageVersions/Installer.php +++ b/src/PackageVersions/Installer.php @@ -17,12 +17,14 @@ use Composer\Script\ScriptEvents; use Generator; use RuntimeException; + use function array_key_exists; use function array_merge; use function chmod; use function dirname; use function file_exists; use function file_put_contents; +use function is_writable; use function iterator_to_array; use function rename; use function sprintf; @@ -38,6 +40,7 @@ final class Installer implements PluginInterface, EventSubscriberInterface namespace PackageVersions; +use Composer\InstalledVersions; use OutOfBoundsException; /** @@ -50,7 +53,14 @@ final class Installer implements PluginInterface, EventSubscriberInterface */ %s { + /** + * @deprecated please use {@see \Composer\InstalledVersions::getRootPackage()} instead. The + * equivalent expression for this constant's contents is + * `\Composer\InstalledVersions::getRootPackage()['name']`. + * This constant will be removed in version 2.0.0. + */ const ROOT_PACKAGE_NAME = '%s'; + /** * Array of all available composer packages. * Dont read this array from your calling code, but use the \PackageVersions\Versions::getVersion() method instead. @@ -62,6 +72,7 @@ final class Installer implements PluginInterface, EventSubscriberInterface private function __construct() { + class_exists(InstalledVersions::class); } /** @@ -69,9 +80,17 @@ private function __construct() * * @psalm-param key-of $packageName * @psalm-pure + * + * @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not + * cause any side effects here. */ - public static function getVersion(string $packageName) : string + public static function getVersion(string $packageName): string { + if (class_exists(InstalledVersions::class, false)) { + return InstalledVersions::getPrettyVersion($packageName) + . '@' . InstalledVersions::getReference($packageName); + } + if (isset(self::VERSIONS[$packageName])) { return self::VERSIONS[$packageName]; } @@ -102,7 +121,7 @@ public function uninstall(Composer $composer, IOInterface $io) /** * {@inheritDoc} */ - public static function getSubscribedEvents() : array + public static function getSubscribedEvents(): array { return [ScriptEvents::POST_AUTOLOAD_DUMP => 'dumpVersionsClass']; } @@ -130,7 +149,7 @@ public static function dumpVersionsClass(Event $composerEvent) /** * @param string[] $versions */ - private static function generateVersionsClass(string $rootPackageName, array $versions) : string + private static function generateVersionsClass(string $rootPackageName, array $versions): string { return sprintf( self::$generatedClassTemplate, @@ -148,12 +167,24 @@ private static function writeVersionClassToFile(string $versionClassSource, Comp $installPath = self::locateRootPackageInstallPath($composer->getConfig(), $composer->getPackage()) . '/src/PackageVersions/Versions.php'; - if (! file_exists(dirname($installPath))) { + $installDir = dirname($installPath); + if (! file_exists($installDir)) { $io->write('composer/package-versions-deprecated: Package not found (probably scheduled for removal); generation of version class skipped.'); return; } + if (! is_writable($installDir)) { + $io->write( + sprintf( + 'composer/package-versions-deprecated: %s is not writable; generation of version class skipped.', + $installDir + ) + ); + + return; + } + $io->write('composer/package-versions-deprecated: Generating version class...'); $installPathTmp = $installPath . '_' . uniqid('tmp', true); @@ -170,7 +201,7 @@ private static function writeVersionClassToFile(string $versionClassSource, Comp private static function locateRootPackageInstallPath( Config $composerConfig, RootPackageInterface $rootPackage - ) : string { + ): string { if (self::getRootPackageAlias($rootPackage)->getName() === 'composer/package-versions-deprecated') { return dirname($composerConfig->get('vendor-dir')); } @@ -178,7 +209,7 @@ private static function locateRootPackageInstallPath( return $composerConfig->get('vendor-dir') . '/composer/package-versions-deprecated'; } - private static function getRootPackageAlias(RootPackageInterface $rootPackage) : PackageInterface + private static function getRootPackageAlias(RootPackageInterface $rootPackage): PackageInterface { $package = $rootPackage; @@ -194,7 +225,7 @@ private static function getRootPackageAlias(RootPackageInterface $rootPackage) : * * @psalm-return Generator */ - private static function getVersions(Locker $locker, RootPackageInterface $rootPackage) : Generator + private static function getVersions(Locker $locker, RootPackageInterface $rootPackage): Generator { $lockData = $locker->getLockData(); @@ -202,7 +233,7 @@ private static function getVersions(Locker $locker, RootPackageInterface $rootPa foreach (array_merge($lockData['packages'], $lockData['packages-dev']) as $package) { yield $package['name'] => $package['version'] . '@' . ( - $package['source']['reference']?? $package['dist']['reference'] ?? '' + $package['source']['reference'] ?? $package['dist']['reference'] ?? '' ); } diff --git a/src/PackageVersions/Versions.php b/src/PackageVersions/Versions.php index 81d6160..2446cc1 100644 --- a/src/PackageVersions/Versions.php +++ b/src/PackageVersions/Versions.php @@ -4,6 +4,7 @@ namespace PackageVersions; +use Composer\InstalledVersions; use OutOfBoundsException; use UnexpectedValueException; @@ -17,19 +18,31 @@ */ final class Versions { + /** + * @deprecated please use {@see \Composer\InstalledVersions::getRootPackage()} instead. The + * equivalent expression for this constant's contents is + * `\Composer\InstalledVersions::getRootPackage()['name']`. + * This constant will be removed in version 2.0.0. + */ const ROOT_PACKAGE_NAME = FallbackVersions::ROOT_PACKAGE_NAME; const VERSIONS = []; private function __construct() { + class_exists(InstalledVersions::class); } /** * @throws OutOfBoundsException if a version cannot be located. * @throws UnexpectedValueException if the composer.lock file could not be located. */ - public static function getVersion(string $packageName) : string + public static function getVersion(string $packageName): string { - return FallbackVersions::getVersion($packageName); + if (!class_exists(InstalledVersions::class, false)) { + return FallbackVersions::getVersion($packageName); + } + + return InstalledVersions::getPrettyVersion($packageName) + . '@' . InstalledVersions::getReference($packageName); } } diff --git a/test/PackageVersionsTest/E2EInstallerTest.php b/test/PackageVersionsTest/E2EInstallerTest.php index 8377861..9a5908c 100644 --- a/test/PackageVersionsTest/E2EInstallerTest.php +++ b/test/PackageVersionsTest/E2EInstallerTest.php @@ -10,10 +10,12 @@ use RecursiveIteratorIterator; use SplFileInfo; use ZipArchive; + use function array_filter; use function array_map; use function array_walk; use function chdir; +use function chmod; use function escapeshellarg; use function exec; use function file_get_contents; @@ -21,6 +23,7 @@ use function getcwd; use function in_array; use function is_dir; +use function is_writable; use function iterator_to_array; use function json_decode; use function json_encode; @@ -34,6 +37,7 @@ use function sys_get_temp_dir; use function uniqid; use function unlink; + use const JSON_PRETTY_PRINT; use const JSON_UNESCAPED_SLASHES; use const PHP_BINARY; @@ -184,6 +188,45 @@ public function testRemovingPluginWithNoDevDoesNotAttemptToGenerateVersions() )); } + public function testOnReadonlyFilesystemDoesNotGenerateClasses() + { + $this->createPackageVersionsArtifact(); + $this->createArtifact(); + + $this->writeComposerJsonFile( + [ + 'name' => 'package-versions/e2e-local', + 'require-dev' => ['composer/package-versions-deprecated' => '1.0.0'], + 'repositories' => [ + ['packagist' => false], + [ + 'type' => 'artifact', + 'url' => $this->tempArtifact, + ], + ], + ], + $this->tempLocalComposerHome + ); + + $this->execComposerInDir('install', $this->tempLocalComposerHome); + + $versionsDir = $this->tempLocalComposerHome . '/vendor/composer/package-versions-deprecated/src/PackageVersions'; + + $versionsFilePath = $versionsDir . '/Versions.php'; + + file_put_contents($versionsFilePath, 'NOT PHP!'); + + chmod($versionsFilePath, 0400); + chmod($versionsDir, 0400); + + $this->execComposerInDir('update', $this->tempLocalComposerHome); + + chmod($versionsDir, 0700); + chmod($versionsFilePath, 0600); + + self::assertSame('NOT PHP!', file_get_contents($versionsFilePath)); + } + /** * @group 101 */ @@ -325,6 +368,10 @@ private function execComposerInDir(string $command, string $dir) : array private function rmDir(string $directory) { + if (! is_writable($directory)) { + chmod($directory, 0700); + } + if (! is_dir($directory)) { unlink($directory); diff --git a/test/PackageVersionsTest/FallbackVersionsTest.php b/test/PackageVersionsTest/FallbackVersionsTest.php index 7eeaeda..f81418a 100644 --- a/test/PackageVersionsTest/FallbackVersionsTest.php +++ b/test/PackageVersionsTest/FallbackVersionsTest.php @@ -8,6 +8,7 @@ use PackageVersions\FallbackVersions; use PHPUnit\Framework\TestCase; use UnexpectedValueException; + use function array_merge; use function file_exists; use function file_get_contents; diff --git a/test/PackageVersionsTest/InstallerTest.php b/test/PackageVersionsTest/InstallerTest.php index 488985a..a9312b9 100644 --- a/test/PackageVersionsTest/InstallerTest.php +++ b/test/PackageVersionsTest/InstallerTest.php @@ -23,6 +23,7 @@ use PHPUnit\Framework\TestCase; use ReflectionClass; use RuntimeException; + use function array_filter; use function array_map; use function chmod; @@ -42,6 +43,7 @@ use function sys_get_temp_dir; use function uniqid; use function unlink; + use const PHP_OS; /** @@ -142,6 +144,61 @@ public function testDumpVersionsClassIfExistingFileIsNotWritable() $this->rmDir($vendorDir); } + public function testDumpVersionsClassIfReadonlyFilesystem() + { + $config = $this->createMock(Config::class); + $locker = $this->createMock(Locker::class); + $repositoryManager = $this->createMock(RepositoryManager::class); + $installManager = $this->createMock(InstallationManager::class); + $repository = $this->createMock(InstalledRepositoryInterface::class); + + $vendorDir = sys_get_temp_dir() . '/' . uniqid('InstallerTest', true); + + $expectedPath = $vendorDir . '/composer/package-versions-deprecated/src/PackageVersions'; + + /** @noinspection MkdirRaceConditionInspection */ + mkdir($expectedPath, 0700, true); + + $expectedFileName = $expectedPath . '/Versions.php'; + file_put_contents($expectedFileName, 'NOT PHP!'); + chmod($expectedFileName, 0400); + chmod($expectedPath, 0400); + + $locker + ->method('getLockData') + ->willReturn([ + 'packages' => [ + [ + 'name' => 'composer/package-versions-deprecated', + 'version' => '1.0.0', + ], + ], + ]); + + $repositoryManager->method('getLocalRepository')->willReturn($repository); + + $this->composer->method('getConfig')->willReturn($config); + $this->composer->method('getLocker')->willReturn($locker); + $this->composer->method('getRepositoryManager')->willReturn($repositoryManager); + $this->composer->method('getPackage')->willReturn($this->getRootPackageMock()); + $this->composer->method('getInstallationManager')->willReturn($installManager); + + $config->method('get')->with('vendor-dir')->willReturn($vendorDir); + + Installer::dumpVersionsClass(new Event( + 'post-install-cmd', + $this->composer, + $this->io + )); + + chmod($expectedPath, 0700); + chmod($expectedFileName, 0600); + + self::assertSame('NOT PHP!', file_get_contents($expectedFileName)); + + $this->rmDir($vendorDir); + } + public function testDumpVersionsClass() { $config = $this->getMockBuilder(Config::class)->disableOriginalConstructor()->getMock(); @@ -209,6 +266,7 @@ public function testDumpVersionsClass() namespace PackageVersions; +use Composer\InstalledVersions; use OutOfBoundsException; /** @@ -221,7 +279,14 @@ public function testDumpVersionsClass() */ final class Versions { + /** + * @deprecated please use {@see \Composer\InstalledVersions::getRootPackage()} instead. The + * equivalent expression for this constant's contents is + * `\Composer\InstalledVersions::getRootPackage()['name']`. + * This constant will be removed in version 2.0.0. + */ const ROOT_PACKAGE_NAME = 'root/package'; + /** * Array of all available composer packages. * Dont read this array from your calling code, but use the \PackageVersions\Versions::getVersion() method instead. @@ -240,6 +305,7 @@ final class Versions private function __construct() { + class_exists(InstalledVersions::class); } /** @@ -247,9 +313,17 @@ private function __construct() * * @psalm-param key-of $packageName * @psalm-pure + * + * @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not + * cause any side effects here. */ - public static function getVersion(string $packageName) : string + public static function getVersion(string $packageName): string { + if (class_exists(InstalledVersions::class, false)) { + return InstalledVersions::getPrettyVersion($packageName) + . '@' . InstalledVersions::getReference($packageName); + } + if (isset(self::VERSIONS[$packageName])) { return self::VERSIONS[$packageName]; } @@ -327,6 +401,7 @@ public function testDumpVersionsClassNoDev() namespace PackageVersions; +use Composer\InstalledVersions; use OutOfBoundsException; /** @@ -339,7 +414,14 @@ public function testDumpVersionsClassNoDev() */ final class Versions { + /** + * @deprecated please use {@see \Composer\InstalledVersions::getRootPackage()} instead. The + * equivalent expression for this constant's contents is + * `\Composer\InstalledVersions::getRootPackage()['name']`. + * This constant will be removed in version 2.0.0. + */ const ROOT_PACKAGE_NAME = 'root/package'; + /** * Array of all available composer packages. * Dont read this array from your calling code, but use the \PackageVersions\Versions::getVersion() method instead. @@ -357,6 +439,7 @@ final class Versions private function __construct() { + class_exists(InstalledVersions::class); } /** @@ -364,9 +447,17 @@ private function __construct() * * @psalm-param key-of $packageName * @psalm-pure + * + * @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not + * cause any side effects here. */ - public static function getVersion(string $packageName) : string + public static function getVersion(string $packageName): string { + if (class_exists(InstalledVersions::class, false)) { + return InstalledVersions::getPrettyVersion($packageName) + . '@' . InstalledVersions::getReference($packageName); + } + if (isset(self::VERSIONS[$packageName])) { return self::VERSIONS[$packageName]; } @@ -448,6 +539,7 @@ public function testDumpVersionsWithoutPackageSourceDetails() namespace PackageVersions; +use Composer\InstalledVersions; use OutOfBoundsException; /** @@ -460,7 +552,14 @@ public function testDumpVersionsWithoutPackageSourceDetails() */ final class Versions { + /** + * @deprecated please use {@see \Composer\InstalledVersions::getRootPackage()} instead. The + * equivalent expression for this constant's contents is + * `\Composer\InstalledVersions::getRootPackage()['name']`. + * This constant will be removed in version 2.0.0. + */ const ROOT_PACKAGE_NAME = 'root/package'; + /** * Array of all available composer packages. * Dont read this array from your calling code, but use the \PackageVersions\Versions::getVersion() method instead. @@ -478,6 +577,7 @@ final class Versions private function __construct() { + class_exists(InstalledVersions::class); } /** @@ -485,9 +585,17 @@ private function __construct() * * @psalm-param key-of $packageName * @psalm-pure + * + * @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not + * cause any side effects here. */ - public static function getVersion(string $packageName) : string + public static function getVersion(string $packageName): string { + if (class_exists(InstalledVersions::class, false)) { + return InstalledVersions::getPrettyVersion($packageName) + . '@' . InstalledVersions::getReference($packageName); + } + if (isset(self::VERSIONS[$packageName])) { return self::VERSIONS[$packageName]; } @@ -572,7 +680,7 @@ public function testDumpsVersionsClassToSpecificLocation(RootPackageInterface $r * @return bool[][]|RootPackageInterface[][] the root package and whether the versions class is to be generated in * the vendor dir or not */ - public function rootPackageProvider() : array + public function rootPackageProvider(): array { $baseRootPackage = new RootPackage('root/package', '1.2.3', '1.2.3'); $aliasRootPackage = new RootAliasPackage($baseRootPackage, '1.2.3', '1.2.3'); @@ -862,6 +970,7 @@ public function testGetVersionsIsNotNormalizedForRootPackage() namespace PackageVersions; +use Composer\InstalledVersions; use OutOfBoundsException; /** @@ -874,7 +983,14 @@ public function testGetVersionsIsNotNormalizedForRootPackage() */ final class Versions { + /** + * @deprecated please use {@see \Composer\InstalledVersions::getRootPackage()} instead. The + * equivalent expression for this constant's contents is + * `\Composer\InstalledVersions::getRootPackage()['name']`. + * This constant will be removed in version 2.0.0. + */ const ROOT_PACKAGE_NAME = 'root/package'; + /** * Array of all available composer packages. * Dont read this array from your calling code, but use the \PackageVersions\Versions::getVersion() method instead. @@ -890,6 +1006,7 @@ final class Versions private function __construct() { + class_exists(InstalledVersions::class); } /** @@ -897,9 +1014,17 @@ private function __construct() * * @psalm-param key-of $packageName * @psalm-pure + * + * @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not + * cause any side effects here. */ - public static function getVersion(string $packageName) : string + public static function getVersion(string $packageName): string { + if (class_exists(InstalledVersions::class, false)) { + return InstalledVersions::getPrettyVersion($packageName) + . '@' . InstalledVersions::getReference($packageName); + } + if (isset(self::VERSIONS[$packageName])) { return self::VERSIONS[$packageName]; } @@ -917,7 +1042,7 @@ public static function getVersion(string $packageName) : string $this->rmDir($vendorDir); } - private function getRootPackageMock() : RootPackageInterface + private function getRootPackageMock(): RootPackageInterface { $package = $this->createMock(RootPackageInterface::class); $package->expects(self::any())->method('getName')->willReturn('root/package'); diff --git a/test/PackageVersionsTest/VersionsTest.php b/test/PackageVersionsTest/VersionsTest.php index 70d86c2..f059bdc 100644 --- a/test/PackageVersionsTest/VersionsTest.php +++ b/test/PackageVersionsTest/VersionsTest.php @@ -7,6 +7,7 @@ use OutOfBoundsException; use PackageVersions\Versions; use PHPUnit\Framework\TestCase; + use function array_merge; use function file_get_contents; use function json_decode; diff --git a/test/static-analysis/happy-path/expected-package-name.php b/test/static-analysis/happy-path/expected-package-name.php index 208041b..52c91dc 100644 --- a/test/static-analysis/happy-path/expected-package-name.php +++ b/test/static-analysis/happy-path/expected-package-name.php @@ -5,7 +5,7 @@ use PackageVersions\Versions; /** @psalm-pure */ -function getVersion() : string +function getVersion(): string { return Versions::getVersion('composer/package-versions-deprecated'); }