mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-19 16:22:48 +01:00
Fixed phpunit and phpstan issues
This commit is contained in:
@@ -70,12 +70,14 @@ use App\Twig\Sandbox\SandboxedLabelExtension;
|
||||
use App\Twig\TwigCoreExtension;
|
||||
use InvalidArgumentException;
|
||||
use Twig\Environment;
|
||||
use Twig\Extension\AttributeExtension;
|
||||
use Twig\Extension\SandboxExtension;
|
||||
use Twig\Extra\Html\HtmlExtension;
|
||||
use Twig\Extra\Intl\IntlExtension;
|
||||
use Twig\Extra\Markdown\MarkdownExtension;
|
||||
use Twig\Extra\String\StringExtension;
|
||||
use Twig\Loader\ArrayLoader;
|
||||
use Twig\RuntimeLoader\FactoryRuntimeLoader;
|
||||
use Twig\Sandbox\SecurityPolicyInterface;
|
||||
|
||||
/**
|
||||
@@ -186,13 +188,18 @@ final class SandboxedTwigFactory
|
||||
$twig->addExtension(new StringExtension());
|
||||
$twig->addExtension(new HtmlExtension());
|
||||
|
||||
//Add Part-DB specific extension
|
||||
$twig->addExtension($this->formatExtension);
|
||||
$twig->addExtension($this->barcodeExtension);
|
||||
$twig->addExtension($this->entityExtension);
|
||||
$twig->addExtension($this->twigCoreExtension);
|
||||
$twig->addExtension($this->sandboxedLabelExtension);
|
||||
|
||||
//Our other extensions are using attributes, we need a bit more work to load them
|
||||
$dynamicExtensions = [$this->formatExtension, $this->barcodeExtension, $this->entityExtension, $this->twigCoreExtension];
|
||||
$dynamicExtensionsMap = [];
|
||||
|
||||
foreach ($dynamicExtensions as $extension) {
|
||||
$twig->addExtension(new AttributeExtension($extension::class));
|
||||
$dynamicExtensionsMap[$extension::class] = static fn () => $extension;
|
||||
}
|
||||
$twig->addRuntimeLoader(new FactoryRuntimeLoader($dynamicExtensionsMap));
|
||||
|
||||
return $twig;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
namespace App\Twig;
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\LogSystem\AbstractLogEntry;
|
||||
use App\Entity\UserSystem\User;
|
||||
use App\Repository\LogEntryRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -42,7 +43,7 @@ final readonly class UserRepoExtension
|
||||
#[AsTwigFunction('creating_user')]
|
||||
public function creatingUser(AbstractDBElement $element): ?User
|
||||
{
|
||||
return $this->entityManager->getRepository(LogEntryRepository::class)->getCreatingUser($element);
|
||||
return $this->entityManager->getRepository(AbstractLogEntry::class)->getCreatingUser($element);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,6 +52,6 @@ final readonly class UserRepoExtension
|
||||
#[AsTwigFunction('last_editing_user')]
|
||||
public function lastEditingUser(AbstractDBElement $element): ?User
|
||||
{
|
||||
return $this->entityManager->getRepository(LogEntryRepository::class)->getLastEditingUser($element);
|
||||
return $this->entityManager->getRepository(AbstractLogEntry::class)->getLastEditingUser($element);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{% if entity is instanceof("App\\Entity\\Parts\\Storelocation") %}
|
||||
{% if entity is instanceof("App\\Entity\\Parts\\StorageLocation") %}
|
||||
{{ dropdown.profile_dropdown('storelocation', entity.id, true, 'btn-secondary w-100 mt-2') }}
|
||||
{% endif %}
|
||||
|
||||
@@ -136,4 +136,4 @@
|
||||
{% if filterForm is defined %}
|
||||
{% include "parts/lists/_filter.html.twig" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user