opened
DavertMik
username_0
Looks like current have big issues with parsing php code with "::class" in it. 

Code to reproduce:

```php
<?php
require_once 'vendor/autoload.php';

$string = "<?php
return [
    'user' => User::class
];
";

error_reporting(-1);
ini_set('display_errors', 'On');
error_reporting(E_ALL);
$broker = new \TokenReflection\Broker(new \TokenReflection\Broker\Backend\Memory());
$broker->processString($string, 'reflection_test.php');
echo "done";

```

Installed packages:

```
➜  AspectMock git:(master) ✗ composer show
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
andrewsville/php-token-reflection 1.4.0  Library emulating the PHP internal reflection using just the tokenized source code.
codeception/base                  2.1.5  BDD-style testing framework
codeception/specify               0.4.3  BDD code blocks for PHPUnit and Codeception
codeception/verify                0.3.0  BDD assertion library for PHPUnit
doctrine/annotations              v1.2.7 Docblock Annotations Parser
doctrine/instantiator             1.0.5  A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                    v1.0.1 Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
goaop/framework                   1.0.2  Framework for aspect-oriented programming in PHP.
guzzlehttp/psr7                   1.2.3  PSR-7 message implementation
jakubledl/dissect                 v1.0.1 Lexing and parsing in pure PHP
myclabs/deep-copy                 1.5.0  Create deep copies (clones) of your objects
phpdocumentor/reflection-docblock 2.0.4  
phpspec/prophecy                  v1.6.0 Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage         2.2.4  Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator         1.4.1  FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-text-template         1.2.1  Simple template engine.
phpunit/php-timer                 1.0.7  Utility class for timing
phpunit/php-token-stream          1.4.8  Wrapper around PHP's tokenizer extension.
phpunit/phpunit                   4.8.24 The PHP Unit Testing framework.
phpunit/phpunit-mock-objects      2.3.8  Mock Object library for PHPUnit
psr/http-message                  1.0    Common interface for HTTP messages
sebastian/comparator              1.2.0  Provides the functionality to compare PHP values for equality
sebastian/diff                    1.4.1  Diff implementation
sebastian/environment             1.3.5  Provides functionality to handle HHVM/PHP environments
sebastian/exporter                1.2.1  Provides the functionality to export PHP variables for visualization
sebastian/global-state            1.1.1  Snapshotting of global state
sebastian/recursion-context       1.0.2  Provides functionality to recursively process PHP variables
sebastian/version                 1.0.6  Library that helps with managing the version number of Git-hosted PHP projects
symfony/browser-kit               v3.0.3 Symfony BrowserKit Component
symfony/console                   v3.0.3 Symfony Console Component
symfony/css-selector              v3.0.3 Symfony CssSelector Component
symfony/dom-crawler               v3.0.3 Symfony DomCrawler Component
symfony/event-dispatcher          v3.0.3 Symfony EventDispatcher Component
symfony/finder                    v3.0.3 Symfony Finder Component
symfony/polyfill-mbstring         v1.1.1 Symfony polyfill for the Mbstring extension
symfony/yaml                      v3.0.3 Symfony Yaml Component

```
::class issues
issue
created
DavertMik
username_0
However, this code works:

```php
class UserModel {
 public function getClass() {

    return User::class();
}
}
```
comment
created
DavertMik
username_0
I know that's the issue of tokenizer and not of Go AOP itself, but as php-tokenizer is deprecated I'm not sure what to do next. Should I try to patch it and send a PR or use one of the works like `kornrunner/php-token-reflection`? Or just switch to PHP-Parser and Go AOP v2?
comment
created
lisachenko
username_1
I think the best option here is to drop 1.x version of framework and give a try for 2.x-dev, it relies on `nikic/PHP-Parser` and can be considered more reliable and supported. As a bonus, you will get a support for PHP5.6 and PHP7 syntax.
comment
created
DavertMik
username_0
Yeah, I managed to overcome this issue by not loading this exact file. 
Ok, can you create a tag got 2.0 branch so I could try it on my project?
comment
created
lisachenko
username_1
Yes, will do it this evening
comment
created
lisachenko
username_1
This issue related only to the 1.x branch and already fixed in the master. Closing it.
comment
closed
lisachenko
username_1
issue