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.
Summary: | "@return $this" in phpDoc | ||
---|---|---|---|
Product: | php | Reporter: | Aequiternus |
Component: | Editor | Assignee: | Tomas Mysik <tmysik> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | junichi11, PeterRankin, PeterVR, tmysik |
Priority: | P3 | ||
Version: | 7.4 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Attachments: |
patch
patch-v2 a missing file |
Description
Aequiternus
2014-01-04 16:12:56 UTC
Agreed, more and more frameworks are using '$this'. The behavior already exists in Netbeans, it just uses 'this' for some reason. The valid return types are 'self', 'static' and '$this'. As said, this is in the latest docs and in the PSR-5 Proposal: https://github.com/phpDocumentor/fig-standards/blob/master/proposed/phpdoc.md#keyword Created attachment 158216 [details]
patch
I've created a patch.
Tomas, could you please review it? 1. VariousUtils, ModelVisitor Currently, "\this" is supported. So if "$this" is written with @return, just replace it to "\this". 2. FunctionScopeImpl Now, there are a few differences between "@retern \this" and "return $this". e.g. - If "@return \this" is used, resolves the caller type. "return $this" doesn't. - If "@return \this" is used with other types(@return \this|MyClass|MyClass2), the other types(MyClass, MyClass2) are ignored. So I fixed them. 3. test/unit/data/testfiles/completion/lib/test216119/test216119.php.testUseCase1.completion In this context, $this means the Test class. 4. PHPCommentGenerator If return type is "\this", convert to "$this". 5. about trait case I think that it is related to issue 256106[1]. I'll look at it later. [1] https://netbeans.org/bugzilla/show_bug.cgi?id=256106 Thanks. Will have a look at it, thanks a lot, Junichi! Created attachment 158238 [details] patch-v2 > 3. > test/unit/data/testfiles/completion/lib/test216119/test216119.php. > testUseCase1.completion This is wrong, sorry. I noticed that there is a part I forgot to remove(I fixed a little when I look at issue 256106). I think that it should be fixed with 256106. So, I recreated a patch. Thanks. Patch applied, thanks a lot for it, Junichi! http://hg.netbeans.org/web-main/rev/b5f567919204 Created attachment 158267 [details]
a missing file
I'm sorry. I forgot to add a test file...
(In reply to junichi11 from comment #7) > I'm sorry. I forgot to add a test file... Pushed, thanks for it! http://hg.netbeans.org/web-main/rev/35bd17068827 Thanks for applying it quickly! Integrated into 'main-silver', will be available in build *201601290002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/b5f567919204 User: Tomas Mysik <tmysik@netbeans.org> Log: #239987 - "@return $this" in phpDoc Patch contributed by junichi11@netbeans.org. *** Bug 245129 has been marked as a duplicate of this bug. *** *** Bug 258440 has been marked as a duplicate of this bug. *** |