> 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/7c115051-8ced-396a-bbfa-34330e660205%40korulczyk.pl.
For more options, visit https://groups.google.com/d/optout.