Add return type hints to Auditable and Auditor contracts#1051
Open
rrodrigofranco wants to merge 1 commit intoowen-it:masterfrom
Open
Add return type hints to Auditable and Auditor contracts#1051rrodrigofranco wants to merge 1 commit intoowen-it:masterfrom
rrodrigofranco wants to merge 1 commit intoowen-it:masterfrom
Conversation
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 |
Contributor
|
I think the same; this should have been added before the v14 release, but it's too late now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Adds native PHP return type hints to methods in
AuditableandAuditorcontracts that were either missing them or had incorrect PHPDoc annotations:getAuditEvent(): ?string— previously had no return type hintgetAuditDriver(): string— previously had no return type hint and incorrect@return string|nullPHPDoc (the method always returns a string via fallback)execute(): void— previously had no return type hintWhy
Improves compatibility with static analysis tools (PHPStan, Psalm) and makes the API contracts more explicit without any breaking changes to existing behavior.