Skip to content

Commit

Permalink
Merge pull request #25 from derrabus/bugfix/composer-deprecated
Browse files Browse the repository at this point in the history
Avoid calling deprecated getRawData()
  • Loading branch information
Seldaek authored May 24, 2021
2 parents f921205 + 07fa61f commit c6522af
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/PackageVersions/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
}
Expand Down
16 changes: 8 additions & 8 deletions test/PackageVersionsTest/InstallerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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);
}
Expand Down

0 comments on commit c6522af

Please sign in to comment.