Skip to content
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

[Bundles] Promote the new bundle structure everywhere #19793

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

javiereguiluz
Copy link
Member

After talking with @jrushlow, it's clear that there are some docs that still promote too much the legacy bundle structure, which is inconsistent with the best-practices explained in https://symfony.com/doc/current/bundles.html and https://symfony.com/doc/current/bundles/best_practices.html

So, I propose to update those articles (https://symfony.com/doc/current/bundles/extension.html#loading-services-directly-in-your-bundle-class and https://symfony.com/doc/current/bundles/configuration.html#using-the-abstractbundle-class) to always explain first the simpler solution based on AbstractBundle.

Pinging @yceruto because he's the most active folk on everything related to simplifying bundles. Thanks!

@javiereguiluz javiereguiluz added this to the 6.4 milestone Apr 16, 2024
@carsonbot carsonbot changed the title Promote the new bundle structure everywhere [Bundles] Promote the new bundle structure everywhere Apr 16, 2024
@yceruto
Copy link
Member

yceruto commented Apr 16, 2024

Yes, it's perfect timing since we introduced AbstractBundle and AbstractExtension to the bundle ecosystem.

I'll check the documentation later; thanks for the ping!

Copy link
Contributor

@jrushlow jrushlow left a comment

Choose a reason for hiding this comment

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

Awesome! I'm going through this PR at the same time I'm updating verify-email-bundle && reset-password-bundle codebase.

Minor detail on argument names to match the parent method...

I'll give some more feedback as I work through the PR's

bundles/configuration.rst Outdated Show resolved Hide resolved
bundles/configuration.rst Outdated Show resolved Hide resolved
@javiereguiluz
Copy link
Member Author

Thanks for the reviews. I updated the things you asked me to.

Copy link
Contributor

@jrushlow jrushlow left a comment

Choose a reason for hiding this comment

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

One more minor thing - aside from that - this looks good!


class AcmeHelloBundle extends AbstractBundle
{
public function loadExtension(array $config, ContainerConfigurator $containerConfigurator, ContainerBuilder $containerBuilder): void
Copy link
Contributor

Choose a reason for hiding this comment

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

Just caught this one too (match AbstractBundle::loadExtension() arg names)

public function loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): void

Linter appears to be complaining about this. Pretty sure this is a false positive in this case.

Copy link
Contributor

Choose a reason for hiding this comment

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

We added a rule to explicitly name them like this, not sure its a good idea anymore 🤔

@alamirault were you involved back then with this rule?

Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't looked at the code for the rule - but I'm guessing it could be improved by adding a conditional to check if the variable name matches the first|second|third... "word part" of the type name

Copy link
Member

Choose a reason for hiding this comment

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

We've already reverted most of the changes to the longer name: #18299

Let's remove the rule imho

@OskarStark
Copy link
Contributor

Please rebase to fix DOCtor-RST build, thanks

Copy link
Contributor

@jrushlow jrushlow left a comment

Choose a reason for hiding this comment

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

A whole lot of awesomeness going on here 😄

@javiereguiluz javiereguiluz merged commit 29a966c into symfony:6.4 Apr 26, 2024
1 check passed
@javiereguiluz javiereguiluz deleted the bundles branch April 26, 2024 13:24
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.

6 participants