archetype icon indicating copy to clipboard operation
archetype copied to clipboard

Rewrite StmtInserter

Open ajthinking opened this issue 3 years ago • 0 comments

The method insertStmts method automatically sorts the nodes in a strange way. Typically using ->add() will prepend the node among its equals. So the new use statement below will come out in the top:

PHPFile::load(User::class)
    ->add()->use(['Add\This']);

Improvements

  • ability to bypass automatic sorting (for example put properties AFTER methods if you for some reason want to)
  • ability to prepend and push among equals
  • sorting styles (by length, alphabetically)

ajthinking avatar Aug 24 '22 06:08 ajthinking