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

Doesn't document the right inherited method #3633

Closed
adriendupuis opened this issue Jan 4, 2024 · 3 comments
Closed

Doesn't document the right inherited method #3633

adriendupuis opened this issue Jan 4, 2024 · 3 comments

Comments

@adriendupuis
Copy link
Contributor

adriendupuis commented Jan 4, 2024

When there is some cascaded inheritances, the final class might not have the right method signatures.

Expected behavior

In a cascade of inheritances, when an intermediate class override a base class method, the final class should have the last override in its documentation.

Actual behavior

Actually, the final class have an incorrect documentation pretending that it still inherits the base method.

Steps to reproduce the problem

  1. Create three classes into an empty directory in respectively BaseClass.php, InterClass.php and FinalClass.php
<?php
class BaseClass {
    public function __construct($a)
    {
    }
}
<?php
abstract class InterClass extends BaseClass {
    public function __construct($a, $b)
    {
    }
}
<?php
final class FinalClass extends InterClass {
}
  1. Generate documentation:
curl -LO "https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.4.3/phpDocumentor.phar";
php phpDocumentor.phar;
  1. Open the documentation index .phpdoc/build/index.html in a browser and navigate to FinalClass doc page (.phpdoc/build/classes/FinalClass.html).
  2. Notice that the documented __construct is the one from BaseClass instead of the one from InterClass, the signature is incomplete and a mandatory argument is missing. Trying to use it according to this doc will lead to a "PHP Warning: Uncaught ArgumentCountError: Too few arguments to function MiddleClass::__construct()".
  3. Click on the __construct link and notice that it ends on .phpdoc/build/classes/BaseClass.html#method___construct.

Your environment

  • macOS Ventura 13.2.1 (22D68)
  • PHP 8.2.11 (cli) (built: Sep 28 2023 16:20:53) (NTS)
  • phpDocumentor 3.4.3
@phpdoc-bot phpdoc-bot added this to Needs triage in phpDoc issue triage board Jan 4, 2024
@jaapio jaapio closed this as completed in 635e8d3 Jan 8, 2024
phpDoc issue triage board automation moved this from Needs triage to Closed Jan 8, 2024
@jaapio
Copy link
Member

jaapio commented Jan 8, 2024

Thanks for your report, I pushed a fix and it will be available in the next build of our docker image. If you are not using docker it will be part of the next release.

Your detailed report really helped to find the issue to thank you very much for that!

@adriendupuis
Copy link
Contributor Author

Hi @jaapio
Do you know when a new release will be tagged, and its phar available on https://github.com/phpDocumentor/phpDocumentor/releases?

@jaapio
Copy link
Member

jaapio commented May 17, 2024

I was planning to do that after this issue was closed but another urgent bug popped up, that needs to be solved before I can do a new release. I still hope I will be able to do that before the end of this month. But I'm a bit depending on others here .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants