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

  1. Tell your IDE:
    Annotate
  2. Fool your IDE:
    Generate
  3. 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 {}
}
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

Summary

What will make you a good developer

is the tools

Questions?

/**
 * @method string ask(callable $presenter)
 */
Made with Slides.com