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

Implement the correct rules for whether overridden methods should be documented #125

Open
timhunt opened this issue Oct 27, 2023 · 0 comments

Comments

@timhunt
Copy link

timhunt commented Oct 27, 2023

Moodle coding style says that this is how it should be:

/** ... */
class base_class {
    /**
     * Document the purpose and contract of this method.
     */
    funcition do_something(): void {
    }
}
/** ... */
class sub_class extends base_class {
    funcition do_something(): void {
        // Just implement the purpopse defined in the base class, so there should not be a duplicate PHPdoc comment here.
    }
}

However, the PHPdoc checker currently gets this wrong, becuase it only analyses one file at a time.

However, now we rely more on class autoloading, we might finally be able to improve this, at least in the case where:

  1. this file contains a single class definition.
  2. This class extends classes/implements interfaces which are autoloadable.

Then, we can parse those files to get a list of public and protected methods, and we can use that in local_moodlecheck_functionsdocumented, to avoid giving warnigns about those funcitions. (Indeed, we could start issuing a warning if there is a comment there.)

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

No branches or pull requests

1 participant