From 07fa61fa7947f6526e0ee0149f40bcaadb7521fe Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Sun, 23 May 2021 00:08:35 +0200 Subject: [PATCH] Avoid calling deprecated getRawData() --- src/PackageVersions/Installer.php | 4 ++-- test/PackageVersionsTest/InstallerTest.php | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/PackageVersions/Installer.php b/src/PackageVersions/Installer.php index c0853c1..35f864d 100644 --- a/src/PackageVersions/Installer.php +++ b/src/PackageVersions/Installer.php @@ -82,7 +82,7 @@ private function __construct() */ public static function rootPackageName() : string { - if (!class_exists(InstalledVersions::class, false) || !InstalledVersions::getRawData()) { + if (!class_exists(InstalledVersions::class, false) || !(method_exists(InstalledVersions::class, 'getAllRawData') ? InstalledVersions::getAllRawData() : InstalledVersions::getRawData())) { return self::ROOT_PACKAGE_NAME; } @@ -100,7 +100,7 @@ public static function rootPackageName() : string */ public static function getVersion(string $packageName): string { - if (class_exists(InstalledVersions::class, false) && InstalledVersions::getRawData()) { + if (class_exists(InstalledVersions::class, false) && (method_exists(InstalledVersions::class, 'getAllRawData') ? InstalledVersions::getAllRawData() : InstalledVersions::getRawData())) { return InstalledVersions::getPrettyVersion($packageName) . '@' . InstalledVersions::getReference($packageName); } diff --git a/test/PackageVersionsTest/InstallerTest.php b/test/PackageVersionsTest/InstallerTest.php index cd06171..870dbc8 100644 --- a/test/PackageVersionsTest/InstallerTest.php +++ b/test/PackageVersionsTest/InstallerTest.php @@ -315,7 +315,7 @@ private function __construct() */ public static function rootPackageName() : string { - if (!class_exists(InstalledVersions::class, false) || !InstalledVersions::getRawData()) { + if (!class_exists(InstalledVersions::class, false) || !(method_exists(InstalledVersions::class, 'getAllRawData') ? InstalledVersions::getAllRawData() : InstalledVersions::getRawData())) { return self::ROOT_PACKAGE_NAME; } @@ -333,7 +333,7 @@ public static function rootPackageName() : string */ public static function getVersion(string $packageName): string { - if (class_exists(InstalledVersions::class, false) && InstalledVersions::getRawData()) { + if (class_exists(InstalledVersions::class, false) && (method_exists(InstalledVersions::class, 'getAllRawData') ? InstalledVersions::getAllRawData() : InstalledVersions::getRawData())) { return InstalledVersions::getPrettyVersion($packageName) . '@' . InstalledVersions::getReference($packageName); } @@ -463,7 +463,7 @@ private function __construct() */ public static function rootPackageName() : string { - if (!class_exists(InstalledVersions::class, false) || !InstalledVersions::getRawData()) { + if (!class_exists(InstalledVersions::class, false) || !(method_exists(InstalledVersions::class, 'getAllRawData') ? InstalledVersions::getAllRawData() : InstalledVersions::getRawData())) { return self::ROOT_PACKAGE_NAME; } @@ -481,7 +481,7 @@ public static function rootPackageName() : string */ public static function getVersion(string $packageName): string { - if (class_exists(InstalledVersions::class, false) && InstalledVersions::getRawData()) { + if (class_exists(InstalledVersions::class, false) && (method_exists(InstalledVersions::class, 'getAllRawData') ? InstalledVersions::getAllRawData() : InstalledVersions::getRawData())) { return InstalledVersions::getPrettyVersion($packageName) . '@' . InstalledVersions::getReference($packageName); } @@ -615,7 +615,7 @@ private function __construct() */ public static function rootPackageName() : string { - if (!class_exists(InstalledVersions::class, false) || !InstalledVersions::getRawData()) { + if (!class_exists(InstalledVersions::class, false) || !(method_exists(InstalledVersions::class, 'getAllRawData') ? InstalledVersions::getAllRawData() : InstalledVersions::getRawData())) { return self::ROOT_PACKAGE_NAME; } @@ -633,7 +633,7 @@ public static function rootPackageName() : string */ public static function getVersion(string $packageName): string { - if (class_exists(InstalledVersions::class, false) && InstalledVersions::getRawData()) { + if (class_exists(InstalledVersions::class, false) && (method_exists(InstalledVersions::class, 'getAllRawData') ? InstalledVersions::getAllRawData() : InstalledVersions::getRawData())) { return InstalledVersions::getPrettyVersion($packageName) . '@' . InstalledVersions::getReference($packageName); } @@ -1058,7 +1058,7 @@ private function __construct() */ public static function rootPackageName() : string { - if (!class_exists(InstalledVersions::class, false) || !InstalledVersions::getRawData()) { + if (!class_exists(InstalledVersions::class, false) || !(method_exists(InstalledVersions::class, 'getAllRawData') ? InstalledVersions::getAllRawData() : InstalledVersions::getRawData())) { return self::ROOT_PACKAGE_NAME; } @@ -1076,7 +1076,7 @@ public static function rootPackageName() : string */ public static function getVersion(string $packageName): string { - if (class_exists(InstalledVersions::class, false) && InstalledVersions::getRawData()) { + if (class_exists(InstalledVersions::class, false) && (method_exists(InstalledVersions::class, 'getAllRawData') ? InstalledVersions::getAllRawData() : InstalledVersions::getRawData())) { return InstalledVersions::getPrettyVersion($packageName) . '@' . InstalledVersions::getReference($packageName); }