-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Make it possible to strong type Entity properties #37209
Conversation
7127218
to
739f2ca
Compare
@@ -29,16 +29,16 @@ | |||
use function substr; | |||
|
|||
/** | |||
* @method int getId() | |||
* @method ?int getId() |
Check failure
Code scanning / Psalm
ImplementedReturnTypeMismatch
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 do not understand this error, OC\Authentication\Token\PublicKeyToken::getId has a return type of int, not ?int.
/rebase |
4fce81e
to
34d2622
Compare
PropertyNotSetInConstructor still have to be suppressed because properties are actually set in fromRow/fromParams methods, and the init path is too convoluted anyway. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
34d2622
to
f7a61ac
Compare
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Giving up on this one 😢 |
PropertyNotSetInConstructor still have to be suppressed because properties are
actually set in fromRow/fromParams methods, and the init path is too
convoluted anyway.
Summary
I tried several solutions to improve typing for QBMapper/Entity, I could not find a clean way to type properties without suppressing PropertyNotSetInConstructor manually and adding the @method annotations by hand as well.
But at least we can now type those properties and have psalm-compliant entities.
Also id property is actually nullable and null by default for autoincrement, made that clear in the code.
Checklist