Skip to content

class keyword not recognised for getClasses() #7

@jnkowa-gfk

Description

@jnkowa-gfk

information is based on http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class.

since php5.5 there is a keyword to gather a classes name: MyClass::class;
unfortunately this causes issues with the class gathering, so the current implementation has a bug.

example code:

<?php
namespace MyName\Space;

class MyClass
{
    public function __construct()
    {
        $ret = \Bar::class;
        $set = \Foo::class;
        $get = \Bar\FooBar::class;
        $let = self::class;
    }
}

echo MyClass::class;

having this example code parsed and then using \Cz\PhpDepend::getClasses()
returns: ['MyName\Space\MyClass', 'MyName\Space', 'MyName\Space', 'MyName\Space', 'MyName\Space']
expected: ['MyName\Space\MyClass']

having this example code parsed and then using \Cz\PhpDepend::getDependencies()
returns: ['Bar', 'Foo', 'Bar\FooBar', 'MyName\Space\MyClass']
expected: same as it is returned ✅

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions