Skip to content
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

docs: Use proper return type for custom template listing #50196

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

juliusknorr
Copy link
Member

@juliusknorr juliusknorr commented Jan 15, 2025

Came up with nextcloud/richdocuments#4386 in psalm

We have the wrong return type annotated, the returned list is using Template objects, which is also what all existing implementations do and what the usage expects:

* @return list<Template>
*/
private function getTemplateFiles(TemplateFileCreator $type): array {
$templates = [];
foreach ($this->getRegisteredProviders() as $provider) {
foreach ($type->getMimetypes() as $mimetype) {
foreach ($provider->getCustomTemplates($mimetype) as $template) {
$templates[] = $template;

https://github.com/nextcloud/richdocuments/blob/ba9c364e952fed85dd7431f711b57246b9e268f3/lib/Template/CollaboraTemplateProvider.php#L47
https://github.com/ONLYOFFICE/onlyoffice-nextcloud/blob/d20b985948957de6785a5e126aa9d63dd668b453/lib/TemplateProvider.php#L69

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants