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 199832 - @method ignores multiple return types following pipe (|)
Summary: @method ignores multiple return types following pipe (|)
Status: RESOLVED DUPLICATE of bug 211230
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.0
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks: 200161
  Show dependency tree
 
Reported: 2011-07-01 18:41 UTC by dharkness
Modified: 2012-04-16 08:50 UTC (History)
2 users (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 dharkness 2011-07-01 18:41:27 UTC
The pipe (|) in @return works to specify multiple return types from a normal method, but only the first type is seen by NetBeans in the equivalent @method. Since the hover help for @method and @property-read doesn't show, you can test that these work by using auto-complete on the returned value.

    /**
     * @method Foo|Bar foo()
     */
    class Foo
    {
        /**
         * @return Foo|Bar
         */
        public function foobar() {}
    }

    $f = new Foo;
    $f->foobar()->[CTRL+SPACE] auto-complete shows members for both [CORRECT]
    $f->foo()->[CTRL+SPACE] auto-complete shows members for Foo only [WRONG]
Comment 1 Tomas Mysik 2011-07-01 18:54:13 UTC
Please evaluate, thanks.
Comment 2 dharkness 2011-07-01 18:58:09 UTC
Note that while the PHPDoc documentation for @method [1] doesn't say that multiple types are allowed, this is specifically mentioned in the documentation for @return [2]. It seems like an oversight by the documentation writer.

[1] http://manual.phpdoc.org/HTMLframesConverter/default/phpDocumentor/tutorial_tags.method.pkg.html
[2] http://manual.phpdoc.org/HTMLframesConverter/default/phpDocumentor/tutorial_tags.return.pkg.html
Comment 3 Petr Pisl 2011-07-04 11:51:31 UTC
I know about this. Unfortunately the implementation of parsing @method doesn't follow the rest of php docs. I need to rewrite it.
Comment 4 Ondrej Brejla 2012-04-16 08:50:02 UTC

*** This bug has been marked as a duplicate of bug 211230 ***