1
0
Fork 0

Fix \Composer\Installer\PackageEvent::__construct() and \Composer\Repository\ComposerRepository::isVersionAcceptable() required arguments used after optional, which is deprecated in PHP 8.0

1. `Deprecated: Required parameter $name follows optional parameter $constraint in src\Composer\Repository\ComposerRepository.php on line 745`

2. `Deprecated: Required parameter $operation follows optional parameter $operations in src\Composer\Installer\PackageEvent.php on line 73`

Optional parameters with a type declared, and a default value of `null` is excepted from this deprecation. See https://php.watch/versions/8.0/deprecate-required-param-after-optional. This is the case in `ComposerRepository::isVersionAcceptable`, which still has two optional parameters as first two parameters, but this will not raise a deprecation notice.
pull/8775/head
Ayesh Karunaratne 2020-04-13 06:41:10 +07:00
parent 40a35abb94
commit fdb35a6a06
No known key found for this signature in database
GPG Key ID: 2CA18B2097A7429A
2 changed files with 2 additions and 2 deletions

View File

@ -70,7 +70,7 @@ class PackageEvent extends Event
* @param OperationInterface[] $operations * @param OperationInterface[] $operations
* @param OperationInterface $operation * @param OperationInterface $operation
*/ */
public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, RepositoryInterface $localRepo, array $operations = array(), OperationInterface $operation) public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, RepositoryInterface $localRepo, array $operations, OperationInterface $operation)
{ {
parent::__construct($eventName); parent::__construct($eventName);

View File

@ -742,7 +742,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
* @param string $name package name (must be lowercased already) * @param string $name package name (must be lowercased already)
* @private * @private
*/ */
public function isVersionAcceptable(array $acceptableStabilities = null, array $stabilityFlags = null, $constraint = null, $name, $versionData) public function isVersionAcceptable(array $acceptableStabilities = null, array $stabilityFlags = null, $constraint, $name, $versionData)
{ {
$versions = array($versionData['version_normalized']); $versions = array($versionData['version_normalized']);