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

class CaBundle does not extends from class Bundle -> BundleInterface #56

Closed
RicoFactset opened this issue May 15, 2020 · 6 comments
Closed

Comments

@RicoFactset
Copy link

RicoFactset commented May 15, 2020

Hi,

BundleInterface implements method getName():

    /**
     * Returns the bundle name (the class short name).
     *
     * @return string The Bundle name
     */
    public function getName();

The recipe adds an entry for CaBundle to bundles.php in Symfony.

https://github.com/symfony/http-kernel/blame/master/Kernel.php implements:

protected function initializeBundles()
    {
        // init bundles
        $this->bundles = [];
        foreach ($this->registerBundles() as $bundle) {
            $name = $bundle->getName();
            if (isset($this->bundles[$name])) {
                throw new \LogicException(sprintf('Trying to register two bundles with the same name "%s".', $name));
            }
            $this->bundles[$name] = $bundle;
        }
    }

Method getName() is not existing in composer/ca-bundle. This leads to
Attempted to call an undefined method named "getName" of class "Composer\CaBundle\CaBundle". on "dev" environment.

@Seldaek
Copy link
Member

Seldaek commented May 15, 2020

This CaBundle class has nothing to do with symfony or symfony bundles. It therefore does not implement the interface.

It's called CA Bundle because it represents a bundle of certificate authorities. Bundle just means a collection of things or quantity of material tied or wrapped up together., it does not mean "put it in your symfony kernel and see what happens".

@Seldaek Seldaek closed this as completed May 15, 2020
@RicoFactset
Copy link
Author

RicoFactset commented May 15, 2020

Hi Seldaek, yes I know. But Composer still adds that line to bundles.php:

Composer\CaBundle\CaBundle::class => ['dev' => true, 'test' => true],

after "composer install" which outputs:
Configuring composer/ca-bundle (>=1.2.7): From auto-generated recipe

Removing that entry from bundles.php manually solves that issue.

But still, I wonder why Composer adds that entry to bundles.php which causes the error finally.

@Seldaek
Copy link
Member

Seldaek commented May 15, 2020

Composer does not do anything. Some symfony integration / flex or whatever plugin does this. That looks like a bug, but it's not something we can fix here. Should be reported on flex or in symfony recipes. I am not sure what is responsible for this.

@RicoFactset
Copy link
Author

Ok thanks, that makes then sense.

@Seldaek
Copy link
Member

Seldaek commented May 15, 2020

Seems to be https://github.com/symfony/flex/blob/89999fdaad52cab14637709f2d2ce25835a051e6/src/SymfonyBundle.php#L78 at fault. It just checks for the Bundle ending. Probably should do more checks than that..

@RicoFactset
Copy link
Author

Created an issue here: symfony/flex#622

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

No branches or pull requests

2 participants