composer / composer/installers
PHP 8.4 Deprecation: Implicitly marking parameter $binaryInstaller as nullable in Installer::__construct()
- Dominant language
- PHP
- Stars
- 1.4k
- Forks
- 400
- PR merge metrics
- No merged PRs in 30d
Description
### 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)`
Contributor guide
Assessment
This issue has not been assessed yet.