Skip to content

feat: support clone with arguments - #306

Merged
calebdw merged 5 commits into
tree-sitter:masterfrom
janwaleed09:feat/php85-clone-with
Oct 6, 2026
Merged

calebdw merged 5 commits into
tree-sitter:masterfrom
janwaleed09:feat/php85-clone-with

Conversation

@janwaleed09

@janwaleed09 janwaleed09 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Adds support for PHP 8.5 clone with arguments (RFC):

clone($a, ['foo' => 1]);
clone(object: $a, withProperties: ['foo' => 1]);

clone($x) still parses like before, same as in php-src.

@janwaleed09

Copy link
Copy Markdown
Contributor Author

Hi @calebdw , friendly ping on this one. The CI needs your approval because it's my first PR here. On my fork it passes: https://github.com/janwaleed09/tree-sitter-php/actions/runs/36580018919
If you prefer a different approach, I'm happy to change it.

DavidBakerEffendi added a commit to BrokkAi/tree-sitter-php that referenced this pull request Oct 5, 2026
Backport Jan Mohr's upstream PR tree-sitter#306 grammar change on the maintained 0.24.2 base, preserving promoted-property support, MIT attribution, and Brokk native symbols.

Expose PHP 8.5 clone argument lists while retaining legacy clone ASTs. Regenerate both dialects with CLI 0.25.8 and cover positional/named arguments, callable cloning, full declaration ranges, and malformed syntax. Align release metadata at 0.24.4.

Validation: exact-head Linux, Windows, and macOS CI plus lint passed; both full grammar corpora, Rust binding and differential regressions, package and publish dry runs passed. Reproduced the historical snippet and pinned Slink file with zero parser errors.
@calebdw
calebdw force-pushed the feat/php85-clone-with branch 2 times, most recently from 5e0d8ed to 3384967 Compare October 6, 2026 16:21
calebdw and others added 4 commits October 6, 2026 11:37
Adding those keywords to shared argument names made OBJECT a keyword
in every call. WordPress passes that constant to get_post and get_term,
so example parsing failed. Accept the keyword as a name unless a colon
or call continues it.
tree-sitter/workflows release.yml no longer accepts
`attestations`; provenance is always generated there. The extra
input made the whole Publish packages workflow fail to start.
PHP 8.5 clone-with is a grammar addition, not a breaking change.
ABI remains 15.
@calebdw
calebdw force-pushed the feat/php85-clone-with branch from 3384967 to 0742412 Compare October 6, 2026 16:37
@calebdw
calebdw merged commit 58d5643 into tree-sitter:master Oct 6, 2026
4 checks passed
@calebdw

calebdw commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Thanks!

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.

2 participants