Commit Graph

229 Commits

Author SHA1 Message Date
Fabien Potencier a23cd9feeb Fix CS 2024-09-26 21:22:23 +02:00
Christian Flothmann c5486b07b9 fix intl-extra tests 2024-09-16 12:21:35 +02:00
Fabien Potencier a240eff47e Simplify code 2024-09-10 08:27:46 +02:00
Fabien Potencier 722a5fb027 feature #4266 Prepare IntegrationTestCase for static data providers (derrabus)
This PR was merged into the 3.x branch.

Discussion
----------

Prepare IntegrationTestCase for static data providers

Data providers need to be static in PHPUnit 11. Because of this, I'd like to declare the two methods we use as data providers in `IntegrationTestCase` as static in 4.0. This PR prepares that change:

* The non-static `getFixturesDir()` method is replaced with a static `getFixturesDirectory()`.
* Both methods `getTests()` and `getLegacyTests()` are marked as final, so we can declare them static in the next major.

This however means that we're delaying PHPUnit 11 compatibility of integration tests to Twig 4.0. If that's too late for us, we could deprecate the whole `IntegrationTestCase` in favor of a compatible replacement. That's a bigger change, but I would work on it if you think it's worth it.

Commits
-------

18f42038 Prepare IntegrationTestCase for static data providers
2024-09-03 22:17:35 +02:00
Alexander M. Turek 6ddb76bb76 Make data providers static 2024-09-03 16:32:00 +02:00
Alexander M. Turek 18f4203827 Prepare IntegrationTestCase for static data providers 2024-09-03 15:08:40 +02:00
Fabien Potencier 976cea0403 Fix tests 2024-09-01 22:54:59 +02:00
Fabien Potencier 031c7bda4d Allow extra extensions to use Twig 4 2024-09-01 22:39:12 +02:00
Fabien Potencier 5fca700cbd Deprecate the fact that the extends and use tags are always allowed in a sandboxed template 2024-08-28 13:40:53 +02:00
Fabien Potencier 2511b658da Fix tests 2024-08-26 17:29:01 +02:00
Fabien Potencier 675cb2d141 Fix CS 2024-08-18 19:25:19 +02:00
Matheo Daninos e3ac14e1c8 Introduce CVA to html-extra 2024-08-18 09:36:16 +02:00
Ruud Kamphuis 8ef12588ea Remove escape 2024-08-11 18:59:31 +02:00
Fabien Potencier c070cd719c Drop support for 8.0 2024-08-10 12:32:24 +02:00
Fabien Potencier f5e10e10f1 Fix CS 2024-08-07 19:34:09 +02:00
Fabien Potencier 8e72c84c63 Use RawFilter in cache extra 2024-07-28 11:12:39 +02:00
Fabien Potencier 82d31319bb Fix tests 2024-07-05 07:59:36 +02:00
Fabien Potencier 0bbe173d29 feature #4107 [String] Add singularize and pluralize filter (welcoMattic, fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

[String] Add singularize and pluralize filter

This PR follows up this one in Symfony https://github.com/symfony/symfony/pull/57245.

It adds 2 new filters `singularize` and `pluralize`. It uses the String component, especially `EnglishInflector` and `FrenchInflector`.

Examples:

```php
{{ 'person'|pluralize('en') }} // persons
{{ 'person'|pluralize('en', false) }} // ['persons', 'people']

{{ 'personne'|pluralize('fr') }} // personnes
{{ 'personne'|pluralize('fr', false) }} // ['personnes']

{{ 'persons'|singluarize('en') }} // person
{{ 'people'|singluarize('en') }} // person
{{ 'persons'|singluarize('en', false) }} // ['person']

{{ 'personnes'|singluarize('fr') }} // personne
{{ 'personnes'|singluarize('fr', false) }} // ['personne']

{{ 'persona'|pluralize('it') }} // \InvalidArgumentException('Language "it" is not supported.')
{{ 'persone'|singluarize('it') }} // \InvalidArgumentException('Language "it" is not supported.')
```

Commits
-------

8c969d40 Tweak code and docs
cb392489 feat(string-extra): Add singularize and pluralize filter
2024-07-05 07:54:10 +02:00
Fabien Potencier 8c969d403c Tweak code and docs 2024-07-04 08:17:15 +02:00
Mathieu Santostefano cb392489c3 feat(string-extra): Add singularize and pluralize filter 2024-07-02 22:44:09 +02:00
Fabien Potencier da4592793b minor #4109 Update PHPUnit config (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Update PHPUnit config

Commits
-------

b78dee86 Update PHPUnit config
2024-06-21 08:25:01 +02:00
Fabien Potencier b78dee8682 Update PHPUnit config 2024-06-21 08:22:31 +02:00
Fabien Potencier b63bde3063 Optimize sprintf() calls for PHP 8.4 2024-06-21 08:16:55 +02:00
Fabien Potencier 761aa56a6f Revert "minor #4042 Auto-close PRs on subtree-splits (kbond)"
This reverts commit 12625c0c05, reversing
changes made to ad934312cd.
2024-05-11 09:35:57 +02:00
Fabien Potencier 318f7b8bb6 Fix typo 2024-05-11 09:09:43 +02:00
Fabien Potencier 55ae21493b Add more tests 2024-05-11 08:59:04 +02:00
Fabien Potencier d30b72c364 Fix blocks not available under some circumstancies 2024-05-11 08:44:27 +02:00
Fabien Potencier b222be9974 Fix CS 2024-05-01 16:06:53 +02:00
Fabien Potencier 283475b102 Move some static extension methods to non-static 2024-05-01 13:48:35 +02:00
Fabien Potencier a19ec5b200 Fix method call 2024-05-01 11:02:32 +02:00
Fabien Potencier 68a826cf61 minor #3969 [html-extra] filter classes (kbond)
This PR was merged into the 3.x branch.

Discussion
----------

[html-extra] filter classes

A small formatting change to avoid double spaces:

```twig
class="{{ html_classes('a', false ? 'b', true ? 'c') }}"

{# before #}
class="a  c"

{# after #}
class="a c"
```

Commits
-------

a517c14f [html-extra] filter classes
2024-04-29 21:43:39 +02:00
Kevin Bond a517c14f19 [html-extra] filter classes 2024-04-29 21:42:05 +02:00
Kevin Bond b212f1bb2f Auto-close PRs on subtree-splits 2024-04-19 08:34:22 +02:00
Christian Flothmann b61a422493 change extended DI extension class 2024-04-18 11:24:21 +02:00
benedikt brunner 5d903b6325 Require correct twig core version 2024-04-17 12:41:53 +00:00
Sébastien Alfaiate 7e8f5eb1a5 Fix exception when timezone is false 2024-04-03 17:08:24 +02:00
Fabien Potencier f7f11ea410 Fix CS 2024-02-10 09:52:03 +01:00
Christian Flothmann d9d7e136c1 fix TwigExtraBundle tests with Symfony 6.0/6.1 2024-02-07 09:24:24 +01:00
Fabien Potencier 7e1945a618 minor #3991 Fix some errors reported by phpstan (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix some errors reported by phpstan

Commits
-------

2b2ac80d Fxi some errors reported by phpstan
2024-02-05 18:59:35 +01:00
Fabien Potencier 2b2ac80d34 Fxi some errors reported by phpstan 2024-02-05 17:48:36 +01:00
Fabien Potencier 14d3803647 Add a deprecation when a Node uses echo/print 2024-01-25 13:09:58 +01:00
Fabien Potencier 210e2d2b9e Fix tests 2024-01-25 13:09:58 +01:00
Fabien Potencier b1a8feaa55 Remove support for Twig 2.x and unmaintained Symfony versions 2024-01-25 08:19:28 +01:00
Fabien Potencier 6ebbc30593 Abstract node capture in its own Node 2023-12-30 10:14:36 +01:00
Fabien Potencier 44b3bac552 Fix intl tests 2023-12-24 09:42:15 +01:00
Fabien Potencier aa7c454e2d Fix CS 2023-12-10 20:34:32 +01:00
Fabien Potencier 54d34b969b Move functions for CoreExtension 2023-12-10 20:13:10 +01:00
Fabien Potencier 69a89e0e77 Move functions for MarkdownExtension 2023-12-09 18:39:03 +01:00
Fabien Potencier e07e9b5be3 Move functions for InkyExtension 2023-12-09 18:39:03 +01:00
Fabien Potencier bff189f19a Move functions for CssInlinerExtension 2023-12-09 18:39:03 +01:00