sebastianbergmann / php-token-stream

Wrapper around PHP's tokenizer extension.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Methods named "class" are not handled correctly

Arcesilas opened this issue · comments

Q A
php-code-coverage version 7.0.7
PHP version 7.3.8
Driver Xdebug
Xdebug version (if used) 2.7.2
Installation Method Composer
Usage Method PHPUnit
PHPUnit version (if used) 8.3.5

Example class:

<?php

namespace Ns;

class Foo
{
    public function class()
    {
        return true;
    }
}

Related test:

<?php

use Ns\Foo;
use PHPUnit\Framework\TestCase;

class FooTest extends TestCase
{
    public function testClassMethod()
    {
        $foo = new Foo();
        $this->assertTrue($foo->class());
    }
}

Running the test:

$ vendor/bin/phpunit --filter=FooTest --coverage-text
PHPUnit 8.3.5 by Sebastian Bergmann and contributors.

.                                                                   1 / 1 (100%)

Time: 72 ms, Memory: 6.00 MB

OK (1 test, 1 assertion)

Generating code coverage report in HTML format ... done [47 ms]


Code Coverage Report:   
  2019-09-16 17:38:20   
                        
 Summary:               
  Classes:  0.00% (0/7) 
  Methods:  0.00% (0/22)
  Lines:    0.00% (0/39)

Edit
In the HTML report, the method is diplayed like this:

string\class   n/a 0 / 0 1   n/a 0 / 0

Confirmed.

Here is the HTML report for the example as-is (with the method named "class"):
Screenshot from 2019-09-17 07-25-30

Here is the HTML report for the example with the method named "bar":
Screenshot from 2019-09-17 07-25-15

Note that I do not see the string\class you mentioned.