-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Add template typing to the QBMapper #23310
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
Conversation
|
nextcloud/mail#3783 is how I discovered that this actually works. Requires error level 3 or lower to show the type coercion. With the template I could resolve the issues :) Call me crazy but how about backporting this? It's not a functional change, just a different way to describe the API. Objections? |
d24a1b1 to
b0a956e
Compare
MorrisJobke
left a comment
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.
Nice 👍
This comment has been minimized.
This comment has been minimized.
The QBMapper is kind of a generic type, though this concept does not exist in php. Hence you have a lot of type coercion in subtypes (mappers in the individual apps) because you suddenly don't expect an Entity[] but your specific type. Luckily Psalm lets us type those. Then in the subclass you can psalm-implement the mapper with a concrete type and psalm will do all the magic to ensure types are used correctly. Signed-off-by: Christoph Wurst <[email protected]>
Signed-off-by: Christoph Wurst <[email protected]>
b0a956e to
2664c7f
Compare
|
/backport a1b3510 to stable20 |
|
/backport a1b3510 to stable19 |
|
🤖 beep boop beep 🤖 Here are the logs for the failed build: Status of 33975: failuresqliteShow full logmariadb10.1-php7.3
mariadb10.4-php7.4
mysql8.0-php7.4
mysql5.6-php7.3
postgres9-php7.3Show full logpostgres11-php7.4
|
|
Failing tests can only be unrelated as the comments only regard psalm and that passes 😇 |
The QBMapper is kind of a generic type, though this concept does not
exist in php. Hence you have a lot of type coercion in subtypes (mappers
in the individual apps) because you suddenly don't expect an Entity[]
but your specific type.
Luckily Psalm lets us type those. Then in the subclass you can
psalm-implement the mapper with a concrete type and psalm will do all
the magic to ensure types are used correctly.