-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add ResultInterface template #67
Conversation
…in the Check classes. Started with DiskFree and DiskUsage checks. - Changed the `data` value/structure so it's visible what kind of data is returned as well If acceptable I will continue with the other checks. Signed-off-by: Bram Leeda <[email protected]>
* @psalm-type ResultData array{availability: array{value: float, valueType: string}} | ||
*/ | ||
class DiskFree extends AbstractCheck implements CheckInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think CheckInterface
should specify the psalm template here: not each concrete implementation.
Declaring an @template TResult of Failure|Success|Warning
on the interface should highlight the missing @template-implements
in each implementation of CheckInterface
, and then we can remove all manual @return
declarations on each of the check()
methods.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ocramius
That means that other code repositories with custom implementations of the interface, would also have failing psalm/phpstan checks after updating right?
It would be the better solution yes, and mean that all new checks would also set this up.
If the static-analysis issue is okay (don't know if it falls under a bc break, as the code api doesnt change) I will change this :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they would get a failure during analysis, but we don't really consider those BC breaks: the code works as it did before, and the types are just more precise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would leave #62 alone for now :)
As for the patch: please rebase, instead of merging upstream.
I removed from milestone since PR is closed by author. |
Add ResultInterface template for the
data
field, for strict typing in the Check classes.Started with DiskFree and DiskUsage checks.
data
value/structure so it's visible what kind of data is returned as wellIf acceptable I will continue with the other checks.
Signed-off-by: Bram Leeda [email protected]