Skip to content
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

Invalid default value #2396

Closed
xqkeji opened this issue Dec 7, 2022 · 1 comment · Fixed by #2430
Closed

Invalid default value #2396

xqkeji opened this issue Dec 7, 2022 · 1 comment · Fixed by #2430
Assignees

Comments

@xqkeji
Copy link

xqkeji commented Dec 7, 2022

PHP 8.1 Invalid default value

for example:

class Test{
public function t1(int i=0)
{
}
}

var t;
let t=new Test();
t->t1();

Since the call does not take a parameter, it usually passes a null value, so the default value of the parameter cannot be used.

The default value can only be used if the type is changed to var i=0.

@Jeckerson Jeckerson self-assigned this Feb 24, 2023
@Jeckerson Jeckerson linked a pull request Jun 2, 2024 that will close this issue
3 tasks
@Jeckerson
Copy link
Member

I added some tests and it works fine - 02d088e

Please provide example when it occur and what type of error happens.
Closing for now, open if needed.

Jeckerson added a commit that referenced this issue Jun 2, 2024
#2396 - Add test cases with default param value
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 a pull request may close this issue.

2 participants