Skip to content

Commit 47ea85c

Browse files
committed
[TASK] Fix PHP 8.4 compatibility
Defaulting to null without being nullable (?Foo) is deprecated for typed parameters in PHP 8.4, therefore nullable is now specified explicitly. This change requires at least PHP 7.1 (which has been made a minimum with the parent commit). Additional the call to str_getcsv is adapted to set all optional arguments as the defaults will change in PHP >= 9 and PHP 8.4 deprecated the omission of the optional arguments. Fixes #31
1 parent 81df285 commit 47ea85c

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/ClassAliasMapGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ClassAliasMapGenerator
4646
* @param Composer $composer
4747
* @param IOInterface $io
4848
*/
49-
public function __construct(Composer $composer, IOInterface $io = null, $config = null)
49+
public function __construct(Composer $composer, ?IOInterface $io = null, $config = null)
5050
{
5151
$this->composer = $composer;
5252
$this->io = $io ?: new NullIO();

src/Config.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Config
3939
* @param PackageInterface $package
4040
* @param IOInterface $io
4141
*/
42-
public function __construct(PackageInterface $package, IOInterface $io = null)
42+
public function __construct(PackageInterface $package, ?IOInterface $io = null)
4343
{
4444
$this->io = $io ?: new NullIO();
4545
$this->setAliasLoaderConfigFromPackage($package);
@@ -55,7 +55,8 @@ public function get($configKey)
5555
throw new \InvalidArgumentException('Configuration key must not be empty', 1444039407);
5656
}
5757
// Extract parts of the path
58-
$configKey = str_getcsv($configKey, '.');
58+
$configKey = str_getcsv($configKey, '.', '"', '\\');
59+
5960
// Loop through each part and extract its value
6061
$value = $this->config;
6162
foreach ($configKey as $segment) {

src/IncludeFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class IncludeFile
4848
* @param TokenInterface[] $tokens
4949
* @param Filesystem $filesystem
5050
*/
51-
public function __construct(IOInterface $io, Composer $composer, array $tokens, Filesystem $filesystem = null)
51+
public function __construct(IOInterface $io, Composer $composer, array $tokens, ?Filesystem $filesystem = null)
5252
{
5353
$this->io = $io;
5454
$this->composer = $composer;

0 commit comments

Comments
 (0)