You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Ádám Turcsán (Jira)" <ji...@apache.org> on 2020/07/20 11:44:00 UTC

[jira] [Comment Edited] (NETBEANS-4432) Find usages of __construct not throrough enough

    [ https://issues.apache.org/jira/browse/NETBEANS-4432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17161169#comment-17161169 ] 

Ádám Turcsán edited comment on NETBEANS-4432 at 7/20/20, 11:43 AM:
-------------------------------------------------------------------

Sure thing!
{code:php}
<?php

declare(strict_types=1);

namespace UsageTest;

class Test
{
    private function __construct()
    {
        // No operation needed for demonstration
        // It is private because instantiation only intended through the
        // "named constructors", the static methods below.
    }

    public static function fromArray(array $data): self
    {
        return new self();
    }

    public static function fromObject(object $data): Test
    {
        return new Test();
    }
}
{code}
Find usages for the constructor only shows the usage from the `fromObject` method. (As per the screenshot)


was (Author: lwjunior):
Sure thing!
{code:php}
<?php

declare(strict_types=1);

namespace UsageTest;

class Test
{
    private function __construct()
    {
        // No operation needed for demonstration
    }

    public static function fromArray(array $data): self
    {
        return new self();
    }

    public static function fromObject(object $data): Test
    {
        return new Test();
    }
}
{code}
Find usages for the constructor only shows the usage from the `fromObject` method. (As per the screenshot)

> Find usages of __construct not throrough enough
> -----------------------------------------------
>
>                 Key: NETBEANS-4432
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-4432
>             Project: NetBeans
>          Issue Type: Improvement
>          Components: php - Code Analysis
>    Affects Versions: 12.0
>            Reporter: Ádám Turcsán
>            Priority: Major
>         Attachments: screenshot-1.png
>
>
> If I use the tool "Find usages" on a class constructor, It doesn't find the usages where it is called from the class itself, like {{new self()}}.
> Because self is an instant static bindig (unlike {{static::}} ) It is quite straightforward, which consturct call is this.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists