Comments (5)
Just gonna add some more info related to this.
Template as a reference point:
{% set foobar = foo|map(bar => baz) %}
Tried using the Official ruleset on this, the following was the result:
l.1 c.29 : ERROR There should be 1 space(s) before ">".
When I printed out tokens, the following was the result:
BLOCK_START_TYPE()
ARROW_TYPE( )
NAME_TYPE(set)
ARROW_TYPE( )
NAME_TYPE(foobar)
ARROW_TYPE( )
OPERATOR_TYPE(=)
ARROW_TYPE( )
NAME_TYPE(foo)
PUNCTUATION_TYPE(|)
NAME_TYPE(map)
PUNCTUATION_TYPE(()
NAME_TYPE(bar)
ARROW_TYPE( )
OPERATOR_TYPE(=)
OPERATOR_TYPE(>)
ARROW_TYPE( )
NAME_TYPE(baz)
PUNCTUATION_TYPE())
ARROW_TYPE( )
BLOCK_END_TYPE()
from twigcs.
I've also found out about #69 but I'm not sure whether that means versions older than 4 would not be getting the arrow token support?
from twigcs.
The easiest way to fix this would be to change the numbers of the custom tokens Twigcs introduces but it feels like it's just a workaround. This problem lies inside a greater problem I'm trying to figure out how to solve: keeping up with twig versions in a consistent way.
Nowadays I'm tempted to go with some opinionated choices:
- Stripping the Lexer from the official library, we copy it inside Twigcs and maintain it separately with our needed code (custom tokens, newlines handling): no more collisions, no more twig dependency inside composer, we gain full control on that.
- Killing twigcs 3.x as fast as possible (so many unfixable things like arrow functions)
- Adding Twig 1, 2 and 3 support inside twigcs 4.x before it is out of beta (using 3 rulesets ?)
from twigcs.
I've submitted a PR that will fix this issue here : #114.
from twigcs.
I'm closing this as the PR got merged!
from twigcs.
Related Issues (20)
- Sign PHAR releases HOT 2
- Ability to exclude files (not only dirs) and/or limit sniffing to git diff HOT 1
- Please publish the new release (for symfony 6 use) HOT 2
- Problem when multiple lines HOT 7
- Invalid version value HOT 1
- Support request: How to disable verification of a code fragment? HOT 2
- Support config files with `.php` extension HOT 1
- Spacing of default values in macros HOT 2
- SEVERITY_IGNORE not working
- RegEngine is not happy with breaklines
- Unused variable should not be trigger if the child mutate a parent's variable. HOT 1
- Support for ??? "Empty Coalesce" operator HOT 1
- Variables set and used in loop should not be marked as unused HOT 2
- PHP 8.2 deprecations
- Supporting `createTemplate()`
- Configure cache file location HOT 2
- Avoid useless whitespace control
- Detect Twig depreciations
- PHP 8.3 support HOT 3
- [IMPORTANT] Future of the library HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twigcs.