Skip to content

[Console] Fix PHP deprecation when question value is null #61123

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

Open
wants to merge 1 commit into
base: 6.4
Choose a base branch
from

Conversation

willemverspyck
Copy link
Contributor

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues #61122
License MIT

Add nullsafe and add NULL to test to catch the PHP deprecation.

@willemverspyck willemverspyck requested a review from chalasr as a code owner July 15, 2025 08:21
@carsonbot carsonbot added this to the 6.4 milestone Jul 15, 2025
@willemverspyck willemverspyck changed the title Fix PHP deprecation when question value is NULL [Console] Fix PHP deprecation when question value is NULL Jul 15, 2025
@willemverspyck willemverspyck marked this pull request as draft July 15, 2025 08:24
Fix test

Fix another 2 deprecations

Fix test

Fix test
@willemverspyck
Copy link
Contributor Author

Not sure if I have to fix the fabbot.io error, because I didn't change that line.

@willemverspyck willemverspyck marked this pull request as ready for review July 15, 2025 09:37
@OskarStark OskarStark changed the title [Console] Fix PHP deprecation when question value is NULL [Console] Fix PHP deprecation when question value is null Jul 15, 2025
@stof
Copy link
Member

stof commented Jul 15, 2025

In the issue itself, you say yourselves

The value of the ChoiceQuestion array should not be NULL, but I can happen

I think you should rather fix your code to avoid passing null

@ro0NL
Copy link
Contributor

ro0NL commented Jul 16, 2025

IIUC from the issue 3 => null, is the problem, and im wondering why SA tools arent telling us. Should we fix a phpdoc instead?

@willemverspyck
Copy link
Contributor Author

@stof I understand, but probably in PHP 8 you will get an error instead of a deprecation and developers might think the problem is in the Symfony core. But now I think more about this, maybe it's better to check if the value is a string or is stringable, otherwise throw an exception with "Must be string or stringable"? Didn't check, but probably you can also pass a integer (that will work as long as isn't strict), object or array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants