mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 03:46:39 +00:00
d894f92d1254e8c93a4cd12d91ac55e126f0e020
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Support underscores in number literals
```twig
{{ 1000 == 1_000 ? 'yes' : 'no' }}
# now: syntax error
# this PR: "yes"
```
> As of PHP 7.4.0, integer literals may contain underscores (_) between digits, for better readability of literals. These underscores are removed by PHP's scanner.
https://www.php.net/manual/en/language.types.integer.php
This PR replicates that behaviour, using the regexp to match the literals and then remove the "_".
I'm targeting **Twig4** but maybe 3.x would be ok?
I cannot think of a real case that
- does not trigger an error currently
- would work differently after this PR
Commits
-------
da4d96692a Support underscores in number literals
…
Twig, the flexible, fast, and secure template language for PHP
==============================================================
Twig is a template language for PHP.
Twig uses a syntax similar to the Django and Jinja template languages which
inspired the Twig runtime environment.
Sponsors
--------
.. raw:: html
<a href="https://docs.blackfire.io/introduction?utm_source=twig&utm_medium=github_readme&utm_campaign=logo">
<img src="https://static.blackfire.io/assets/intemporals/logo/png/blackfire-io_secondary_horizontal_transparent.png?1" width="255px" alt="Blackfire.io">
</a>
More Information
----------------
Read the `documentation`_ for more information.
.. _documentation: https://twig.symfony.com/documentation
Description
Languages
PHP
99.9%