Skip to content

Conversation

LolGleb
Copy link
Contributor

@LolGleb LolGleb commented Apr 22, 2025

Reverts #1728

I made a mistake when accepted these changes. I checked what reflection returns and what is in the PHP source code. It turns out that $array is indeed an optional parameter and it's default value is null.

<?php

namespace B;

use ReflectionFunction;

$reflection = new ReflectionFunction('implode');
$parameters = $reflection->getParameters();

foreach ($parameters as $param) {
echo "Parameter: " . $param->getName();
echo "\nRequired: " . ($param->isOptional() ? "No" : "Yes");
echo "\n\n";
}

Output:
Parameter: separator
Required: Yes

Parameter: array
Required: No

@LolGleb LolGleb merged commit b22fb01 into master Apr 22, 2025
22 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant