From eb36025d372453affb5a5a6e4d7b7d6fd67440f2 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 6 Apr 2022 22:23:47 +0200 Subject: [PATCH] Fix type error in ArchiverInterface::supports(), fixes #10702 --- src/Composer/Package/Archiver/ArchiverInterface.php | 4 ++-- src/Composer/Package/Archiver/PharArchiver.php | 2 +- src/Composer/Package/Archiver/ZipArchiver.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Composer/Package/Archiver/ArchiverInterface.php b/src/Composer/Package/Archiver/ArchiverInterface.php index f19b2c285..8b3ef316b 100644 --- a/src/Composer/Package/Archiver/ArchiverInterface.php +++ b/src/Composer/Package/Archiver/ArchiverInterface.php @@ -36,9 +36,9 @@ interface ArchiverInterface * Format supported by the archiver. * * @param string $format The archive format - * @param string $sourceType The source type (git, svn, hg, etc.) + * @param ?string $sourceType The source type (git, svn, hg, etc.) * * @return bool true if the format is supported by the archiver */ - public function supports(string $format, string $sourceType): bool; + public function supports(string $format, ?string $sourceType): bool; } diff --git a/src/Composer/Package/Archiver/PharArchiver.php b/src/Composer/Package/Archiver/PharArchiver.php index 225a4a91a..a0131bb54 100644 --- a/src/Composer/Package/Archiver/PharArchiver.php +++ b/src/Composer/Package/Archiver/PharArchiver.php @@ -97,7 +97,7 @@ class PharArchiver implements ArchiverInterface /** * @inheritDoc */ - public function supports(string $format, string $sourceType): bool + public function supports(string $format, ?string $sourceType): bool { return isset(static::$formats[$format]); } diff --git a/src/Composer/Package/Archiver/ZipArchiver.php b/src/Composer/Package/Archiver/ZipArchiver.php index 8c655f6a0..fce4f14bc 100644 --- a/src/Composer/Package/Archiver/ZipArchiver.php +++ b/src/Composer/Package/Archiver/ZipArchiver.php @@ -78,7 +78,7 @@ class ZipArchiver implements ArchiverInterface /** * @inheritDoc */ - public function supports(string $format, string $sourceType): bool + public function supports(string $format, ?string $sourceType): bool { return isset(static::$formats[$format]) && $this->compressionAvailable(); }