This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 271164 - False Positive reserved name as method-name in namespace
Summary: False Positive reserved name as method-name in namespace
Status: RESOLVED DUPLICATE of bug 262141
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.2
Hardware: All All
: P3 normal (vote)
Assignee: issues@php
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-25 20:22 UTC by sirpilan
Modified: 2017-07-27 19:39 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sirpilan 2017-07-25 20:22:21 UTC
example (PHP7):
---
<?php

namespace test {

    class Test {
        public function print($name) { // valid, but editor does not like :(
            echo $name;
        }
    }
}

namespace {
    $foo = new test\Test();
    $foo->print('bar'); // works fine, as expected
}


problem:
---
Editor points out unexpected { ...

Since "print" or any other reserved php-function name you place as method name
will fail the same way.


solution:
---
Editor has to consider the namespace for reserved names


workaround:
---
Use __call, but in this case no IDE autocomplete takes place
Comment 1 sirpilan 2017-07-25 20:29:37 UTC
As static example there are 2 false positives.

static example (PHP7):
---

<?php

namespace test {

    class Test {
        public static function print($name) { // false positive
            echo $name;
        }
    }
}

namespace {
    test\Test::print('bar'); // false positive here aswell
}
Comment 2 junichi11 2017-07-27 02:17:34 UTC
It was already fixed. So please try to use a dev build[1].

[1] http://bits.netbeans.org/download/trunk/nightly/latest/

Thanks.

*** This bug has been marked as a duplicate of bug 262141 ***
Comment 3 sirpilan 2017-07-27 19:39:40 UTC
Thanks buddy :)