Skip to content

[ConfigBuilder] Replace all framework config #15269

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

Merged
merged 1 commit into from
Apr 30, 2021

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Apr 21, 2021

This PR will replace all framework configuration with the new ConfigBuilders.

@Nyholm
Copy link
Member Author

Nyholm commented Apr 21, 2021

Only the config reference and messeger left =)

@Nyholm Nyholm force-pushed the framework-config-builder branch from a8c5161 to a5f4b3b Compare April 21, 2021 15:16
@Nyholm Nyholm changed the title [WIP][ConfigBuilder] Replace all framework config [ConfigBuilder] Replace all framework config Apr 21, 2021
@Nyholm Nyholm force-pushed the framework-config-builder branch from 49f1d9b to acdf609 Compare April 21, 2021 19:21
@Nyholm
Copy link
Member Author

Nyholm commented Apr 21, 2021

I cannot figure out why not all errors show in the diff.. I only see the first 5..


return static function (ContainerBuilder $container, FrameworkConfig $framework) {
$container->setParameter('env(TRUSTED_HOSTS)', '10.0.0.1,10.0.0.2');
$framework->trustedHosts('%env(csv:TRUSTED_HOSTS)%');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@Nyholm
Copy link
Member Author

Nyholm commented Apr 22, 2021

Hm... About the CI not showing all errors.

It will not show this error and anything after it. Earlier, it did not show this error and anything after it.

It make sense if there were a special character that was being printed, but I dont see any. But all ::error commands are "reset" after line break. So if one has wrong syntax then it wont effect the next line.

(Btw I urlencode the line breaks to have a multi line comment.)

@Nyholm Nyholm force-pushed the framework-config-builder branch from 545a66a to 3a31028 Compare April 22, 2021 10:43
@Nyholm Nyholm requested a review from OskarStark as a code owner April 22, 2021 10:43
@Nyholm Nyholm force-pushed the framework-config-builder branch 2 times, most recently from c270e59 to 71c6a6b Compare April 22, 2021 11:07
Copy link
Member Author

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming symfony/symfony#40903 will be merged. This PR is ready for a final review.

->defaultSerializer('messenger.transport.symfony_serializer')
->symfonySerializer()
->format('json')
->context('foo', 'bar');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a better example than this?

derrabus added a commit to symfony/symfony that referenced this pull request Apr 26, 2021
…urator (Nyholm)

This PR was merged into the 5.3-dev branch.

Discussion
----------

[Config] Builder: Remove typehints and allow for EnvConfigurator

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

When [writing documentation](symfony/symfony-docs#15269 (comment)) we found that we don't really support environment variables in the leaves. Ie, we expect a boolean but you provide `"%env(ENABLE_FOO)%"`

This PR will also introduce `ParamConfigurator` to allow parameters to be passed as config.

The changes to the generated code:

```diff
    /**
+    * `@param` bool|ParamConfigurator $value
     * `@default` false
     * `@return` $this
     */
-   public function enabled(bool $value): self
+   public function enabled($value): self
    {
        $this->enabled = $value;

        return $this;
    }
```

Commits
-------

59b79d3 [Config] Builder: Remove typehints and allow for EnvConfigurator
@Nyholm
Copy link
Member Author

Nyholm commented Apr 26, 2021

Wohoo. The code PR is merged.

@Nyholm
Copy link
Member Author

Nyholm commented Apr 29, 2021

Is there something I can do to help this PR to get merged?

@javiereguiluz
Copy link
Member

Sorry it took us some time to merge this. Thanks Tobias!

@javiereguiluz javiereguiluz force-pushed the framework-config-builder branch from aa04e88 to e57adb9 Compare April 30, 2021 13:57
@javiereguiluz javiereguiluz merged commit 15a5862 into symfony:5.x Apr 30, 2021
@Nyholm Nyholm deleted the framework-config-builder branch April 30, 2021 14:01
@Nyholm
Copy link
Member Author

Nyholm commented Apr 30, 2021

Thank you for merging. I'll fix the rest now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants