Commit Graph

98 Commits

Author SHA1 Message Date
Fabien Potencier 65048fa3bb Fix CS 2024-08-18 19:27:14 +02:00
Fabien Potencier 15c0adb3ed Merge branch '3.x' into 4.x
* 3.x:
  Fix CS
2024-08-18 19:26:04 +02:00
Fabien Potencier 675cb2d141 Fix CS 2024-08-18 19:25:19 +02:00
Fabien Potencier d9f52db503 Merge branch '3.x' into 4.x
* 3.x:
  Fix typos in CHANGELOG
2024-08-18 17:54:12 +02:00
Fabien Potencier 84116e5ff7 Fix typos in CHANGELOG 2024-08-18 17:52:16 +02:00
Fabien Potencier aab6d74ce1 Move loop function implementation to CoreExtension 2024-08-17 23:08:38 +02:00
Fabien Potencier 93206a7d4a Merge branch '3.x' into 4.x
* 3.x:
  Add an extension point for parsing special functions
2024-08-17 23:06:33 +02:00
Fabien Potencier 4428079003 Add an extension point for parsing special functions 2024-08-17 18:06:14 +02:00
Fabien Potencier fb06196948 Update loop function parsing 2024-08-17 18:04:49 +02:00
Fabien Potencier 22ff3f4f22 Merge branch '3.x' into 4.x
* 3.x:
  Fix typos in CHANGELOG
  Fix typo
  Fix some minor issues
  Add support for named arguments on special functions
2024-08-17 18:03:35 +02:00
Fabien Potencier 2e43eaa4ad Fix some minor issues 2024-08-16 22:51:19 +02:00
Fabien Potencier 0c30e78b1c Add support for named arguments on special functions 2024-08-16 08:37:24 +02:00
Fabien Potencier 62cc16f548 Merge branch '3.x' into 4.x
* 3.x:
  Remove remaining const optimizations
2024-08-15 20:26:12 +02:00
Simon André c662e0ce27 Remove remaining const optimizations
After #4198 some `Token::` const optimization remains.

This PR remove them.. **in case** it was not intended
2024-08-15 19:11:55 +02:00
Fabien Potencier eaf04e53f0 Remove deprecated code 2024-08-14 23:34:13 +02:00
Fabien Potencier abee6fc583 Merge branch '3.x' into 4.x
* 3.x:
  Move FunctionExpression/FilterExpression/TestExpression attributes from compilation time to parsing time
  Cleanup the implementation of the defined test for constants
2024-08-14 23:07:43 +02:00
Fabien Potencier 3156d8093e Move FunctionExpression/FilterExpression/TestExpression attributes from compilation time to parsing time 2024-08-14 18:45:35 +02:00
Fabien Potencier d7df8844e0 Merge branch '3.x' into 4.x
* 3.x:
  Add missing method in TwigCallableInterface
  Fix TwigCallableInterface
  Simplify code
  Make various optimization for dynamic Twig callables
2024-08-13 18:37:32 +02:00
Fabien Potencier 148d3e079d Make various optimization for dynamic Twig callables 2024-08-12 09:45:32 +02:00
Fabien Potencier c3791fe986 Merge branch '3.x' into 4.x
* 3.x:
  Remove const optimization
2024-08-12 09:43:20 +02:00
Fabien Potencier cd0ac3cc0a Remove const optimization 2024-08-12 09:40:52 +02:00
Fabien Potencier eafbee52e3 Merge branch '3.x' into 4.x
* 3.x:
  Use trigger_deprecation() instead of trigger_error() for deprecations
  Tweak docs
  clarify that macros shadow other macros/functions
2024-08-08 14:47:26 +02:00
Fabien Potencier 0ce79df5c4 Use trigger_deprecation() instead of trigger_error() for deprecations 2024-08-08 14:28:28 +02:00
Fabien Potencier a5882760df Fix CS 2024-08-07 19:37:53 +02:00
Fabien Potencier 1a83f2c95b Use RawFilter 2024-07-28 11:19:22 +02:00
Fabien Potencier fa1a217f1a Add another test 2024-07-28 10:08:38 +02:00
Fabien Potencier c28f68f807 Add support for Escaper and Sandbox for Generator nodes 2024-07-28 10:08:38 +02:00
Fabien Potencier c1933323ba Simplify implementation 2024-07-28 10:08:38 +02:00
Fabien Potencier 8c5dd39b9b Use loop() to recurse instead of loop.recurse() 2024-07-28 10:08:38 +02:00
Fabien Potencier c77354ebad Add missing comment 2024-06-22 19:44:04 +02:00
Fabien Potencier 8dda0153c4 Remove deprecated features 2024-06-22 19:43:36 +02:00
Fabien Potencier 3236429dc8 Merge branch '3.x' into 4.x
* 3.x:
  Fix typo
  Tweak
  Rename array to sequence
  Rename hash to mapping
2024-06-22 19:42:47 +02:00
Fabien Potencier c44be99a84 Rename array to sequence 2024-06-22 19:37:51 +02:00
Fabien Potencier 5157402a77 Rename hash to mapping 2024-06-22 19:36:24 +02:00
Fabien Potencier c250afdda0 Optimize sprintf() calls for PHP 8.4 2024-06-21 08:27:51 +02:00
Fabien Potencier b63bde3063 Optimize sprintf() calls for PHP 8.4 2024-06-21 08:16:55 +02:00
Fabien Potencier f9871531b7 Merge branch '3.x' into 4.x
* 3.x:
  Fxi some errors reported by phpstan
2024-02-05 19:00:15 +01:00
Fabien Potencier 2b2ac80d34 Fxi some errors reported by phpstan 2024-02-05 17:48:36 +01:00
Fabien Potencier af8ec178b6 Remove list() usage in code 2024-01-05 12:46:24 +01:00
Fabien Potencier 35640b6d2d Add type hints to private properties 2023-12-14 20:43:37 +01:00
Fabien Potencier 308aa5ba45 Remove usage of list() 2023-12-09 15:33:38 +01:00
Fabien Potencier fed8dd102b Use ::class 2023-12-09 15:33:38 +01:00
Jérôme Tamarelle fb0d7495a8 Compile Elvis operator with Elvis operator 2023-10-21 19:08:38 +02:00
Jérôme Tamarelle 6d715e2002 Remove unused variables and unreachable code 2023-10-08 21:18:06 +02:00
Ryan Weaver ba4fe3ba34 Adding support for the ...spread operator on arrays and hashes 2023-07-20 16:08:57 +02:00
Fabien Potencier d769ae90d1 feature #3670 Add "some" and "every" filters (Jean-Beru)
This PR was merged into the 3.x branch.

Discussion
----------

Add "some" and "every" filters

This PR adds 2 new tests inspired from Javascript's functions: [some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) and [every](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every).

Usage :
```twig
Value {{ ([1, 2, 3] has some v => v == 2) ? 'found' : 'not found' }}

Key {{ ([1, 2, 3] has some (v, k) => k == 2) ? 'found' : 'not found' }}

Every values {{ ([1, 2, 3] has every v => 42 > v) ? 'match' : 'do not match' }}

Every keys {{ ([1, 2, 3] has every (v, k) => 42 > k) ? 'match' : 'do not match' }}
```

Commits
-------

009bb4fd Add "some" and "every" filters
2022-12-26 17:18:29 +01:00
Vincent Langlet e98a652a6c Improve phpdoc of ExtensionInterface/Environment/Expressionparser arrays 2022-11-18 10:55:01 +01:00
Vincent Langlet de0f947efc Remove internal from ExpressionParser 2022-10-20 22:22:52 +02:00
hubert.lenoir 009bb4fd82 Add "some" and "every" filters 2022-03-25 11:04:50 +01:00
Fabien Potencier 3fef888756 Merge branch '2.x' into 3.x
* 2.x:
  Add a test
  Added token type and value to error message
  Add phpdoc to SecurityPolicyInterface
2022-03-25 09:18:59 +01:00