-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Config] Use better typehint in PHP Configuration #44166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
e4fe334
to
5b38780
Compare
This comment was marked as outdated.
This comment was marked as outdated.
5b38780
to
ed06540
Compare
This comment was marked as outdated.
This comment was marked as outdated.
ed06540
to
ebf4d0a
Compare
ebf4d0a
to
7cbb702
Compare
7cbb702
to
962834b
Compare
…jderusse, HypeMC) This PR was merged into the 5.4 branch. Discussion ---------- [Config] Allow scalar configuration in PHP Configuration | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix symfony/monolog-bundle#417 (comment) | License | MIT | Doc PR | - Fixes passing scalar values to array nodes that have a `beforeNormalization` hook, eg: ```php return static function (MonologConfig $config): void { $config->handler('console') // ... ->processPsr3Messages() ->enabled(true) ; }; ``` can be shortened thanks to a [`beforeNormalization` hook](https://github.com/symfony/monolog-bundle/blob/a41bbcdc1105603b6d73a7d9a43a3788f8e0fb7d/DependencyInjection/Configuration.php#L453): ```php return static function (MonologConfig $config): void { $config->handler('console') // ... ->processPsr3Messages(true) ; }; ``` I've used some of the code from #44166 by `@jderusse`. Since his PR is a feature it can't go on 5.4, but it still helped a lot. Commits ------- 2d81a3a [Config] Allow scalar configuration in PHP Configuration 1c176e1 [Config] Allow scalar configuration in PHP Configuration
Rebase needed, in case there is anything left after #46328 |
@nicolas-grekas This PR provides some additional features that #46328 doesn't have, eg allowed type hints on generated methods: Line 25 in 962834b
Currently Line 31 in 5bf31c5
My PR only covers using scalars with the |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
962834b
to
e3c72bb
Compare
PR rebased and duplicated logic with #46328 removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing CHANGELOG entry. 👍 to ship this in 6.2
e3c72bb
to
a4a2962
Compare
src/Symfony/Component/Config/Builder/ConfigBuilderGenerator.php
Outdated
Show resolved
Hide resolved
a4a2962
to
0e590dc
Compare
Thank you @jderusse. |
Before in public function httpCode(string $code, mixed $value = []): \Symfony\Config\Framework\HttpClient\ScopedClientConfig\RetryFailed\HttpCodeConfig|static Now it generates: public function httpCode(string $code, array $value = []): \Symfony\Config\Framework\HttpClient\ScopedClientConfig\RetryFailed\HttpCodeConfig|static Is this a bug in the config generator or in the HttpClient? |
- undo changes from symfony#44166 -
- undo changes from symfony#44166
- undo changes from symfony#44166
This PR now followup #46328 to replace the generic
mixed
type-hint by type inferred from normalizations (ie, if a config useifString
, when now that the normalization works only for string, thesemixed
can safely be replaced bystring
)