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

Compiler::loadDefinitions: allow to get to existing service by class #145

Closed

Conversation

matej21
Copy link
Contributor

@matej21 matej21 commented Feb 27, 2017

  • bug fix? no
  • new feature? yes
  • BC break? no

it is useful when you want to modify anonymous service in your local.neon

@matej21 matej21 force-pushed the feature/config-service-by-class branch from be48786 to 6339d48 Compare February 27, 2017 15:23
@TomasVotruba
Copy link
Contributor

Interesting. What is your specific use case?

@matej21 matej21 force-pushed the feature/config-service-by-class branch from 6339d48 to b592489 Compare February 27, 2017 17:29
@dg dg closed this in 4eb358d Feb 27, 2017
@@ -257,7 +257,13 @@ public function generateCode(): array
public static function loadDefinitions(ContainerBuilder $builder, array $services, string $namespace = NULL)
{
foreach ($services as $name => $def) {
if ((string) (int) $name === (string) $name) {
if (is_string($name) && preg_match('#^@\w*[\\\][\w\\\]+\z#', $name)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about

if (is_int($name)) {
    ....
} elseif (preg_match(....)) {
   ....
}

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

Successfully merging this pull request may close these issues.

None yet

3 participants