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

Merged
merged 1 commit into from
Jan 16, 2025

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

@blizzz blizzz merged commit 8998e77 into master Jan 16, 2025
186 of 188 checks passed
@blizzz blizzz deleted the fix/template-return-type branch January 16, 2025 11:31
@blizzz blizzz added this to the Nextcloud 31 milestone Jan 16, 2025
@skjnldsv skjnldsv mentioned this pull request Jan 16, 2025
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.

3 participants