nikic · GitHub

@nikic

carusogabriel

BackEndTea

@nikic nikic changed the title Throw warning if required param follows optional Deprecate required param after optional

Jan 9, 2020

NikoGrano

@nikic

@fvsch fvsch mentioned this pull request

Nov 27, 2020

Closed

Closed

@m-vo m-vo mentioned this pull request

Feb 3, 2022

Merged

leofeyer pushed a commit to contao/contao that referenced this pull request

Feb 11, 2022
…tructors (see #4065)
Description
-----------
Fixes #4055
This PR swaps the first two parameters of the `AsContentElement` and `AsFrontendModule` constructors. This was not released yet, so no BC issue.
Background info: As of PHP8.0 having optional parameters before mandatory ones is deprecated. Here is an explanation why the current code did not trigger a deprecation warning and behaved just like two mandatory parameters: php/php-src#5067 (comment)
Commits
-------
 9058274  fix order of parameters
 6df2476  adjust tests
 5bd86a5  use miscellaneous as the default type and fix variadic argument type hint
 4356ed6  prevent PHP<8.0 jobs from autoloading test cases with PHP8 syntax
 8a1d2d8  add 'mixed' type hint for variadic attributes
 1f396f9  improve comment
 942fc37  Update core-bundle/tests/DependencyInjection/ContaoCoreExtensionTest.php
 e413bf3  🦊

leofeyer pushed a commit to contao/core-bundle that referenced this pull request

Feb 11, 2022
…tructors (see #4065)
Description
-----------
Fixes #4055
This PR swaps the first two parameters of the `AsContentElement` and `AsFrontendModule` constructors. This was not released yet, so no BC issue.
Background info: As of PHP8.0 having optional parameters before mandatory ones is deprecated. Here is an explanation why the current code did not trigger a deprecation warning and behaved just like two mandatory parameters: php/php-src#5067 (comment)
Commits
-------
90582748 fix order of parameters
6df2476e adjust tests
5bd86a50 use miscellaneous as the default type and fix variadic argument type hint
4356ed66 prevent PHP<8.0 jobs from autoloading test cases with PHP8 syntax
8a1d2d82 add 'mixed' type hint for variadic attributes
1f396f9f improve comment
942fc372 Update core-bundle/tests/DependencyInjection/ContaoCoreExtensionTest.php
e413bf33 🦊

amieiro added a commit to amieiro/GlotPress that referenced this pull request

Jan 5, 2023
…rning
With this default value, I get a warning like:
Deprecated: Required parameter $meta_key follows optional parameter $object_id
More information: php/php-src#5067

Closed

Closed

Open

adrian-enspired pushed a commit to adrian-enspired/php-src that referenced this pull request

Aug 4, 2026
As an exception, we allow "Type $foo = null" to occur before a
required parameter, because this pattern was used as a replacement
for nullable types in PHP versions older than 7.1.
Closes phpGH-5067.

Read the original on github.com ↗