coding-standards
coding-standards copied to clipboard
InstantiateNewClassesSniff can be simplified
The https://github.com/joomla/coding-standards/blob/master/Sniffs/Classes/InstantiateNewClassesSniff.php sniff is doing a lot of comparisons inside, but if it really checks that no ()
are present after new SomeClass
then why it's not checking that.
- find class name, that is created (including namespace)
- get next non-whitespace char and if it's not
(
then return - get next non-whitespace char and if it's not
)
then report an error and return in other case