Skip to content

Rename ContainerBuilder::compile() #506

@mnapoli

Description

@mnapoli

From #494 (comment)

Suggestions:

  • setCompilationPath($filename): I'd like to avoid using setters if possible
  • enableCompilation($filename)

Please note that the file name will also be the name of the generated PHP class. Because of that the filename you specify must also be a valid class name

Wouldn't it be better just to use a single file name (CompiledContainer.php is just perfect) and let the user set the path only? (this plays better with my previous suggestion of setCompilationPath)

@juliangut I'm not sure I remember the whole reasons at the moment but I needed being able to set the file name for tests or scenarios where I wanted multiple containers. In any case I think it's also a good thing to let users choose the path and the file name, it allows to avoid creating a directory just for one file, and it allows more control over that file. Users will need to manage that file specifically for their deployment, some others may want to commit it in the repository. If we ever changed the file name it could have bad consequences, I think it's simpler and saner to let users choose the whole file name instead of forcing their hand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions