Fixed PHPstan issues.

This commit is contained in:
Jan Böhmer 2020-05-09 18:02:26 +02:00
parent 22a200e261
commit 28187f1ef2
2 changed files with 3 additions and 1 deletions

View file

@ -67,7 +67,7 @@ final class LabelHTMLGenerator
$page = 1;
foreach ($elements as $element) {
if ($options->getLinesMode() === 'twig' && $sandboxed_twig !== null) {
if ($options->getLinesMode() === 'twig' && isset($sandboxed_twig) && isset($current_user)) {
try {
$lines = $sandboxed_twig->render(
'lines',

View file

@ -22,6 +22,7 @@ namespace App\Services\LabelSystem;
use App\Entity\LabelSystem\LabelProfile;
use App\Repository\LabelProfileRepository;
use App\Services\UserCacheKeyGenerator;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Contracts\Cache\ItemInterface;
@ -45,6 +46,7 @@ class LabelProfileDropdownHelper
$secure_class_name = str_replace('\\', '_', LabelProfile::class);
$key = 'profile_dropdown_'.$this->keyGenerator->generateKey().'_'.$secure_class_name . '_' . $type;
/** @var LabelProfileRepository $repo */
$repo = $this->entityManager->getRepository(LabelProfile::class);
return $this->cache->get($key, function (ItemInterface $item) use ($repo, $type, $secure_class_name) {