]> source.dussan.org Git - nextcloud-server.git/commit
Add template typing to the QBMapper
authorChristoph Wurst <christoph@winzerhof-wurst.at>
Fri, 9 Oct 2020 12:27:59 +0000 (14:27 +0200)
committerChristoph Wurst <christoph@winzerhof-wurst.at>
Mon, 12 Oct 2020 09:10:08 +0000 (11:10 +0200)
commita1b351036c62e5557ff4f718a919188d23db7332
treef26e6e751051700dbd9ae34858fc480cbecb6041
parentb76698c547bcaf22857f8ec67a8567399520f73a
Add template typing to the QBMapper

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 <christoph@winzerhof-wurst.at>
lib/public/AppFramework/Db/QBMapper.php