mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-03-16 02:47:45 +00:00
Fix phpstan issues
This commit is contained in:
@@ -1803,46 +1803,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:canBeUnset\\(\\)\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#"
|
||||
count: 3
|
||||
path: src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\MainBundle\\\\DependencyInjection\\\\Configuration\\:\\:getWidgetFactories\\(\\) has invalid return type Chill\\\\MainBundle\\\\DependencyInjection\\\\Widget\\\\WidgetFactoryInterface\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php
|
||||
|
||||
-
|
||||
message: "#^PHPDoc tag @param has invalid value \\(WidgetFactoryInterface\\[\\]\\)\\: Unexpected token \"\\\\n \", expected variable at offset 42$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$place of method Chill\\\\MainBundle\\\\DependencyInjection\\\\Configuration\\:\\:filterWidgetByPlace\\(\\) expects string, Chill\\\\MainBundle\\\\DependencyInjection\\\\Widget\\\\type given\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$place of method Chill\\\\MainBundle\\\\DependencyInjection\\\\Configuration\\:\\:getWidgetAliasesbyPlace\\(\\) expects Chill\\\\MainBundle\\\\DependencyInjection\\\\Widget\\\\type, string given\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\$place of method Chill\\\\MainBundle\\\\DependencyInjection\\\\Configuration\\:\\:getWidgetAliasesbyPlace\\(\\) has invalid type Chill\\\\MainBundle\\\\DependencyInjection\\\\Widget\\\\type\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\$widgetFactories of method Chill\\\\MainBundle\\\\DependencyInjection\\\\Configuration\\:\\:setWidgetFactories\\(\\) has invalid type Chill\\\\MainBundle\\\\DependencyInjection\\\\Widget\\\\WidgetFactoryInterface\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\DependencyInjection\\\\Widget\\\\Factory\\\\WidgetFactoryInterface\\:\\:getAllowedPlaces\\(\\)\\.$#"
|
||||
count: 3
|
||||
|
||||
@@ -21,6 +21,7 @@ parameters:
|
||||
- src/Bundle/*/src/migrations/*
|
||||
- src/Bundle/*/src/translations/*
|
||||
- src/Bundle/*/src/Resources/*
|
||||
- src/Bundle/ChillMainBundle/DependencyInjection/Widget/AddWidgetConfigurationTrait.php
|
||||
|
||||
includes:
|
||||
- phpstan-baseline.neon
|
||||
|
||||
@@ -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