Reflect 3.0.0-beta-3 has just been released.

News :

  • Old plantUML:run command was migrated in two new API methods/commands :

    • diagram:class that allow to print a single UML class diagram

      bartlett_reflect.classdiagramV3.png
    • diagram:package that allow to print a full package (namespace(s)) UML diagram

      Click to enlarge image in real size.

In a quick look you can see what is in scope of package and what it isn’t
It’s extensible to other graphic engine (like GraphViz), but required to implement new processors with interface Bartlett\Reflect\Api\V3\Diagram\ProcessorInterface. E.g: Bartlett\Reflect\Api\V3\Diagram\PlantUmlProcessor
  • The Migration Guide to v3 is now available.

Bugs :

  • fix missing output in CLI (Linux OS). Thanks to Remi Collet (see commit b56ba62)

Roadmap :
  • First release candidate is planned for Marth 3, 2015

  • Stable release one month later.

Download :

Published by Laurent Laville on 2015-02-26

Reflect 3.0.0-beta-2 has just been released.

Changes :

  • CacheAwareEventDispatcher replaced EventDispatcher to improve memory usage by removing ast data for all listener except the CachePlugin.

  • ast data on phpreflect.success event is transmitted un-serialized now. Serialization is proceed on CachePlugin.

  • phpdocumentor/reflection-docblock dependency was upgraded to version 2.0.4 to include the LICENSE file, in phar distribution.

  • xdebug.max_nesting_level ini option was removed. See RFC to learn more.

  • The Developer Guide is now available.

Download :

Published by Laurent Laville on 2015-02-19

Reflect 3.0.0-beta-1 has just been released.

3.0.0-beta1 is final milestone of API 3.0

We have reached a point where API is stabilized and is ready for a release candidate.

  • Like composer, Reflect has adopted an ascii text logo.

           _           ____       __ _           _
     _ __ | |__  _ __ |  _ \ ___ / _| | ___  ___| |_
    | '_ \| '_ \| '_ \| |_) / _ \ |_| |/ _ \/ __| __|
    | |_) | | | | |_) |  _ <  __/  _| |  __/ (__| |_
    | .__/|_| |_| .__/|_| \_\___|_| |_|\___|\___|\__|
    |_|         |_|
  • Add a new component, the NotifierPlugin that allow to be notified at end of a long parsing process.

    Actually only a Growl notifier is provided (by PEAR/Net_Growl 2.7 package), but your are free to make your own.

  • Specific code remaining Collection\ReferenceCollection to CompatInfo have been transfered to this project.

  • Removed setter Reflect::setPluginManager(), and getter Reflect::getPluginManager(), no more used.

  • Added a new class Reflect\Util on code refactoring, to remove dupplicated code about time formatted to display.

  • A bit of color to make the phar manifest more readable.

  • Updated php min version required (5.3.2) due to usage of stream_resolve_include_path (see PR#17)

  • Ensures that there will be no errors when traversing highly nested node trees (E.g : https://github.com/phpmd/phpmd/blob/master/src/test/resources/files/Regression/24975295/testLocalVariableUsedInDoubleQuoteStringGetsNotReported.php). See commit [defded5]9eb8eab6fb02475970745529bbf8f51a1

  • A new file queue strategy was applied to detect conditional code. Used only by CompatInfo and its compatibility analyser. See php-compatinfo GH-160 issue.

Download :

Published by Laurent Laville on 2015-02-03

Reflect 3.0.0-beta-1 preview.

While 3.0.0-beta1 was initially planned on 2015-01-30 (see roadmap), it’s now ready to be released on February 3rd 2015.

Highlight the main feature that will be available in the new API 3.0 :

  • A unified API for all platforms and usages.
    Command-Line Interface or via PHP code with the same pattern.

With Symfony Console verbosity level 3, you will print the raw API response rather than the console view report. Easy to debug and compare.

  • Example 1: Compare analyser run process (with a single analyser)

CLI
$ php bin\phpreflect -vvv analyser:run ../src
PHP
<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';

use Bartlett\Reflect\Client;

// creates an instance of client
$client = new Client();

// request for a Bartlett\Reflect\Api\Analyser
$api = $client->api('analyser');

// perform request, on a data source with default analyser
$dataSource = dirname(__DIR__) . '/src';
$analysers  = array('structure');

$metrics = $api->run($dataSource, $analysers);

print_r($metrics);

  • Example 2: Compare analyser list process

CLI
$ php bin\phpreflect -vvv analyser:list
PHP
<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';

use Bartlett\Reflect\Client;

// creates an instance of client
$client = new Client();

// request for a Bartlett\Reflect\Api\Analyser
$api = $client->api('analyser');

$analysers = $api->dir();

print_r($analysers);

  • Example 3: Compare plugin list process

CLI
$ php bin\phpreflect -vvv plugin:list
PHP
<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';

use Bartlett\Reflect\Client;
use Bartlett\Reflect\Environment;

// defines environment where to find the JSON config file
if (!getenv("BARTLETTRC")) {
    putenv("BARTLETTRC=phpreflect.json");
}
Environment::setScanDir();

// creates an instance of client
$client = new Client();

// request for a Bartlett\Reflect\Api\Plugin
$api = $client->api('plugin');

$plugins = $api->dir();

print_r($plugins);

  • Example 4: Compare reflection class process

CLI
$ php bin\phpreflect reflection:class Bartlett\Reflect ../src
Do not use verbose level 3 to compare results in this case. It will return a Bartlett\Reflect\Model\ClassModel instance.
PHP
<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';

use Bartlett\Reflect\Client;

// creates an instance of client
$client = new Client();

// request for a Bartlett\Reflect\Api\Reflection
$api = $client->api('reflection');

// perform request, on a data source
$dataSource = dirname(__DIR__) . '/src';

$model = $api->class_('Bartlett\\Reflect', $dataSource);

echo $model;

CLI or PHP mode will print such output

Class [ <user> class Bartlett\Reflect extends Bartlett\Reflect\Event\AbstractDispatcher ] {
  @@ C:\home\github\php-reflect\src\Bartlett\Reflect.php 45 - 340

  - Constants [0] {
  }

  - Properties [2] {
    Property [ private $analysers ]
    Property [ private $dataSourceId ]
  }

  - Methods [6] {
    Method [ <user> public method __construct ] {
      @@ C:\home\github\php-reflect\src\Bartlett\Reflect.php 53 - 57

      - Parameters [0] {
      }
    }

    Method [ <user> public method addAnalyser ] {
      @@ C:\home\github\php-reflect\src\Bartlett\Reflect.php 66 - 71

      - Parameters [1] {
        Parameter #0 [ <required> PhpParser\NodeVisitor $analyser ]
      }
    }

    Method [ <user> public method getAnalysers ] {
      @@ C:\home\github\php-reflect\src\Bartlett\Reflect.php 78 - 81

      - Parameters [0] {
      }
    }

    Method [ <user> public method setDataSourceId ] {
      @@ C:\home\github\php-reflect\src\Bartlett\Reflect.php 90 - 94

      - Parameters [1] {
        Parameter #0 [ <required> $id ]
      }
    }

    Method [ <user> public method getDataSourceId ] {
      @@ C:\home\github\php-reflect\src\Bartlett\Reflect.php 101 - 104

      - Parameters [0] {
      }
    }

    Method [ <user> public method parse ] {
      @@ C:\home\github\php-reflect\src\Bartlett\Reflect.php 113 - 339

      - Parameters [1] {
        Parameter #0 [ <required> Symfony\Component\Finder\Finder $finder ]
      }
    }
  }
}
Published by Laurent Laville on 2015-02-02