Description
When running with PHP 8.4, a deprecation notice is triggered in the Installer class. PHP 8.4 deprecates implicit nullable parameters (those that have a default value of null but lack an explicit ? type hint or |null union type).
Error Message
Deprecation Notice: Composer\Installers\Installer::__construct(): Implicitly marking parameter $binaryInstaller as nullable is deprecated, the explicit nullable type must be used instead in /vendor/composer/installers/src/Composer/Installers/Installer.php:136
Environment
- PHP Version: 8.4
- Package Version: 1.12.0
Suggested Fix
The constructor in src/Composer/Installers/Installer.php needs to be updated to include an explicit nullable type hint for the $binaryInstaller parameter.
Current code:
public function __construct(PackageInterface $package, Composer $composer, IOInterface $io, BinaryInstaller $binaryInstaller = null)
Fixed code:
public function __construct(PackageInterface $package, Composer $composer, IOInterface $io, ?BinaryInstaller $binaryInstaller = null)