Skip to content

PHP 7.4 | Syntax/NewArrayUnpacking: add XML documentation#2021

Merged
jrfnl merged 3 commits intoPHPCompatibility:developfrom
okkun-sh:docs/Syntax/NewArrayUnpacking
Dec 14, 2025
Merged

PHP 7.4 | Syntax/NewArrayUnpacking: add XML documentation#2021
jrfnl merged 3 commits intoPHPCompatibility:developfrom
okkun-sh:docs/Syntax/NewArrayUnpacking

Conversation

@okkun-sh
Copy link
Copy Markdown
Contributor

Summary

Add XML documentation for the Syntax/NewArrayUnpacking sniff.

This contributes to #1285.

Thanks!

Copy link
Copy Markdown
Member

@jrfnl jrfnl left a comment

Choose a reason for hiding this comment

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

@okkun-sh Thanks for continuing your work on the documentation!

Just one question - would it make sense to maybe show some more alternatives on the "cross-version compatible" side of the comparison ?

For example:

$a = [2, 3];
$c = [0, 1, 4, 5];
array_splice($c, 2, 0, $a);

... is also equivalent to $b = [0, 1, ...$a, 4, 5]; (with $c being changed by reference in the array_splice())

See: https://3v4l.org/v0hs7

@okkun-sh
Copy link
Copy Markdown
Contributor Author

Just one question - would it make sense to maybe show some more alternatives on the "cross-version compatible" side of the comparison ?

@jrfnl
Thanks for the feedback!
That makes sense.

I didn't find a better example, so I will use the array_splice() example you suggested.

okkun-sh and others added 2 commits December 15, 2025 01:04
Co-authored-by: Juliette <663378+jrfnl@users.noreply.github.com>
@okkun-sh okkun-sh requested a review from jrfnl December 14, 2025 16:41
@okkun-sh
Copy link
Copy Markdown
Contributor Author

@jrfnl
Updated based on your feedback!

Copy link
Copy Markdown
Member

@jrfnl jrfnl left a comment

Choose a reason for hiding this comment

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

Thanks for those updates @okkun-sh ! LGTM.

@jrfnl jrfnl merged commit 4ec082e into PHPCompatibility:develop Dec 14, 2025
37 checks passed
@okkun-sh okkun-sh deleted the docs/Syntax/NewArrayUnpacking branch December 15, 2025 14:20
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