Skip to content

[DI] Compiled Container Does Not Call Base Class Constructor #25343

@kiler129

Description

@kiler129
Q A
Bug report? no (unexpected behavior)
Feature request? yes
BC Break report? no
RFC? no
Symfony version 4.x

While using the DIC component outside of the Symfony I found I need to define my own base_class while calling PhpDumper::dump in order to provide custom functionality. Compiled container indeed contains my class as a parent, however constructor of the class is not called. The generated constructor looks like that:

    public function __construct()
    {
        $this->parameters = $this->getDefaultParameters();

        $this->services = $this->privates = array();
        $this->syntheticIds = array(
            //...
        );
        $this->methodMap = array(
            //...
        );
        $this->aliases = array(
            //...
        );
    }

I checked and this behavior is consistent across 4.0, 3.4 and 3.3 with or without as_files enabled. I guess then the decision was deliberate.

Is there any reason why not to call the base container constructor? WDYT about adding such option?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions