mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Fixed PHPUnit exception
This commit is contained in:
parent
8e96971b9c
commit
1b3fc2c23c
2 changed files with 2 additions and 5 deletions
|
@ -56,9 +56,6 @@ class FAIconGenerator
|
||||||
*/
|
*/
|
||||||
public function fileExtensionToFAType(string $extension): string
|
public function fileExtensionToFAType(string $extension): string
|
||||||
{
|
{
|
||||||
if ('' === $extension) {
|
|
||||||
throw new InvalidArgumentException('You must specify an extension!');
|
|
||||||
}
|
|
||||||
//Normalize file extension
|
//Normalize file extension
|
||||||
$extension = strtolower($extension);
|
$extension = strtolower($extension);
|
||||||
foreach (self::EXT_MAPPING as $fa => $exts) {
|
foreach (self::EXT_MAPPING as $fa => $exts) {
|
||||||
|
|
|
@ -39,8 +39,8 @@ final class AttachmentExtension extends AbstractExtension
|
||||||
return [
|
return [
|
||||||
/* Returns the URL to a thumbnail of the given attachment */
|
/* Returns the URL to a thumbnail of the given attachment */
|
||||||
new TwigFunction('attachment_thumbnail', fn(Attachment $attachment, string $filter_name = 'thumbnail_sm'): ?string => $this->attachmentURLGenerator->getThumbnailURL($attachment, $filter_name)),
|
new TwigFunction('attachment_thumbnail', fn(Attachment $attachment, string $filter_name = 'thumbnail_sm'): ?string => $this->attachmentURLGenerator->getThumbnailURL($attachment, $filter_name)),
|
||||||
/* Returns the font awesome icon class which is representing the given file extension */
|
/* Returns the font awesome icon class which is representing the given file extension (We allow null here for attachments without extension) */
|
||||||
new TwigFunction('ext_to_fa_icon', fn(string $extension): string => $this->FAIconGenerator->fileExtensionToFAType($extension)),
|
new TwigFunction('ext_to_fa_icon', fn(?string $extension): string => $this->FAIconGenerator->fileExtensionToFAType($extension ?? '')),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue