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
Provide Psalm integration #29
Provide Psalm integration #29
Conversation
- Adds Psalm and psalm PHPUnit plugin as dev requirements. - Adds Psalm configuration. - Fixes low-hanging fruit reported by Psalm. - Adds Psalm baseline file. Among the low-hanging fruit were the following `LinkCollection` signature changes: - `getLinks()` gets an `array` return typehint - `getLinksByRel()` gets an `array` return typehint - `withLink()` gets a `self` return typehint - `withoutLink()` gets a `self` return typehint These are all backwards compatible, but extensions will need to provide them. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
src/HalResource.php
Outdated
@@ -360,7 +360,7 @@ private function aggregateEmbeddedCollection(string $name, array $collection, st | |||
* Exists as array_shift is destructive, and we cannot necessarily know the | |||
* index of the first element. | |||
* | |||
* @param null|HalResource[] $resources | |||
* @param array $resources |
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.
This is the same information like in the method signature therefore it can be omitted.
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'm a bit surprised that Psalm did that...
src/LinkCollection.php
Outdated
@@ -43,8 +49,10 @@ public function getLinksByRel($rel) | |||
|
|||
/** | |||
* {@inheritDoc} | |||
* | |||
* @return HalResource |
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.
The same here. self
as return type should be enough.
Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Among the low-hanging fruit were the following
LinkCollection
signature changes:getLinks()
gets anarray
return typehintgetLinksByRel()
gets anarray
return typehintwithLink()
gets aself
return typehintwithoutLink()
gets aself
return typehintThese are all backwards compatible, but extensions will need to provide them.
Fixes #17