Skip to content

Revert "Remove second parameter incorrect nullable" #1736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2025

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