Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Backport: Make NullEngine return the original keys like other engines #18251

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 2 commits into from
Mar 28, 2025

Conversation

jorisvaesen
Copy link
Contributor

Backport of #18250

Comment on lines +65 to +71
$result = [];

foreach ($keys as $key) {
$result[$key] = $default;
}

return $result;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
$result = [];
foreach ($keys as $key) {
$result[$key] = $default;
}
return $result;
return array_fill_keys($keys, $default);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Keeping foreach since $keys is an iterable.

@dereuromark
Copy link
Member

Best to not maintain 2 PRs here, prioritize the first (5.x) and once merged you can port it (with all changes then done on top) here.

@dereuromark dereuromark marked this pull request as draft March 25, 2025 11:36
@dereuromark dereuromark changed the title Make NullEngine return the original keys like other engines Backport: Make NullEngine return the original keys like other engines Mar 25, 2025
@jorisvaesen
Copy link
Contributor Author

Since #18250 got reviewed and approved, this PR does not need any changes.

@jorisvaesen jorisvaesen marked this pull request as ready for review March 27, 2025 15:21
@othercorey othercorey merged commit 5b45d4e into cakephp:4.x Mar 28, 2025
10 of 11 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.

4 participants