Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Commit0cb07c7
committed
feature#42623 [ErrorHandler] Turn return-type annotations into deprecations by default + add mode to turn them into native types (nicolas-grekas)
This PR was merged into the 5.4 branch.Discussion----------[ErrorHandler] Turn return-type annotations into deprecations by default + add mode to turn them into native types| Q | A| ------------- | ---| Branch? | 5.4| Bug fix? | no| New feature? | yes| Deprecations? | no| Tickets | -| License | MIT| Doc PR | -Leverages#42149We need extensive doc on the topic for sure, a whole new chapter.DebugClassLoader allows patching an app or a lib by going through these steps:- require `symfony/error-handler` if not already there- run `composer install -q --optimize-autoloader`- copy/paste the below script to the root of the app/lib, in `patch-types.php`- run the script with `SYMFONY_PATCH_TYPE_DECLARATIONS='force=phpdoc' php patch-types.php``SYMFONY_PATCH_TYPE_DECLARATIONS` can be set to:- `'force=phpdoc'` to copy ``@return`` annotations from parent classes, to express that the next major version of that lib is going to add a native return types;- `'force=1'` to turn ``@return`` annotations into native return types, but only on tests/private/final/internal methods;- `'force=2'` to turn ``@return`` annotations into native return types, for all possible methods.```php<?phpif (false === getenv('SYMFONY_PATCH_TYPE_DECLARATIONS')) { echo "Please define the SYMFONY_PATCH_TYPE_DECLARATIONS env var when running this script.\n"; exit(1);}$loader = require __DIR__.'/vendor/autoload.php';Symfony\Component\ErrorHandler\DebugClassLoader::enable();foreach ($loader->getClassMap() as $class => $file) { switch (true) { case false !== strpos($file = realpath($file), '/vendor/'): case false !== strpos($file, '/src/path-to-exclude/'): // add as many as required continue; } class_exists($class);}Symfony\Component\ErrorHandler\DebugClassLoader::checkClasses();```Commits-------bb11e62 [ErrorHandler] Turn return-type annotations into deprecations by default, add mode to turn them into native typesFile tree
4 files changed
+14
-6
lines changed- .github
- workflows
- src/Symfony/Component/ErrorHandler
4 files changed
+14
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
| 146 | + | |
145 | 147 | | |
146 | 148 | | |
147 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
4 | 10 | | |
5 | 11 | | |
6 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
| 37 | + | |
| 38 | + | |
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
| |||
73 | 72 | | |
74 | 73 | | |
75 | 74 | | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| |||
534 | 534 | | |
535 | 535 | | |
536 | 536 | | |
537 | | - | |
| 537 | + | |
| 538 | + | |
538 | 539 | | |
539 | 540 | | |
540 | 541 | | |
| |||
0 commit comments
Comments
(0)