Skip to content

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

@timhunt

Description

@timhunt

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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions