Skip to content

Add hooks rule#1

Merged
remyperona merged 8 commits intomainfrom
feature/add-hooks-rules
Mar 10, 2026
Merged

Add hooks rule#1
remyperona merged 8 commits intomainfrom
feature/add-hooks-rules

Conversation

@remyperona
Copy link
Copy Markdown
Collaborator

@remyperona remyperona commented Mar 6, 2026

Description

This extension adds static analysis rules to ensure proper implementation of WordPress hooks through subscriber classes. It validates that your event subscribers follow best practices for WordPress actions and filters.

Type of change

  • New feature (non-breaking change which adds functionality).

Detailed scenario

What was tested

TBD

How to test

TBD

Affected Features & Quality Assurance Scope

TBD

Technical description

Documentation

Validates get_subscribed_events() implementations in classes that implement subscriber interfaces. This rule ensures:

  1. Required Annotations: All hook registrations must have @action or @filter PHPDoc annotations
  2. Filter Return Types: Filter callbacks must return non-void values
  3. Action Return Types: Action callbacks must return void
  4. Parameter Count Validation: When accepted_args is specified, the callback method must have the correct number of parameters

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

@remyperona remyperona self-assigned this Mar 6, 2026
@remyperona remyperona merged commit 10d80d0 into main Mar 10, 2026
3 checks passed
@remyperona remyperona deleted the feature/add-hooks-rules branch March 10, 2026 15:27
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

Successfully merging this pull request may close these issues.

1 participant