mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-03-17 19:28:06 +00:00
Fix phpstan issues
This commit is contained in:
@@ -31,6 +31,8 @@ final readonly class RemoveOldAuditCronJob implements CronJobInterface
|
||||
$config = $bag->get('chill_main.audit_trail');
|
||||
if (is_array($config) && is_string($intervalString = $config['delete_after'] ?? null)) {
|
||||
$this->deleteBefore = new \DateInterval($intervalString);
|
||||
} else {
|
||||
throw new \InvalidArgumentException('Invalid configuration for delete_after interval');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\DependencyInjection;
|
||||
|
||||
use Chill\MainBundle\DependencyInjection\Widget\AddWidgetConfigurationTrait;
|
||||
use Symfony\Component\Config\Definition\Builder\ParentNodeDefinitionInterface;
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
@@ -31,11 +32,16 @@ class Configuration implements ConfigurationInterface
|
||||
$this->setWidgetFactories($widgetFactories);
|
||||
}
|
||||
|
||||
public function getConfigTreeBuilder()
|
||||
public function getConfigTreeBuilder(): TreeBuilder
|
||||
{
|
||||
$treeBuilder = new TreeBuilder('chill_main');
|
||||
$rootNode = $treeBuilder->getRootNode();
|
||||
|
||||
if ($rootNode instanceof ParentNodeDefinitionInterface) {
|
||||
throw new \LogicException('unexpected type');
|
||||
}
|
||||
|
||||
/* @phpstan-ignore-next-line */
|
||||
$rootNode
|
||||
->children()
|
||||
->scalarNode('installation_name')
|
||||
@@ -315,6 +321,7 @@ class Configuration implements ConfigurationInterface
|
||||
->end() // end of root
|
||||
;
|
||||
|
||||
/* @phpstan-ignore-next-line */
|
||||
$rootNode->children()
|
||||
->arrayNode('add_address')->addDefaultsIfNotSet()->children()
|
||||
->scalarNode('default_country')->cannotBeEmpty()->defaultValue('BE')->end()
|
||||
@@ -325,6 +332,7 @@ class Configuration implements ConfigurationInterface
|
||||
->end()
|
||||
->end();
|
||||
|
||||
/* @phpstan-ignore-next-line */
|
||||
$rootNode->children()
|
||||
->arrayNode('audit_trail')->addDefaultsIfNotSet()->children()
|
||||
->scalarNode('delete_after')->cannotBeEmpty()->defaultValue('P6M')->info('The duration (a valid interval) before deleting the audit trail. Will be run by a cronjob.')->end()
|
||||
|
||||
@@ -15,7 +15,6 @@ use Chill\MainBundle\Audit\Subject;
|
||||
use Chill\MainBundle\Audit\SubjectDisplayerInterface;
|
||||
use Chill\MainBundle\Templating\Entity\ChillEntityRenderManagerInterface;
|
||||
use Chill\PersonBundle\Repository\PersonResourceRepository;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Twig\Environment;
|
||||
|
||||
@@ -25,7 +24,6 @@ final readonly class PersonResourceSubjectDisplayer implements SubjectDisplayerI
|
||||
private Environment $twig,
|
||||
private TranslatorInterface $translator,
|
||||
private PersonResourceRepository $personResourceRepository,
|
||||
private PersonRenderInterface $personRender,
|
||||
private ChillEntityRenderManagerInterface $chillEntityRenderManager,
|
||||
) {}
|
||||
|
||||
|
||||
@@ -27,8 +27,6 @@ class CommentSubjectConverter implements SubjectConverterInterface, SubjectConve
|
||||
|
||||
public function convert(mixed $subject, bool $includeAssociated = false): SubjectBag
|
||||
{
|
||||
\assert($subject instanceof Comment);
|
||||
|
||||
$main = new SubjectBag(new Subject('accompanying_period_comment', ['id' => $subject->getId()]));
|
||||
|
||||
if (null !== $subject->getAccompanyingPeriod()) {
|
||||
|
||||
@@ -25,7 +25,6 @@ use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\Form;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -43,7 +42,6 @@ final class PersonController extends AbstractController
|
||||
private readonly AuthorizationHelperInterface $authorizationHelper,
|
||||
private readonly SimilarPersonMatcher $similarPersonMatcher,
|
||||
private readonly TranslatorInterface $translator,
|
||||
private readonly EventDispatcherInterface $eventDispatcher,
|
||||
private readonly PersonRepository $personRepository,
|
||||
private readonly ConfigPersonAltNamesHelper $configPersonAltNameHelper,
|
||||
private readonly ValidatorInterface $validator,
|
||||
|
||||
@@ -31,9 +31,9 @@ final class SingleTaskSubjectConverter implements SubjectConverterInterface, Sub
|
||||
$main = new SubjectBag($mainSubject);
|
||||
|
||||
if ($includeAssociated) {
|
||||
if ($subject->getPerson()) {
|
||||
if (null !== $subject->getPerson()) {
|
||||
$main->append($this->subjectConverterManager->getSubjectsForEntity($subject->getPerson(), false));
|
||||
} elseif ($subject->getCourse()) {
|
||||
} elseif (null !== $subject->getCourse()) {
|
||||
$main->append($this->subjectConverterManager->getSubjectsForEntity($subject->getCourse(), false));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user