Class Ando_Function for PHP


This is a simple class for creating generic callbacks in PHP. There are a couple of reasons for using this class instead of the usual ´array( $container, $function )´ method.

First, the usual method doesn’t allow you to run the called code with more arguments than those provided by the calling code.

Second, this class resolves to the usual method when no extra arguments are provided, thus making it transparent at run time. This could seem useless, but, for free, we get much easier to spot callback calling points.

{[ .class-func | 1.hilite(=php=) ]}

Here are some tests.

{[ .tests | 1.hilite(=php=) ]}

Screen Shot 2014-10-28 at 16.53.43

(previous permalink: class-func-for-php)

How to autocomplete PHPUnit in VVV using PHPStorm 8

First install phpunit.phar locally:

Then right-click on the External Libraries entry in the Project pane and choose Configure PHP include paths…

Then add an include path to the folder where phpunit.phar is installed:

Screen Shot 2014-10-27 at 1.11.25

And finally you get all completions:

Screen Shot 2014-10-27 at 1.18.02