Skip to content

[DependencyInjection] Add abstract_arg() and param() #36775

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
Jun 10, 2020

Conversation

fabpot
Copy link
Member

@fabpot fabpot commented May 10, 2020

Q A
Branch? maste
Bug fix? no
New feature? yes
Deprecations? no
Tickets n/a
License MIT
Doc PR -

Added abstract_arg() and param() to configuration abstract arguments in PHP DSL.

@fabpot fabpot force-pushed the ContainerConfigurator_abstract_arg branch from f76faf8 to a94be60 Compare May 10, 2020 14:42
@fabpot fabpot force-pushed the ContainerConfigurator_abstract_arg branch from a94be60 to 1871889 Compare May 10, 2020 16:08
@nicolas-grekas
Copy link
Member

What do you think about adding this also?

function env(string $name): string
{
    return '%env('.$name.')%';
}

@wouterj
Copy link
Member

wouterj commented May 12, 2020

What do you think about adding this also?

I like the idea, but I think env vars might need a special configurator to get rid of the "complex" strings like int:key:timeout:query_string:MONGODB_URL and json:file:resolve:AUTH_FILE?

@nicolas-grekas
Copy link
Member

I think env vars might need a special configurator to get rid of the "complex" strings

Honestly, teaching ppl with the real syntax is going to empower them much more than using some extremely specific DSL here.

@fabpot fabpot force-pushed the ContainerConfigurator_abstract_arg branch from 1871889 to 08ff298 Compare May 16, 2020 08:50
@fabpot fabpot changed the title [DependencyInjection] Add abstract_arg [DependencyInjection] Add abstract_arg() and param() May 16, 2020
@fabpot fabpot force-pushed the ContainerConfigurator_abstract_arg branch from 08ff298 to 1fd4e8b Compare June 10, 2020 02:11
@fabpot fabpot merged commit 4984ce1 into symfony:master Jun 10, 2020
@fabpot fabpot deleted the ContainerConfigurator_abstract_arg branch June 10, 2020 02:12
fabpot added a commit that referenced this pull request Jun 10, 2020
…onfiguration in core (fabpot)

This PR was merged into the 5.2-dev branch.

Discussion
----------

Use PHP instead of XML as the prefered service/route configuration in core

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes-ish <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | n/a

In Symfony 6, I (we?) would want to promote usage of configuration written in PHP instead of YAML. For third-party bundles and core, we should do the same, replacing XML with PHP. Doing so would remove the need for the XML lib for core.

The biggest advantage is auto-completion with any modern IDE without explicit support for Symfony, and probably one less thing to learn (how to configure things in YAML/XML).

Be warned that it does NOT concern semantic configuration which is much harder.

This PR does the work for the Twig bundle as an example. Once we agreed on the CS, the same should then be done for other core bundles both for service configuration and route configuration.

Embeds #36775 until it is merged.

Commits
-------

0aedd54 [Twig] Move configuration to PHP
@stof
Copy link
Member

stof commented Jun 10, 2020

this misses the update of the changelog of the component

@fabpot
Copy link
Member Author

fabpot commented Jun 11, 2020

@stof CHANGELOG updated in 8df6380

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.

8 participants