Well, maybe. It's widely used in Java so I've got used to it years ago.
On Thursday, April 18, 2019 at 3:26:30 PM UTC+3, Robert Korulczyk wrote:
>
> > As the way to improve the code, it's possible:
> >
> > switch (true) {
> > case preg_match(Token::REGEX_OPERATOR, $this->code, $match, null,
> $this->cursor):
> > $this->pushToken(Token::OPERATOR_TYPE, preg_replace('/\s+/', '
> ', $match[0]));
> > break;
> > case preg_match(self::REGEX_NAME, $this->code, $match, null,
> $this->cursor):
> > $this->pushToken(Token::NAME_TYPE, $match[0]);
> > break;
> > }
> >
> > $this->moveCursor($match[0]);
>
> This is not an improvement, you're overusing switch syntax to hide regular
> if with dynamic condition - it is closer to obfuscation than readability
> improvement.
>
>
> Regards,
> Robert Korulczyk
>
--
You received this message because you are subscribed to the Google Groups "PHP
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/php-fig/bf9bad27-0547-4869-aa4b-bc86348e9f5d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.