Commit Graph

5026 Commits

Author SHA1 Message Date
Nate Wiebe
0d4e25f4a6 Rename Translatable class to TranslatableMessage 2020-10-07 07:51:02 +02:00
Nicolas Grekas
6066462be2 Merge branch '5.1' into 5.x
* 5.1:
  Update versions in composer.json
  [Mime] Fix serialization of RawMessage
2020-10-06 17:53:16 +02:00
Nicolas Grekas
3e492d6e5d Merge branch '4.4' into 5.1
* 4.4:
  Update versions in composer.json
  [Mime] Fix serialization of RawMessage
2020-10-06 17:50:31 +02:00
Nicolas Grekas
55396f90a3 Merge branch '3.4' into 4.4
* 3.4:
  Update versions in composer.json
2020-10-06 17:45:41 +02:00
Nicolas Grekas
8f714a2fd6 Update versions in composer.json 2020-10-06 17:25:25 +02:00
Nicolas Grekas
11c4f28137 Merge branch '5.1' into 5.x
* 5.1:
  fix merge
  [appveyor] fix checking for the .x branch
  Remove "branch-alias", populate "version"
2020-10-06 14:00:29 +02:00
Nicolas Grekas
097c8c6f27 Merge branch '4.4' into 5.1
* 4.4:
  [appveyor] fix checking for the .x branch
  Remove "branch-alias", populate "version"
2020-10-06 13:49:34 +02:00
Nicolas Grekas
e553f424d0 Merge branch '3.4' into 4.4
* 3.4:
  Remove "branch-alias", populate "version"
2020-10-06 13:41:17 +02:00
Nicolas Grekas
9d40c796c4 Remove "branch-alias", populate "version" 2020-10-06 13:22:52 +02:00
Maxime Hélias
28d1169714 [DoctrineBridge] fix and replace namespace to Uid 2020-10-05 23:45:00 +02:00
Fabien Potencier
2be67879b9 feature #38307 [Form] Implement Twig helpers to get field variables (tgalopin)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Form] Implement Twig helpers to get field variables

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/14308

Designing Symfony Forms has always been difficult, especially for developers not comfortable with Symfony or Twig. The reason behind this difficulty is that the current `form_*` helper functions, while providing a way to quickly render a form, are hiding the generated HTML behind a notation specific to Symfony.

HTML standards introduced many new attributes since the Form component was created, from new constraints to how should inputs be displayed, treated by screen readers, etc.

I propose to introduce a series of new Twig functions to help create more flexible forms without the hurdle of having to use `form_*` functions. I called these methods `field_*` because they aim at rendering only the tiny bits of strings necessary to map forms to the Symfony backend.

The functions introduced are:

* `field_name` returns the name of the given field
* `field_value` returns the current value of the given field
* `field_label` returns the label of the given field, translated if possible
* `field_help` returns the help of the given field, translated if possible
* `field_errors` returns an iterator of strings for each of the errors of the given field
* `field_choices` returns an iterator of choices (the structure depending on whether the field uses or doesn't use optgroup) with translated labels if possible as keys and values as values

A quick example of usage of these functions could be the following:

``` twig
<input
    name="{{ field_name(form.username) }}"
    value="{{ field_value(form.username) }}"
    placeholder="{{ field_label(form.username) }}"
    class="form-control"
/>

<select name="{{ field_name(form.country) }}" class="form-control">
    <option value="">{{ field_label(form.country) }}</option>

    {% for label, value in field_choices(form.country) %}
        <option value="{{ value }}">{{ label }}</option>
    {% endfor %}
</select>

<select name="{{ field_name(form.stockStatus) }}" class="form-control">
    <option value="">{{ field_label(form.stockStatus) }}</option>

    {% for groupLabel, groupChoices in field_choices(form.stockStatus) %}
        <optgroup label="{{ groupLabel }}">
            {% for label, value in groupChoices %}
                <option value="{{ value }}">{{ label }}</option>
            {% endfor %}
        </optgroup>
    {% endfor %}
</select>

{% for error in field_errors(form.country) %}
    <div class="text-danger mb-2">
        {{ error }}
    </div>
{% endfor %}
```

There are several advantages to using these functions instead of their `form_*` equivalents:

* they are much easier to use for developers not knowing Symfony: they rely on native HTML with bits of logic inside, instead of relying on specific tools needing to be configured to display proper HTML
* they allow for better integration with CSS frameworks or Javascript libraries as adding a new HTML attribute is trivial (no need to look at the documentation)
* they are easier to use in contexts where one would like to customize the rendering of a input in details: having the label as placeholder, displaying a select empty field, ...

The `form_*` functions are still usable of course, but I'd argue this technique is actually easier to read and understand.

Commits
-------

3941d70928 [Form] Implement Twig helpers to get field variables
2020-10-03 11:48:50 +02:00
Nicolas Grekas
9d6333a7ff Merge branch '5.1'
* 5.1:
  [5.1] Ignore more deprecations for Mockery mocks
  [PhpUnitBridge] Fix Deprecation file when it comes from the TestsListener
  disallow FrameworkBundle 4.4+
  propagate validation groups to subforms
  [Form] [Validator] Add failing testcase to demonstrate group sequence issue
2020-10-02 15:09:26 +02:00
Thomas Calvet
1ba06a0f86 [PhpUnitBridge] Fix Deprecation file when it comes from the TestsListener 2020-10-02 14:57:56 +02:00
Thomas Calvet
1a801e8452 [4.4] Ignore more deprecations for Mockery mocks 2020-10-02 09:34:48 +02:00
Titouan Galopin
3941d70928 [Form] Implement Twig helpers to get field variables 2020-09-30 12:00:15 +02:00
Fabien Potencier
3f51de3ee8 Merge branch '5.1'
* 5.1:
  [FrameworkBundle] Add Mailjet definition
  Revert "bug #38063 [FrameworkBundle] generate preload.php in src/ to make opcache.preload predictable (nicolas-grekas)"
  [PhpUnitBridge] Fix class_alias() for PHPUnit\Framework\Error\Error
2020-09-30 07:29:43 +02:00
Fabien Potencier
65ee6c9f88 Merge branch '4.4' into 5.1
* 4.4:
  Revert "bug #38063 [FrameworkBundle] generate preload.php in src/ to make opcache.preload predictable (nicolas-grekas)"
  [PhpUnitBridge] Fix class_alias() for PHPUnit\Framework\Error\Error
2020-09-30 07:27:28 +02:00
Fabien Potencier
72ff4012a5 bug #38336 [PhpUnitBridge] Fixed class_alias() for PHPUnit\Framework\Error\Error (stevegrunwell)
This PR was merged into the 4.4 branch.

Discussion
----------

[PhpUnitBridge] Fixed class_alias() for PHPUnit\Framework\Error\Error

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | n/a
| License       | MIT
| Doc PR        | n/a

PHPUnit 6.x removed the PHPUnit_Framework_* classes in favor of PHP namespaces, but one error class did not map the same as the others: `PHPUnit_Framework_Error`.

Instead of mapping to `PHPUnit\Framework\Error` in the same way that `PHPUnit_Framework_Error_Warning` mapped to `PHPUnit\Framework\Error\Warning`, this base class was replaced with `PHPUnit\Framework\Error\Error`, so we cannot map it using simple string replacement like its descendants.

Commits
-------

8e607b58df [PhpUnitBridge] Fix class_alias() for PHPUnit\Framework\Error\Error
2020-09-29 08:53:53 +02:00
Steve Grunwell
8e607b58df [PhpUnitBridge] Fix class_alias() for PHPUnit\Framework\Error\Error
PHPUnit 6.x removed the PHPUnit_Framework_* classes in favor of PHP namespaces, but one error class did not map the same as the others: `PHPUnit_Framework_Error`.

Instead of mapping to `PHPUnit\Framework\Error` in the same way that `PHPUnit_Framework_Error_Warning` mapped to `PHPUnit\Framework\Error\Warning`, this base class was replaced with `PHPUnit\Framework\Error\Error`.
2020-09-28 16:03:26 -04:00
Nicolas Grekas
9224f7ac5b [Contracts] add TranslatableInterface 2020-09-28 15:05:58 +02:00
Nicolas Grekas
6349a1b2fc Merge branch '5.1'
* 5.1:
  [HttpFoundation] skip tests when the IANA server is throttling the list of status codes
  [DoctrineBridge] fix DBAL v3 compat
2020-09-27 16:15:50 +02:00
Nicolas Grekas
66758ad5dc Merge branch '4.4' into 5.1
* 4.4:
  [HttpFoundation] skip tests when the IANA server is throttling the list of status codes
  [DoctrineBridge] fix DBAL v3 compat
2020-09-27 16:14:57 +02:00
Nicolas Grekas
cbb0b1d54b Merge branch '3.4' into 4.4
* 3.4:
  [HttpFoundation] skip tests when the IANA server is throttling the list of status codes
  [DoctrineBridge] fix DBAL v3 compat
2020-09-27 16:14:06 +02:00
Nicolas Grekas
4b1612b8dd [DoctrineBridge] fix DBAL v3 compat 2020-09-27 16:06:58 +02:00
Fabien Potencier
6a5571552f Fix CS 2020-09-26 07:26:20 +02:00
Steve Grunwell
7877a5b488 [PhpUnitBridge] Enable a maximum PHPUnit version to be set via SYMFONY_MAX_PHPUNIT_VERSION 2020-09-25 14:59:28 -04:00
Jordan de Laune
96a0e5fca1 Register the binary types as well 2020-09-25 07:57:18 +02:00
Manuel Alejandro Paz Cetina
33e78b43a4 Always require SQL comment hint 2020-09-23 01:30:05 -05:00
Fabien Potencier
90056b871a feature #38176 [Config] Adding the "info" to a missing option error messages (weaverryan)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Config] Adding the "info" to a missing option error messages

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | None
| License       | MIT
| Doc PR        | Not needed

New error:

<img width="1063" alt="Screen Shot 2020-09-13 at 10 51 32 AM" src="https://user-images.githubusercontent.com/121003/93021186-6329ff00-f5af-11ea-83c6-98581b12ef75.png">

I used the missing `class` just as an example. I hit this while building a new feature in Symfony. It occurred to me that if, for example, you activate some feature in config and that feature has a required sub-key, why not print the `info()` for that sub key to make it discoverable?

Commits
-------

3780f122c7 adding the description to a missing option
2020-09-22 11:20:33 +02:00
Fabien Potencier
e9071e6a4d bug #38250 Return AbstractUid as string (lexthink)
This PR was merged into the 5.2-dev branch.

Discussion
----------

Return AbstractUid as string

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Should return AbstractUidType as string.

Commits
-------

1a9d76a869 Return AbstractUid as string
2020-09-22 06:58:01 +02:00
Christian Flothmann
61bfea459b fix tests 2020-09-21 10:49:48 +02:00
Manuel Alejandro Paz Cetina
1a9d76a869
Return AbstractUid as string 2020-09-21 00:26:47 -05:00
Christian Flothmann
ccecffeff6 Merge branch '5.1' into master
* 5.1: (25 commits)
  stop using the deprecated at() PHPUnit matcher
  fix lowest allowed version of the HTTP client contracts
  fix lowest allowed version for the PHPUnit bridge
  fix merge
  fix merge
  drop logger mock in favor of using the BufferingLogger
  catch ValueError thrown on PHP 8
  [Yaml Parser] Fix edge cases when parsing multiple documents
  fix parsing comments not prefixed by a space
  [Translator] Make sure a null locale is handled properly
  deal with errors being thrown on PHP 8
  loadRoutes shoud receive RoutingPhpFileLoader
  [Cache] Allow cache tags to be objects implementing __toString()
  [HttpKernel] Do not override max_redirects option in HttpClientKernel
  Log notice when no entry point is configured
  remove superfluous cast
  [HttpClient] Support for CURLOPT_LOCALPORT.
  Upgrade PHPUnit to 8.5 (php 7.2) and 9.3 (php >= 7.3).
  Fixed exception message formatting
  [FrameworkBundle] Fix error in xsd which prevent to register more than one metadata
  ...
2020-09-20 09:20:17 +02:00
Christian Flothmann
4ee591bec6 Merge branch '4.4' into 5.1
* 4.4:
  fix merge
  drop logger mock in favor of using the BufferingLogger
  catch ValueError thrown on PHP 8
  [Yaml Parser] Fix edge cases when parsing multiple documents
  fix parsing comments not prefixed by a space
  [Translator] Make sure a null locale is handled properly
  deal with errors being thrown on PHP 8
  [Cache] Allow cache tags to be objects implementing __toString()
  [HttpKernel] Do not override max_redirects option in HttpClientKernel
  remove superfluous cast
  [HttpClient] Support for CURLOPT_LOCALPORT.
  Upgrade PHPUnit to 8.5 (php 7.2) and 9.3 (php >= 7.3).
  Fixed exception message formatting
  [FrameworkBundle] Fix error in xsd which prevent to register more than one metadata
  [Console] work around disabled putenv()
  [PhpUnitBridge] Fix error with ReflectionClass
  [HttpClient][HttpClientTrait] don't calculate alternatives if option is auth_ntlm
  Change 'cache_key' to AbstractRendererEngine::CACHE_KEY_VAR
  Upgrade PHPUnit to 8.5 (php 7.2) and 9.3 (php >= 7.3).
2020-09-18 16:27:32 +02:00
pvgnd
0fb14394ca Use composition instead of inheritance in HttpCodeActivationStrategy 2020-09-18 10:50:00 +02:00
Alexey Kopytko
ed1bffeed7
[PhpUnitBridge] Fix error with ReflectionClass 2020-09-15 16:51:47 +09:00
Alexander M. Turek
ff47516ea0 Upgrade PHPUnit to 8.5 (php 7.2) and 9.3 (php >= 7.3). 2020-09-14 08:11:19 +02:00
Ryan Weaver
3780f122c7 adding the description to a missing option 2020-09-13 10:51:40 -04:00
Fabien Potencier
3b1ab7bfac Merge branch '5.1'
* 5.1:
  Internal classes are not legacy.
  [HttpFoundation] Skip the cookie_max_age fixture on PHP 8.
  add choice_translation_domain tests to prevent further regressions
  Update validators.tr.xlf
2020-09-13 07:01:37 +02:00
Fabien Potencier
9fae49fb20 Merge branch '4.4' into 5.1
* 4.4:
  Internal classes are not legacy.
  [HttpFoundation] Skip the cookie_max_age fixture on PHP 8.
  add choice_translation_domain tests to prevent further regressions
  Update validators.tr.xlf
2020-09-13 07:01:27 +02:00
Fabien Potencier
f2e7158bc0 Merge branch '3.4' into 4.4
* 3.4:
  [HttpFoundation] Skip the cookie_max_age fixture on PHP 8.
  add choice_translation_domain tests to prevent further regressions
  Update validators.tr.xlf
2020-09-13 07:00:26 +02:00
Alexander M. Turek
7d55e0c065 Internal classes are not legacy. 2020-09-12 23:46:40 +02:00
Christian Flothmann
7775b3707b add choice_translation_domain tests to prevent further regressions 2020-09-12 15:01:37 +02:00
Nicolas Grekas
908ca446e9 [MonologBridge] fix tests 2020-09-08 17:01:05 +02:00
Nicolas Grekas
d96c7a0f40 Merge branch '5.1'
* 5.1:
  [Debug] fix test
  consistently use same types for strict comparisons
  [PhpUnitBridge] Skip internal classes in CoverageListenerTrait
  [VarExporter] unserialize() might throw an Exception on php 8.
  [SecurityHttp] Don't call createMock() with multiple interfaces.
  [ErrorHandler] Parse "x not found" errors correctly on php 8.
  Prevent parsing invalid octal digits as octal numbers
  remove unnecessary check for  existing request
  [DI] fix ContainerBuilder on PHP8
  [Console] Make sure $maxAttempts is an int or null.
  [VarDumper] Fix caster for invalid SplFileInfo objects on php 8.
  [Intl] Skip test cases that produce a TypeError on php 8.
  [PhpUnitBridge] Adjust output parsing for PHPUnit 9.3.
  [PhpUnitBridge] CoverageListenerTrait update for PHPUnit 8.5/9.x
  add bosnian (bs) translation
  [Debug] Parse "x not found" errors correctly on php 8.
2020-09-08 16:20:09 +02:00
Nicolas Grekas
62a4559619 Merge branch '4.4' into 5.1
* 4.4:
  [Debug] fix test
  consistently use same types for strict comparisons
  [PhpUnitBridge] Skip internal classes in CoverageListenerTrait
  [VarExporter] unserialize() might throw an Exception on php 8.
  [ErrorHandler] Parse "x not found" errors correctly on php 8.
  Prevent parsing invalid octal digits as octal numbers
  remove unnecessary check for  existing request
  [DI] fix ContainerBuilder on PHP8
  [Console] Make sure $maxAttempts is an int or null.
  [VarDumper] Fix caster for invalid SplFileInfo objects on php 8.
  [Intl] Skip test cases that produce a TypeError on php 8.
  [PhpUnitBridge] Adjust output parsing for PHPUnit 9.3.
  [PhpUnitBridge] CoverageListenerTrait update for PHPUnit 8.5/9.x
  add bosnian (bs) translation
  [Debug] Parse "x not found" errors correctly on php 8.
2020-09-08 16:19:54 +02:00
Christian Flothmann
261a939ea6 Merge branch '3.4' into 4.4
* 3.4:
  Prevent parsing invalid octal digits as octal numbers
  [DI] fix ContainerBuilder on PHP8
  [Console] Make sure $maxAttempts is an int or null.
  [VarDumper] Fix caster for invalid SplFileInfo objects on php 8.
  [Intl] Skip test cases that produce a TypeError on php 8.
  [PhpUnitBridge] Adjust output parsing for PHPUnit 9.3.
  [PhpUnitBridge] CoverageListenerTrait update for PHPUnit 8.5/9.x
  add bosnian (bs) translation
  [Debug] Parse "x not found" errors correctly on php 8.
2020-09-08 13:16:46 +02:00
Alexey Kopytko
a0dedb9aa6 [PhpUnitBridge] Skip internal classes in CoverageListenerTrait 2020-09-08 09:26:14 +02:00
Fabien Potencier
3ba965a6cd feature #37704 [MonologBridge] Added SwitchUserTokenProcessor to log the impersonator (IgorTimoshenko)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[MonologBridge] Added SwitchUserTokenProcessor to log the impersonator

| Q             | A
| ------------- | ---
| Branch?       | master <!-- see below -->
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

This pull request adds the ability to log the impersonator user in case of user impersonation feature usage. The current TokenProcessor logs only the current token and there are no ability to simply log the original token, so we need to copy-paste the TokenProcessor and change a few lines to log the original token

Commits
-------

2f8651d4ec [MonologBridge] Added SwitchUserTokenProcessor to log the impersonator
2020-09-07 15:03:25 +02:00
Igor Timoshenko
2f8651d4ec [MonologBridge] Added SwitchUserTokenProcessor to log the impersonator 2020-09-07 15:03:17 +02:00