Enhance your IDE
Aurelijus Banelis

About me

Aurelijus Banelis
aurelijus@banelis.lt
PHP developer
Context
pair programming
unit tests
acceptance tests
seconds
minutes
hours
--------------------------
Tools & IDE
Problem
Fatal error: Call to a member function
getPrice() on null
Catchable fatal error: Argument 1 passed
to vat() must implement interface Currency
Fatal error: Call to undefined method Article::isSellabl()
Notice: Undefined index: bruto
returns null
type hinting
typing mistakes
typing mistakes
especially in arrays!
Solution: Enhance IDE
- Tell your IDE:
Annotate - Fool your IDE:
Generate - Enhance your IDE:
Write the plugin
Easy
Extensive
JAVA
DRY
1. Annotate
@var @param @return
/** @method bool t(string $a) */
class A {}
(new A())->t('works');
@method
@mixin
@SuppressWarnings(PHPMD)
trait T { var $c; var $d; }
/** @mixin T */
$a=json_decode('{"c":1,"d":2}');
$a->b
2. Generate
if ("never" == "happens") {
class a_parent extends oxArticle {}
}
phalcon-devtools/ide/2.0.0
use Phalcon\Mvc\Controller;
$STATIC_METHOD_TYPES = array(
oxNew('') => array(
'oxcmp_basket' instanceof \oxcmp_basket,
'oxwArticleBox' instanceof \oxwArticleBox,
3. Enhance

3. PHPStorm PSI
Program
Structure
Interface

position
""
[""]
a()[""]
a()
function a()
/** @return [...
References & links
- https://github.com/aurelijusb/simple-phpstorm-plugin
- https://github.com/Haehnchen/idea-php-symfony2-plugin
- https://confluence.jetbrains.com/display/PhpStorm/Plugin+Development
- https://confluence.jetbrains.com/display/PhpStorm/Setting-up+environment+for+PhpStorm+plugin+development
- https://confluence.jetbrains.com/display/PhpStorm/PHP+Open+API
- https://confluence.jetbrains.com/display/IntelliJIDEA/Custom+Language+Support
Summary
What will make you a good developer
is the tools
Questions?
/**
* @method string ask(callable $presenter)
*/
Enhance your IDE
By Aurelijus Banelis
Enhance your IDE
Why and how you could improve your PHP IDE (use PHPStorm as example)
- 628