Skip to content

Add return type hints to Auditable and Auditor contracts#1051

Open
rrodrigofranco wants to merge 1 commit intoowen-it:masterfrom
rrodrigofranco:add-return-type-hints
Open

Add return type hints to Auditable and Auditor contracts#1051
rrodrigofranco wants to merge 1 commit intoowen-it:masterfrom
rrodrigofranco:add-return-type-hints

Conversation

@rrodrigofranco
Copy link
Copy Markdown

What this PR does

Adds native PHP return type hints to methods in Auditable and Auditor contracts that were either missing them or had incorrect PHPDoc annotations:

  • getAuditEvent(): ?string — previously had no return type hint
  • getAuditDriver(): string — previously had no return type hint and incorrect @return string|null PHPDoc (the method always returns a string via fallback)
  • execute(): void — previously had no return type hint

Why

Improves compatibility with static analysis tools (PHPStan, Psalm) and makes the API contracts more explicit without any breaking changes to existing behavior.

@willpower232
Copy link
Copy Markdown
Contributor

these could be breaking changes for some peoples usage of the library and the types present in the docblocks should be sufficient for people who do use static analysis tools so I don't think this should be merged

unless @erikn69 disagrees, I presume the reason these types are only in docblock form is specifically for this flexibility

@erikn69
Copy link
Copy Markdown
Contributor

erikn69 commented Apr 6, 2026

I think the same; this should have been added before the v14 release, but it's too late now.

@parallels999 parallels999 added revisit in future Consider for later review v15 Considered for v15 labels Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

revisit in future Consider for later review v15 Considered for v15

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants