In core.services.yml we have:

  - [setContext, ['@?router.request_context']]

But router.request_context is also defined in core.services.yml (and it depends on request_stack alone which doesn't depend on anything) so I can't see how could this become an invalid reference.

So why is @? used here?

  • 2
    Seems to be because of Simpletest: drupal.org/project/drupal/issues/2223593 – Clive Jun 5 '19 at 12:34
  • git blame points to drupal.org/node/2062745 where it was added originally with @? without any explanation so that doesn't help. – Smartsheet eng Jun 5 '19 at 16:15
  • Sorry I’m not sure what you mean - why would the lack of an explanation in the original commit mean it’s not related to the discussion/comments in the other (more recent) issue surrounding simpletest? – Clive Jun 5 '19 at 16:22
  • Nothing in the issue you linked explains the necessity of @? for simpletest either. If you have an environment where you can use the definition of url_generator from core.services.yml then you can also use router.request_context from the same. – Smartsheet eng Jun 6 '19 at 2:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.