Hywan / atoum-instrumentation

The atoum\instrumentation library. Instrumentation for PHP (moles, code coverage…)
7 stars 2 forks source link

Brackets added around uses #12

Closed jubianchi closed 10 years ago

jubianchi commented 10 years ago
use
    mageekguy\atoum,
    mageekguy\atoum\exceptions
;

use mageekguy\atoum;
use mageekguy\atoum\exceptions;

becomes

use{
    mageekguy\atoum,
    mageekguy\atoum\exceptions
};

use{ mageekguy\atoum; }
use{ mageekguy\atoum\exceptions; }

I got it fixed by adding

if(T_USE === $token[static::TOKEN_ID])
    return false;

Here https://github.com/Hywan/atoum-instrumentation/blob/master/sequence/matching.php#L89

Hywan commented 10 years ago

Why can't I reproduce this bug :-/? What is your version of PHP please?

Hywan commented 10 years ago

Moreover, brackets are added when we met a predefined structure. T_USE is not listed in static::$_structures, so… I don't understand. Could you dump all the token ID after this condition to see if a T_USE appears?

jubianchi commented 10 years ago
$ php -v 

PHP 5.4.23 (cli) (built: Jan 13 2014 20:00:47)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

$ php -r "var_dump(T_USE);"

int(340)

On 5.4 T_USE is equal to 340 and here you define T_FINALLY with the same value.

Hywan commented 10 years ago

T_USE is equal to 342 in 5.7.0-dev. Here we are…

Hywan commented 10 years ago

Hello :-),

Does this patch ac348e6afd6d2fce92ffa97c19f1736d31e91b47 fix the issue?

jubianchi commented 10 years ago

I'll try to apply your patch on my dev branch of atoum.

I'll let you know how it behaves but as you may expect, I will perhaps have a little delay.

Hywan commented 10 years ago

\o/

jubianchi commented 10 years ago

fixed ;)

Hywan commented 10 years ago

Ok… daddy ;-).