coding-standards icon indicating copy to clipboard operation
coding-standards copied to clipboard

InstantiateNewClassesSniff can be simplified

Open aik099 opened this issue 9 years ago • 0 comments

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.

  1. find class name, that is created (including namespace)
  2. get next non-whitespace char and if it's not ( then return
  3. get next non-whitespace char and if it's not ) then report an error and return in other case

aik099 avatar Apr 09 '15 17:04 aik099