Skip to content

Commit 8db4d9c

Browse files
committed
Fix Psalm errors
1 parent fe012d0 commit 8db4d9c

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

psalm.xml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xmlns="https://getpsalm.org/schema/config"
55
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
6-
phpVersion="8.1"
6+
phpVersion="8.2"
77
errorLevel="1"
88
findUnusedBaselineEntry="false"
99
findUnusedPsalmSuppress="false"
@@ -30,6 +30,11 @@
3030
</forbiddenFunctions>
3131
<issueHandlers>
3232
<MissingTemplateParam errorLevel="suppress"/> <!-- At some point we will add template params, but it's difficult when supporting multiple versions of Sylius/SF/Doctrine etc -->
33+
<InvalidArgument>
34+
<errorLevel type="suppress">
35+
<directory name="src/Fixture"/>
36+
</errorLevel>
37+
</InvalidArgument>
3338
<MixedAssignment>
3439
<errorLevel type="suppress">
3540
<directory name="src/Fixture"/>
@@ -40,5 +45,21 @@
4045
<directory name="src/Fixture"/>
4146
</errorLevel>
4247
</MixedArgument>
48+
<MixedArrayAccess>
49+
<errorLevel type="suppress">
50+
<directory name="src/Twig/Component"/>
51+
</errorLevel>
52+
</MixedArrayAccess>
53+
<MixedArrayAssignment>
54+
<errorLevel type="suppress">
55+
<directory name="src/Twig/Component"/>
56+
</errorLevel>
57+
</MixedArrayAssignment>
58+
<PropertyNotSetInConstructor>
59+
<errorLevel type="suppress">
60+
<directory name="src/Model"/>
61+
<directory name="src/Twig/Component"/>
62+
</errorLevel>
63+
</PropertyNotSetInConstructor>
4364
</issueHandlers>
4465
</psalm>

src/Form/Type/TermsTranslationType.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Setono\SyliusTermsPlugin\Form\Type;
66

7-
use Setono\SyliusTermsPlugin\Model\TermsTranslation;
87
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
98
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
109
use Symfony\Component\Form\Extension\Core\Type\TextType;
@@ -21,8 +20,8 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
2120
'attr' => [
2221
'data-action' => 'live#action',
2322
'data-live-action-param' => 'on(change)|generateTermsSlug',
24-
'data-live-locale-code-param' => $builder->getPropertyPath()->getElement(0),
25-
]
23+
'data-live-locale-code-param' => $builder->getPropertyPath()?->getElement(0),
24+
],
2625
])
2726
->add('slug', TextType::class, [
2827
'label' => 'setono_sylius_terms.form.terms.slug',

src/Twig/Component/TermsComponent.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class TermsComponent
2626
/** @use ResourceFormComponentTrait<TermsInterface> */
2727
use ResourceFormComponentTrait;
2828

29+
/**
30+
* @param RepositoryInterface<TermsInterface> $productRepository
31+
*/
2932
public function __construct(
3033
RepositoryInterface $productRepository,
3134
FormFactoryInterface $formFactory,
@@ -39,7 +42,7 @@ public function __construct(
3942
#[LiveAction]
4043
public function generateTermsSlug(#[LiveArg] string $localeCode = ''): void
4144
{
42-
$this->formValues['translations'][$localeCode]['slug'] = $this->slugGenerator->generate($this->formValues['translations'][$localeCode]['name']);
45+
$this->formValues['translations'][$localeCode]['slug'] = $this->slugGenerator->generate((string) $this->formValues['translations'][$localeCode]['name']);
4346
}
4447

4548
protected function getDataModelValue(): string

0 commit comments

Comments
 (0)