Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PHP] Inheriting docs is broken #4686

Closed
terax6669 opened this issue Sep 25, 2022 · 2 comments · Fixed by #4846
Closed

[PHP] Inheriting docs is broken #4686

terax6669 opened this issue Sep 25, 2022 · 2 comments · Fixed by #4846
Assignees
Labels
kind:bug Bug report or fix PHP [ci] enable extra PHP tests (php/php.editor)
Milestone

Comments

@terax6669
Copy link

Apache NetBeans version

Apache NetBeans 15

What happened

NetBeans doesn't inherit docs for class properties, see example below.

How to reproduce

<?php

/**
 * This works fine
 */
class Foo
{
	/**
	 * This thing is broken
	 */
	public $bar;

	/**
	 * This also works fine
	 */
	public function foobar() {}
}

class Bar extends Foo
{
	public $bar = 'bar';

	public function foobar() {}
}

/**
 * {@inheritDoc}
 */
class FooBar extends Foo
{
	/**
	 * {@inheritDoc}
	 */
	public $bar = 'bar';

	/**
	 * {@inheritDoc}
	 */
	public function foobar() {}
}

/**
 * {@inheritDoc} trying to extend docs
 * won't work!
 */
class FooBarFoo extends Foo
{
	/**
	 * {@inheritDoc} this is just ridiculous
	 */
	public $bar = 'bar';

	/**
	 * {@inheritDoc} sadly this is also broken
	 */
	public function foobar() {}
}

$foo = new Foo;            // IDE hint: This works fine
$foo->bar;                 // IDE hint: This thing is broken
$foo->foobar();            // IDE hint: This is ridiculous

$bar = new Bar;            // IDE hint: This works fine
$bar->bar;                 // IDE hint:
$bar->foobar();            // IDE hint: This also works fine

$foobar = new FooBar;      // IDE hint: This works fine
$foobar->bar;              // IDE hint: {@inheritDoc}
$foobar->foobar;           // IDE hint: This also works fine

$foobarfoo = new FooBarFoo; // IDE hint: {@inheritDoc} trying to extend docs won't work!
$foobarfoo->bar;            // IDE hint: {@inheritDoc} this is just ridiculous
$foobarfoo->foobar;         // IDE hint: {@inheritDoc} sadly this is also broken

Did this work correctly in an earlier version?

No / Don't know

Operating System

Windows 11 Pro 22000.978

JDK

OpenJDK 19.0.0 (from Chocolatey)

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

https://pear.php.net/package/PhpDocumentor/docs/latest/phpDocumentor/tutorial_tags.inlineinheritdoc.pkg.html

Are you willing to submit a pull request?

No

Code of Conduct

Yes

@terax6669 terax6669 added kind:bug Bug report or fix needs:triage Requires attention from one of the committers labels Sep 25, 2022
@mbien mbien added the PHP [ci] enable extra PHP tests (php/php.editor) label Sep 28, 2022
@junichi11 junichi11 self-assigned this Oct 19, 2022
@junichi11 junichi11 removed the needs:triage Requires attention from one of the committers label Oct 19, 2022
@junichi11
Copy link
Member

junichi11 commented Oct 19, 2022

I'll fix the behavior for fields and consts.

I implemented this feature based on that behavior (https://pear.php.net/package/PhpDocumentor/docs/latest/phpDocumentor/tutorial_tags.inlineinheritdoc.pkg.html).

The parent phpdoc doesn't have a description but it has only a header.

May I have your expected result?

Other IDE, editor and language

  • It seems that Eclipse and VSCode doesn't handle properly...
  • Java editor(NB) replace it with whole sentences. (Don't separate a header and description.)

junichi11 added a commit to junichi11/netbeans that referenced this issue Oct 23, 2022
junichi11 added a commit to junichi11/netbeans that referenced this issue Oct 23, 2022
Phpdocumentor separates sentences into the header and description.
Then, it replaces `{@inheritdoc}` with description.

However, if there is only one sentence in the parent PHPDoc,
`{@inheritdoc}` is not replaced anything in the child PHPDoc.
So, just replace `{@inheritdoc}` with whole parent sentences by default.
@junichi11 junichi11 linked a pull request Oct 23, 2022 that will close this issue
junichi11 added a commit to junichi11/netbeans that referenced this issue Oct 24, 2022
Phpdocumentor separates sentences into the header and description.
Then, it replaces `{@inheritdoc}` with description.

However, if there is only one sentence in the parent PHPDoc,
`{@inheritdoc}` is not replaced anything in the child PHPDoc.
So, just replace `{@inheritdoc}` with whole parent sentences by default.
junichi11 added a commit to junichi11/netbeans that referenced this issue Oct 24, 2022
Phpdocumentor separates sentences into the header and description.
Then, it replaces `{@inheritdoc}` with description.

However, if there is only one sentence in the parent PHPDoc,
`{@inheritdoc}` is not replaced anything in the child PHPDoc.
So, just replace `{@inheritdoc}` with whole parent sentences by default.
@junichi11 junichi11 added this to the NB17 milestone Oct 24, 2022
tmysik added a commit that referenced this issue Oct 24, 2022
Chris2011 pushed a commit to Chris2011/netbeans that referenced this issue Dec 15, 2022
Chris2011 pushed a commit to Chris2011/netbeans that referenced this issue Dec 15, 2022
Phpdocumentor separates sentences into the header and description.
Then, it replaces `{@inheritdoc}` with description.

However, if there is only one sentence in the parent PHPDoc,
`{@inheritdoc}` is not replaced anything in the child PHPDoc.
So, just replace `{@inheritdoc}` with whole parent sentences by default.
@mediashowroom
Copy link

I've just tested this in NB17 and it still does not work. {@inheritdoc} shows up in plain text instead of being replaced by the parent docblock comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Bug report or fix PHP [ci] enable extra PHP tests (php/php.editor)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants