Add Shopify Liquid v5.13 compatibility#62
Merged
Merged
Conversation
Reject dotted and bracketed assignment targets in assign, capture,
increment, and decrement at parse time. Previously these were silently
accepted but produced unreachable state (e.g. {% assign foo.bar = "x" %}
set a flat key "foo.bar" invisible to normal variable lookup).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…atibility
SelfDrop is a proxy object that resolves property lookups through the
current render context's scope chain. It does not implement IsContextAware,
so a SelfDrop passed explicitly to a partial via `render` retains its
original context rather than being rebound to the partial's isolated scope.
RenderContext caches one SelfDrop per context instance so that repeated
`self` lookups within the same context return the identical PHP object,
making === equality work through the existing condition evaluation logic.
The fallback is injected in findVariables() only when no value at all was
found for key "self". An explicit `{% assign self = nil %}` leaves [null]
in the variable list, so the SelfDrop fallback is correctly skipped.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…0.11.0) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add four tests that were in Shopify's self_drop_context_test.rb but not previously ported: - Same-variable-name collision across render boundary: passed self holds caller's value while partial's implicit self holds its own (42|43) - Three-level nested render with the same variable shadowed at each level: outer.a|middle.a|self.a = 1|2|3 - Assigned self compares equal to itself (s == s) - Defined key on self resolves correctly under strict variables Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- add shared simple-variable validation for assign, capture, and increment - reject invalid capture and expression syntax with updated tests
…ries Add SyntaxException::expectedSimpleVariable() and tagSyntaxException() so the generic "expected a plain variable name" signal is raised in one place (TokenStream::simpleVariableName) and each tag enriches it with its own valid-syntax hint on catch, rather than each tag owning its full error string. - Remove SYNTAX_ERROR constants from AssignTag and CaptureTag - Narrow AssignTag's broad catch to just the simpleVariableName() call - Use static::tagName() in IncrementTag so DecrementTag inherits correctly - Chain the original SyntaxException as $previous for debuggability - Update all test expectations to the new message format Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add `self` drop support for scoped lookups and render boundaries - Reject dotted and bracketed assign/capture/increment targets earlier - Update syntax errors and integration coverage
- Wrap tag parsers with consistent syntax context - Update invalid-usage messages and tests to use angle-bracket syntax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
selfdrop support so templates can readself.foo,self[key], and passselfacross render boundaries with correct scope behavior.assign,capture,increment, anddecrementso dotted and bracketed targets now fail at parse time.selflookup behavior, nested partials, null handling, and parser rejection cases.Testing
tests/Integration/SelfDropTest.phpcovering property lookup, bracket lookup, partial scope isolation, and regression cases.tests/Integration/Tags/AssignTagTest.php,tests/Integration/Tags/CaptureTagTest.php, andtests/Integration/Tags/IncrementTagTest.php.