Skip to content

editor of a php file does not recognize class inhereted methods from a trait that uses trait #3783

@thanasis-oob

Description

@thanasis-oob

Apache NetBeans version

Apache NetBeans 13

What happened

I use the IDE for a php project(PHP7.4 as PHP version). I am going to give you an example to understand the problem because it is about inheritance and I think it is more practical to view the class definitions.

The problem is that the system displays me a false alarm error hint that the Class does satisfy a method from an interface.
screenshot

Specifically, The error appeared in the CookiesPage class and informs me that the class should implement the cancelUrl method of the HasCancelPageInterface interface

There is not any compilation error in the web application. it is just problem in the development because confuses the programmer.

\App\Logic\Template\Page\Frontend\CookiesPage is not abstract and does not override abstract method  cancelUrl(array $parameters = []) in \App\Logic\Template\Page\Contracts\HasCancelPageInterface

The class relationships are

class CookiesPage extends PageModelWebPageAbstract
{
}
abstract class PageModelWebPageAbstract extends FrontendWebPage
{
}
abstract class FrontendWebPage implements FrontendWebPageInterface
{
    use FrontendWebPageTrait;
}
interface FrontendWebPageInterface extends WebPageInterface, HasCancelPageInterface
{
    public function enabled();

    public function displayedDate();

    public function lastUpdatedDate();

    public function hasAuthUser()
   
    public function authUser();
}
interface WebPageInterface
{
    public function type();

    public function title();

    public function description();

    public function content();

    public function metaTitle();

    public function metaDescription();

    public function url(array $parameters = []);

    public function viewName();
    
    public function htmlBodyClass();
}
interface HasCancelPageInterface
{
    public function cancelPage();
    
    public function cancelTitle()

    public function cancelUrl(array $parameters = [])
}
trait FrontendWebPageTrait
{
    use CancelablePageTrait;
    use WebPageTrait;

    public function __construct()
    {
    }

    public function type()
    {
        return null;
    }
    
    public function enabled()
    {
    }

    public function ogType()
    {
    }

    public function displayedDate()
    {
    }

    public function lastUpdatedDate()
    {
    }
}
trait CancelablePageTrait
{
    
    public function cancelPage()
    {
    }

    public function hasCancelPage()
    {
    }

    public function cancelTitle()
    {
    }

    public function cancelUrl(array $parameters = [])
    {
    }
}
trait WebPageTrait
{
    
    public function hasAuthUser()
    {
    }

    public function authUser()
    {
    }
    
    public function setActionUser(Authenticatable $user)
    {
    }

    public function getActionUser()
    {
    }

    public function htmlBodyClass()
    {
    }
    
    public function viewName()
    {
    }

    public function viewPath()
    {
    }

    public function title()
    {
    }

    public function description()
    {
    }

    public function content()
    {
    }

    public function metaTitle()
    {
    }

    public function metaDescription()
    {
    }

    public function metaKeywords()
    {
    }

    public function url(array $parameters = [])
    {
    }

    public function checkActive($request)
    {
    }
}

How to reproduce

Create a new PHP project(using PHP7.4 as php version). Create the files which I described above. Open the Cookies class file for editing and check the the re is any error hint in the line of the class definition.

Did this work correctly in an earlier version?

No

Operating System

Ubuntu 16.04

JDK

openjdk 1.8.0_292

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

No

Code of Conduct

Yes

Metadata

Metadata

Assignees

Labels

PHP[ci] enable extra PHP tests (php/php.editor)cannot reproducekind:bugBug report or fix

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions