Skip to content

gen_stub: Fix undefined variable warning #18821

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
Jun 10, 2025

Conversation

TimWolla
Copy link
Member

PHP Warning: Undefined variable $code in build/gen_stub.php on line 5322

Introduced in #18735.

> PHP Warning:  Undefined variable $code in build/gen_stub.php on line 5322

Introduced in php#18735.
@@ -5313,6 +5313,8 @@ function generateGlobalConstantAttributeInitialization(
$constInfos,
"",
static function (ConstInfo $constInfo) use ($allConstInfos, $phpVersionIdMinimumCompatibility) {
$code = "";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW isn't it easier to assign the $code variable on line 5318, instead of concatenating to it, or am I missing something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I felt that it would be more robust to always concatenate to not accidentally overwrite something when refactoring.

@TimWolla TimWolla merged commit 5f9a0b5 into php:master Jun 10, 2025
9 checks passed
@TimWolla TimWolla deleted the gen_stub-warning branch June 10, 2025 13:28
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.

2 participants