Commit Graph

53662 Commits

Author SHA1 Message Date
Nicolas Grekas
60ce52f503 Merge branch '5.2' into 5.x
* 5.2:
  fix merge
2021-02-25 18:37:08 +01:00
Nicolas Grekas
5854d55aef fix merge 2021-02-25 18:36:22 +01:00
Nicolas Grekas
cd59bfa080 Merge branch '5.2' into 5.x
* 5.2:
  [HttpKernel] Configure `session.cookie_secure` earlier
  Make sure the Psalm review CI job is working
  Adding a Github action to run Psalm
2021-02-25 18:20:06 +01:00
Nicolas Grekas
d978bea326 Merge branch '4.4' into 5.2
* 4.4:
  [HttpKernel] Configure `session.cookie_secure` earlier
  Make sure the Psalm review CI job is working
  Adding a Github action to run Psalm
2021-02-25 18:16:57 +01:00
Nicolas Grekas
87aeb8da13 bug #40231 [HttpKernel] Configure session.cookie_secure earlier (tamcy)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpKernel] Configure `session.cookie_secure` earlier

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #40221
| License       | MIT
| Doc PR        | N/A

This PR does what @stof had suggested in #40221, allow me to quote him directly:

> 1. avoid setting auto as a value for the ini setting in the NativeSessionStorage initialization
> 2. ensuring that SessionListener resolves the auto value by the time the SessionListener runs, and not by the time the getSession() method is called in the Request session factory callback

Commits
-------

e82918cd60 [HttpKernel] Configure `session.cookie_secure` earlier
2021-02-25 18:12:57 +01:00
tamcy
e82918cd60 [HttpKernel] Configure session.cookie_secure earlier 2021-02-25 18:11:33 +01:00
Nicolas Grekas
07b6efb19f minor #40308 Make sure the Psalm review CI job is working (Nyholm)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

Make sure the Psalm review CI job is working

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

This PR is just a test to make sure psalm works as expected.

EDIT: It also fixes issues..

Commits
-------

d5a05f1b30 Make sure the Psalm review CI job is working
2021-02-25 17:51:29 +01:00
Nyholm
d5a05f1b30 Make sure the Psalm review CI job is working 2021-02-25 17:51:23 +01:00
Nicolas Grekas
439742ff33 [HttpClient] Add HttpClientInterface::withOptions() 2021-02-25 17:38:04 +01:00
Wouter de Jong
45be875e84 [Security][RateLimiter] Allow to use no lock in the rate limiter/login throttling 2021-02-25 17:33:05 +01:00
Nicolas Grekas
e2f1c46734 feature #39883 [Uid] Add Generate and Inspect commands (fancyweb)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Uid] Add Generate and Inspect commands

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

After some time using the component, I realized I often needed to quickly generate new ulids or to convert them from one format to another so I thought having those commands would be useful.

# Usage

## Generate a ULID - outputs N ULID(s) separated by new lines in base 32, base 58 or RFC 4122 format

### Generate 1 ULID now
`php bin/console ulid:generate`

### Generate 1 ULID with a specific timestamp
`php bin/console ulid:generate --time="2021-02-02 14:00:00"`

### Generate 2 ULIDs and ouput the RFC4122 format
`php bin/console ulid:generate --count=2 --format=rfc4122`

## Generate a UUID - outputs N UUID(s) separated by new lines in RFC 4122, base 58 or base 32 format

### Generate 1 UUID (defaults from the underlying factory)
`php bin/console uuid:generate`

### Generate 1 time-based UUID now
`php bin/console uuid:generate --time-based=now`

### Generate 1 time-based UUID with a specific timestamp
`php bin/console uuid:generate --time-based="2021-02-02 14:00:00"`

### Generate 1 time-based UUID with a specific node
`php bin/console uuid:generate --time-based=now --node=fb3502dc-137e-4849-8886-ac90d07f64a7`

### Generate 1 name-based UUID (there must be a default namespace in the underlying factory)
`php bin/console uuid:generate --name-based=foo`

### Generate 1 name-based UUID with a specific namespace (overrides the default namespace from the underlying factory)
`php bin/console uuid:generate --name-based=foo --namespace=fb3502dc-137e-4849-8886-ac90d07f64a7`

### Generate 1 random-based UUID
`php bin/console uuid:generate --random-based`

### Generate 2 UUIDs and output their base 58 format
`php bin/console uuid:generate --count=2 --format=base58`

## Inspect a ULID - outputs base32, base58 and RFC 4122 formats of a ULID and its humand readable timestamp if it is time-based
`php bin/console ulid:inspect 01EWAKBCMWQ2C94EXNN60ZBS0Q`
`php bin/console ulid:inspect 1BVdfLn3ERmbjYBLCdaaLW`
`php bin/console ulid:inspect 01771535-b29c-b898-923b-b5a981f5e417`

## Inspect a UUID - outputs RFC 4122, base 58 and base 32 formats of a UUID and its human readable timestamp
`php bin/console uuid:inspect a7613e0a-5986-11eb-a861-2bf05af69e52`
`php bin/console uuid:inspect MfnmaUvvQ1h8B14vTwt6dX`
`php bin/console uuid:inspect 57C4Z0MPC627NTGR9BY1DFD7JJ`

# Register the commands

## YAML
```yaml
# services.yaml
services:
    Symfony\Component\Uid\Command\GenerateUlidCommand: ~
    Symfony\Component\Uid\Command\GenerateUuidCommand: ~
    Symfony\Component\Uid\Command\InspectUlidCommand: ~
    Symfony\Component\Uid\Command\InspectUuidCommand: ~
```

## PHP
```php
<?php

// services.php

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Component\Uid\Command\GenerateUlidCommand;
use Symfony\Component\Uid\Command\GenerateUuidCommand;
use Symfony\Component\Uid\Command\InspectUlidCommand;
use Symfony\Component\Uid\Command\InspectUuidCommand;

return static function (ContainerConfigurator $configurator): void {
    $services = $configurator->services()
        ->defaults()
        ->autowire()
        ->autoconfigure();

    $services
        ->set(GenerateUlidCommand::class)
        ->set(GenerateUuidCommand::class)
        ->set(InspectUlidCommand::class)
        ->set(InspectUuidCommand::class);
};
```

Commits
-------

223421b6ca [Uid] Add Generate and Inspect commands
2021-02-25 17:25:32 +01:00
Nicolas Grekas
890ada429d minor #40291 Adding a Github action to run Psalm (Nyholm)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

Adding a Github action to run Psalm

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

I've seen sometimes that we've forgotten to add `\` before `Throwable` or that we refer to a class that does not exist. One could argue that the code is not properly tested, but somehow these PRs still get merged. (And quickly fixed in a follow up PR).

I suggest to add psalm to check every PR for some errors that can be found with a static analyser. This is to help/automate the PR review process. All psalm errors found should be reviewed and discussed. The maintainers can decide to ignore some warnings if they want to. (Ie false positives)

This PR is about “Psalm PR review”. It does not try to fix “Psalm compatibility”. Psalm compatibility is a separate issue that should be discussed separate from the "Psalm PR review".

I currently plan to follow up with the more controversial topic of "Should we make Symfony more compatible with Psalm or not".

Commits
-------

c5ed24d8cb Adding a Github action to run Psalm
2021-02-25 17:18:26 +01:00
Nyholm
c5ed24d8cb Adding a Github action to run Psalm 2021-02-25 17:18:18 +01:00
Nicolas Grekas
1849b571b5 feature #40140 [DependencyInjection] Add ContainerBuilder::willBeAvailable() to help with conditional configuration (nicolas-grekas)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[DependencyInjection] Add ContainerBuilder::willBeAvailable() to help with conditional configuration

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #40136, fix #39356
| License       | MIT
| Doc PR        | no need to

Leverages https://github.com/composer/composer/pull/9682 to ignore dev-packages when configuring the container.

Commits
-------

47c471e2c4 [DependencyInjection] Add ContainerBuilder::willBeAvailable() to help with conditional configuration
2021-02-25 17:13:15 +01:00
Robin Chalas
adbb34115c Merge branch '5.2' into 5.x
* 5.2:
  [TwigBridge] Install symfony/intl to run tests on Travis
  [Translation] Make `name` attribute optional in xliff2
  [Security] #[CurrentUser] argument should resolve to null when it is anonymous
2021-02-25 14:42:49 +01:00
Robin Chalas
f4c9feeb75 Merge branch '4.4' into 5.2
* 4.4:
  [TwigBridge] Install symfony/intl to run tests on Travis
  [Translation] Make `name` attribute optional in xliff2
2021-02-25 14:42:30 +01:00
Nyholm
b95544559a
minor #40304 [TwigBridge] Install symfony/intl to run tests on Travis (wouterj)
This PR was merged into the 4.4 branch.

Discussion
----------

[TwigBridge] Install symfony/intl to run tests on Travis

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | bi
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

The hard dependency on `symfony/intl` was removed from the Form component in 5.3-dev (#40298). I suggest to add the explicit dev dependency on TwigBridge on 4.4 already.

Commits
-------

b2970456bf [TwigBridge] Install symfony/intl to run tests on Travis
2021-02-25 13:43:50 +01:00
Wouter de Jong
b2970456bf [TwigBridge] Install symfony/intl to run tests on Travis 2021-02-25 12:27:58 +01:00
Fabien Potencier
d54a1223f7 feature #40266 [Routing] Construct Route annotations using named arguments (derrabus)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Routing] Construct Route annotations using named arguments

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | no
| Deprecations? | yes
| Tickets       | N/A
| License       | MIT
| Doc PR        | Not needed

This PR proposes to bump the `doctrine/annotations` library to 1.12 to gain access to its emulation layer for named arguments. Furthermore, constructing a `Route` annotation the old way by passing an array of parameters is deprecated.

### Reasons for this change

The constructors of our annotation classes have become unnecessarily complicated because we have to support two ways of calling them:
* An array of parameters, passed as first argument, because that's the default behavior `doctrine/annotations`.
* A set of named arguments because that's how PHP 8 attributes work.

Since we can now tell the Doctrine annotation reader to use named arguments as well, we can simplify the constructors of our annotations significantly.

### Drawback

After this change, there is no easy way anymore to construct instances of the `Route` annotation class directly on PHP 7. The PR has been built under the assumption that instances of this class are usually created using either Doctrine annotations or a PHP 8 attribute. Thus, most applications should be unaffected by this change.

Commits
-------

29b0f96046 [Routing] Construct Route annotations using named arguments
2021-02-25 08:31:04 +01:00
Fabien Potencier
b44b9aa681 feature #40288 Deprecate passing null as $message or $code to exceptions (derrabus)
This PR was merged into the 5.3-dev branch.

Discussion
----------

Deprecate passing null as $message or $code to exceptions

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | no
| Deprecations? | yes
| Tickets       | N/A
| License       | MIT
| Doc PR        | N/A

Follow-up to #40271.

Following the example of the PHP core, this PR introduces deprecation warnings that are triggered if a developer attempts to pass null as `$code` or `$message` to an exception constructor.

Commits
-------

8e3058d95a Deprecate passing null as $message or $code to exceptions
2021-02-25 08:28:10 +01:00
Fabien Potencier
304980eced feature #40298 [Form] Remove hard dependency on symfony/intl (Nyholm)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[Form] Remove hard dependency on symfony/intl

| Q             | A
| ------------- | ---
| Branch?       | 5.x (or 6.0)
| Bug fix?      |
| New feature?  | no
| Deprecations? | yes
| Tickets       | Fix #39596
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/15026

This was voted down in 2018 (#29229) and will revert #29720 by @chalasr. I reopen it because the Form component is way less dependent on Intl component now.

Im hesitant if we should do this in 5.x or 6.0. If a user don't have `symfony/intl` installed, they will get an error in runtime. That is something that speaks for doing it in 6.0.

Could I get some opinions?

### TODO

- [x] Update `UPGRADE-x.x.md`

Commits
-------

f90d3ec203 [Form] Remove hard dependency on symfony/intl
2021-02-25 08:25:47 +01:00
Nyholm
f90d3ec203 [Form] Remove hard dependency on symfony/intl 2021-02-25 08:25:40 +01:00
Thomas Calvet
223421b6ca [Uid] Add Generate and Inspect commands
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
2021-02-24 18:32:23 +01:00
Nicolas Grekas
91121acf4b bug #40283 [Translation] Make name attribute optional in xliff2 (MarieMinasyan)
This PR was submitted for the 5.2 branch but it was merged into the 4.4 branch instead.

Discussion
----------

[Translation] Make `name` attribute optional in xliff2

Do not set a fake `name` attribute on `unit` element from xliff2 to allow using `source` attribute and avoid missing translation error

| Q             | A
| ------------- | ---
| Branch?       | 5.2
| Bug fix?      | yes/no
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #37055
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

When `xlf` translations are loaded, if a name exists on `unit` element, the segment's source is ignored:
```foreach ($xml->xpath('//xliff:unit') as $unit) {
            foreach ($unit->segment as $segment) {
                $attributes = $unit->attributes();
                $source = $attributes['name'] ?? $segment->source;
```

At the same time, when dumping translations, the segment's source is copied into the unit's name attribute, unless it's longer than 80 characters. In that case, `substr(md5($source), -7)` is set into the name attribute.
This results in a missing translation error, because the source is ignored and the name is a random string.

Suggested solution: only set the name attribute if the string is less than 80 characters.

Commits
-------

97058559cc [Translation] Make `name` attribute optional in xliff2
2021-02-24 17:01:10 +01:00
Marie Minasyan
97058559cc [Translation] Make name attribute optional in xliff2
Do not set a fake `name` attribute on `unit` element from xliff2 to allow using `source` attribute and avoid missing translation error
2021-02-24 17:01:00 +01:00
Nicolas Grekas
47c471e2c4 [DependencyInjection] Add ContainerBuilder::willBeAvailable() to help with conditional configuration 2021-02-24 16:58:46 +01:00
Robin Chalas
b03731981a bug #40286 [Security] #[CurrentUser] arguments should resolve to null for "anon." (chalasr)
This PR was merged into the 5.2 branch.

Discussion
----------

[Security] #[CurrentUser] arguments should resolve to null for "anon."

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

The UserValueResolver should only resolve `UserInterface` (or subtype) typed arguments:
bc9e946a56/src/Symfony/Component/Security/Http/Controller/UserValueResolver.php (L54-L55)
When using the `#CurrentUser` attribute with an AnonymousToken in the storage, the resolved argument value is `anon.`. This PR fixes it.

/cc @jvasseur

Commits
-------

8d3078dd35 [Security] #[CurrentUser] argument should resolve to null when it is anonymous
2021-02-24 15:02:23 +01:00
Robin Chalas
8d3078dd35 [Security] #[CurrentUser] argument should resolve to null when it is anonymous 2021-02-24 14:48:49 +01:00
Alexander M. Turek
8e3058d95a Deprecate passing null as $message or $code to exceptions 2021-02-24 14:36:13 +01:00
Nicolas Grekas
e872db4a1c Add default issue templates back 2021-02-24 14:32:19 +01:00
Alexander M. Turek
29b0f96046 [Routing] Construct Route annotations using named arguments 2021-02-24 14:30:32 +01:00
Alexander M. Turek
20e5441eb8 Merge branch '5.2' into 5.x
* 5.2:
  Switched to non-null defaults in exception constructors
  Allow x-forwarded-prefix trusted header.
2021-02-24 01:41:59 +01:00
Robin Chalas
3a2906cce9 minor #40287 [Config] Switched to non-null defaults in exception constructors (derrabus)
This PR was merged into the 5.2 branch.

Discussion
----------

[Config] Switched to non-null defaults in exception constructors

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

Follow-up to #40271 on the 5.2 branch.

Commits
-------

2e865ac057 Switched to non-null defaults in exception constructors
2021-02-24 01:27:57 +01:00
Alexander M. Turek
2e865ac057 Switched to non-null defaults in exception constructors 2021-02-24 00:58:19 +01:00
Alexander M. Turek
cc90ef32ac minor #40285 Remove service session.storage.mock_file when user configure factory (jderusse)
This PR was merged into the 5.3-dev branch.

Discussion
----------

Remove service session.storage.mock_file when user configure factory

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #40282
| License       | MIT
| Doc PR        | -

When deprecating the session.storage services, and user configures a factory, the FrameworkExtension removes statefull services, but I forgot to also remove the `session.storage.mock_file` service.

Commits
-------

483f840a08 Remove service session.storage.mock_file when user configure factory
2021-02-24 00:50:40 +01:00
Jérémy Derussé
483f840a08
Remove service session.storage.mock_file when user configure factory 2021-02-23 23:31:03 +01:00
Nicolas Grekas
5028aaf542 bug #40281 [FrameworkBundle] Allow x-forwarded-prefix trusted header in config (drupol)
This PR was submitted for the 5.x branch but it was merged into the 5.2 branch instead.

Discussion
----------

[FrameworkBundle] Allow x-forwarded-prefix trusted header in config

| Q             | A
| ------------- | ---
| Branch?       | 5.2 (as requested by @nicolas-grekas)
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| License       | MIT

Support for `X_FORWARDED_PREFIX` has been added in PR https://github.com/symfony/symfony/pull/37734.

However, it is impossible to use it because the configuration doesn't allow the `x-forwarded-prefix` value in `framework.yaml`.

Commits
-------

95fdd90491 Allow x-forwarded-prefix trusted header.
2021-02-23 16:58:27 +01:00
Pol Dellaiera
95fdd90491 Allow x-forwarded-prefix trusted header. 2021-02-23 16:58:22 +01:00
Nicolas Grekas
bc9e946a56 Merge branch '5.2' into 5.x
* 5.2:
  Move github templates at the org level
  [Cache] Fix Redis TLS scheme `rediss` for Redis connection
  In calls to mb_ functions, silently transform arg into string
  Switched to non-null defaults in exception constructors
  [Routing] fix conflict with param named class in attribute
  [Cache] fix setting items' metadata on commit()
2021-02-23 11:10:15 +01:00
Nicolas Grekas
e98ab925e3 Merge branch '4.4' into 5.2
* 4.4:
  Move github templates at the org level
  [Cache] Fix Redis TLS scheme `rediss` for Redis connection
  In calls to mb_ functions, silently transform arg into string
2021-02-23 11:08:49 +01:00
Nicolas Grekas
56194a4535 Move github templates at the org level 2021-02-23 11:03:30 +01:00
Nyholm
8e1d3285ed
Adding templates for Belarusian 2021-02-22 22:11:34 +01:00
Nicolas Grekas
b5dc77ea16 minor #40272 [Console] Handle calls to mb_ functions with non string arguments (Yopai)
This PR was merged into the 4.4 branch.

Discussion
----------

[Console] Handle calls to mb_ functions with non string arguments

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #40200
| License       | MIT
| Doc PR        | no

In PHP8.1, a number of functions who were accepting null arguments will only accept
string ones.
(see https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg)

In the polyfill, mb_* functions are already declared with a strict type checking of "string".

Therefore, it is necessary to get rid of the use of non string arguments when calling mb_* functions,
so that it won't break when either using the polyfill,or future php8 versions.

In every call where the argument may not be a string, this commit enforces the string type of the argument (with transtyping)

--- For reviewers
* I generally don't like transtyping, but found it was the more "secure" way (on a non-BC point of view) here.
Specially in Console/Helper/Table.php, where $cell can be an object (there are 2 "$cell instanceof ... tests)
However, where the argument can already be either null or string (and not anything else), there may a beter approach ?

* It's the first time I send a PR on symfony, so don't hesitate pointing me to thinks I've forgotten to done.

Commits
-------

ac45be2580 In calls to mb_ functions, silently transform arg into string
2021-02-22 19:44:15 +01:00
Nicolas Grekas
1688e5d9b4 bug #39599 [Cache] Fix Redis TLS scheme rediss for Redis connection (misaert)
This PR was submitted for the 5.x branch but it was merged into the 4.4 branch instead.

Discussion
----------

[Cache] Fix Redis TLS scheme `rediss` for Redis connection

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

Like https://github.com/symfony/symfony/pull/35503 on Symfony Messenger, this will enable TLS support for Redis adapter.

The implementation just prefix the host with `tls://` as described here: https://github.com/phpredis/phpredis#connect-open

I don't know how to test it because I guess I need a TLS Redis in `src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php`.

Commits
-------

3288897e0f [Cache] Fix Redis TLS scheme `rediss` for Redis connection
2021-02-22 19:01:56 +01:00
Mickaël Isaert
3288897e0f [Cache] Fix Redis TLS scheme rediss for Redis connection 2021-02-22 19:01:38 +01:00
Pierre-Olivier Vares
ac45be2580 In calls to mb_ functions, silently transform arg into string
In PHP8, a number of functions who were accepting null arguments will only accept
string ones.

In the polyfill, mb_* functions are declared with a trict type checking of "string".

Therefore, we deprecate the use of non string arguments, so that it won't break when either using the polyfill,
or future php8 versions.
2021-02-22 18:49:23 +01:00
Nicolas Grekas
3619ae8ea4 Merge branch '4.4' into 5.2
* 4.4:
  Switched to non-null defaults in exception constructors
  [Routing] fix conflict with param named class in attribute
  [Cache] fix setting items' metadata on commit()
2021-02-22 16:48:39 +01:00
Nicolas Grekas
f3529fd9df minor #40271 Switched to non-null defaults in exception constructors (derrabus)
This PR was merged into the 4.4 branch.

Discussion
----------

Switched to non-null defaults in exception constructors

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

PHP 8.1 will trigger a deprecation warning if we pass `null` as `$message` or `$code` to the constructor of `\Exception`. However, many of our own exception accept `null` for those parameters and even use them as default.

This is unfortunate because code like the following snippet would trigger that deprecation although the code itself is perfectly fine:

```php
throw new NotFoundHttpException();
```

With this PR, I'd like to change our defaults to `''` and `0` while still allowing to pass `null` for BC. In a follow-up PR for the 5.x branch, I'd like to deprecate passing `null`, matching the future behavior of PHP.

This PR also adjust various PHPDoc blocks with inaccurate types.

Commits
-------

f8e10094a4 Switched to non-null defaults in exception constructors
2021-02-22 16:37:04 +01:00
Alexander M. Turek
f8e10094a4 Switched to non-null defaults in exception constructors 2021-02-22 16:36:50 +01:00
Nicolas Grekas
070f003291 bug #40244 [Routing] fix conflict with param named class in attribute (nlhommet)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[Routing] fix conflict with param named class in attribute

| Q             | A
| ------------- | ---
| Branch        | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #40225
| License       | MIT
| Doc PR        | -

Fix conflict with AnnotationFileLoader and class PHP8 Attribute with param named "class"

Commits
-------

27bba684d8 [Routing] fix conflict with param named class in attribute
2021-02-22 16:26:26 +01:00