Phpactor is a PHP refactoring and autocompletion tool that works as both a standalone CLI application and backend for text editors. It provides intelligent code completion, class and method references, renaming and moving of classes, and code generation capabilities. Phpactor uses Tolerant PHP Parser to build an AST and power its reflection abilities. It communicates with editors via an RPC protocol and includes a Vim plugin to demonstrate its capabilities.
4. Things I wanted
● Cotext-aware auto-complete
● Moving classes and updating references
● Finding references
● Renaming
● Class generation
● Class inflection
5. Things I had
● “already seen” / ctag / php function completion
● Class import via. Ctags (vim-php-namespace)
● Git grep (fugitive)
● for file in `git ls-files`; do perl
-pie ‘s/foo/bar` $file; done …
● Nerdtree
● Syntastic
● Argument wrapping (vim-argwrap)
6. Phpactor
● Always waiting for somebody else to write one.
●
First attempt Sep 24th
2015
●
+5 Second attempt Feb 14th
2016
●
+10 Third attempt Novemeber 24th
2016
●
+8 Forth and final attempt June 19th
2016
9. Worse Reflection
● Based on BetterReflection* …
● Provides class reflection from an AST.
● AST provided by Tolerant PHP Parser.
● Locates source code with autoloader.
● Can build frames.
10. Standalone Tool
● Class move
● Class copy
● Class transform (implement interfaces, complete
constructor etc)
● New class
● Class inflect (new class based on an existing)
● Debug frames
● References / renaming / etc