Space inside Symfony MicroKernelTrait anon. callback function passed by reference

Hello everyone.

Symfony has the following code:

And Sonar marks this line with an issue:

$instanceof = &\Closure::bind(function &() { return $this->instanceof; }, $kernelLoader, $kernelLoader)();

Put exactly one space between the “function” keyword and the opening parenthesis.

Do you guys have any advices how to fix it?

Hi,

To be clear, this isn’t code you’ve written; you’re analyzing library code? And if so, would you mind sharing why?

Assuming it is 3rd-party code, I would say there’s no need to fix it. The icon indicates it’s raised as a Code Smell, i.e. a readability issue, in this case. I would choose one of

  • ignore it
  • mark the issue false positive
  • edit your Quality Profile to disable the rule

 
HTH,
Ann