-
Notifications
You must be signed in to change notification settings - Fork 25
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
Suggestion: typehinting MyObject::get() #113
Comments
Well, besides your typo... That is actually a pretty good idea to add the common static methods to the docblock |
Actually I just realised we can add that to DataObject directly. just |
What typo? |
@tractorcow this isn't working for me: diff --git a/src/ORM/DataObject.php b/src/ORM/DataObject.php
index 928576fca..beb8cdf45 100644
--- a/src/ORM/DataObject.php
+++ b/src/ORM/DataObject.php
@@ -3030,7 +3030,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
*
* @todo $containerClass is Ignored, why?
*
- * @return DataList The objects matching the filter, in the class specified by $containerClass
+ * @return DataList|static[] The objects matching the filter, in the class specified by $containerClass
*/
public static function get(
$callerClass = null,
I notice PSR-5 (back in draft again) supports collections e.g. |
maybe this is not as relevant with silverstripe 5.2 being released? |
@lekoala it looks like they still recommend developers write their own type hints, which this module would assist with: https://docs.silverstripe.org/en/5/changelogs/5.2.0/#generics-return-lists
|
I've established that this works and gives you typehinting for dataobjects.
Do with this what you will :)
The text was updated successfully, but these errors were encountered: