Skip to content

Unnecessary Function Call #19838

Closed
Closed
@justin-oh

Description

@justin-oh

In the documentation for Compiler Passes in Bundles, the example shows:

// src/MyBundle/MyBundle.php
namespace App\MyBundle;

use App\DependencyInjection\Compiler\CustomPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class MyBundle extends Bundle
{
    public function build(ContainerBuilder $container): void
    {
        parent::build($container);

        $container->addCompilerPass(new CustomPass());
    }
}

However, the call to the parent function is unnecessary because the Bundle class's implementation of the function is empty:

/**
 * This method can be overridden to register compilation passes,
 * other extensions, ...
 *
 * @return void
 */
public function build(ContainerBuilder $container)
{
}

Also, shouldn't anything related to bundles in documentation of 6.1 and beyond be extending AbstractBundle?

Metadata

Metadata

Assignees

No one assigned

    Labels

    hasPRA Pull Request has already been submitted for this issue.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions