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

PHP Config: LayerCollector should reference layer by variable #1196

Open
patrickkusebauch opened this issue May 25, 2023 · 2 comments
Open

Comments

@patrickkusebauch
Copy link
Collaborator

Currently it is by the string representation of the layer name.

@gennadigennadigennadi
Copy link
Member

gennadigennadigennadi commented Jun 7, 2023

That's a good idea.
But one disadvantage would be, that you have to define the LayerCollectorConfig add the end (should be fine with a note in the documentation), if you want to reference the other layers by the variable.

So should be have both options?

$secondLayer = Layer::withName('second')->collectors(
    // by string
    LayerConfig::create('first'),
);

$firstLayer = Layer::withName('first')->collectors(
    DirectoryConfig::create('./src'),
);

$thirdLayer = Layer::withName('thirs')->collectors(
    // by variable
    LayerConfig::create($firstLayer),
);

@patrickkusebauch
Copy link
Collaborator Author

Yeah, absolutely. What I like about this approach is that it would make it much harder to make cyclic layer dependencies. I have more notes on PHP Config ergonomics as I just ported a relatively large project from YAML to PHP in the past few days.

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

No branches or pull requests

2 participants