mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix some psalm errors
This commit is contained in:
parent
3f63bc803d
commit
dae383dbd9
1
.gitignore
vendored
1
.gitignore
vendored
@ -22,3 +22,4 @@ docs/build/
|
|||||||
|
|
||||||
/.php-cs-fixer.cache
|
/.php-cs-fixer.cache
|
||||||
/.idea/
|
/.idea/
|
||||||
|
/.psalm/
|
||||||
|
12
psalm.xml
12
psalm.xml
@ -6,6 +6,7 @@
|
|||||||
xmlns="https://getpsalm.org/schema/config"
|
xmlns="https://getpsalm.org/schema/config"
|
||||||
xsi:schemaLocation="https://getpsalm.org/schema/config tests/app/vendor/vimeo/psalm/config.xsd"
|
xsi:schemaLocation="https://getpsalm.org/schema/config tests/app/vendor/vimeo/psalm/config.xsd"
|
||||||
errorBaseline="psalm-baseline.xml"
|
errorBaseline="psalm-baseline.xml"
|
||||||
|
cacheDirectory="./.psalm"
|
||||||
>
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
@ -13,4 +14,15 @@
|
|||||||
<directory name="./tests/" />
|
<directory name="./tests/" />
|
||||||
</ignoreFiles>
|
</ignoreFiles>
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
|
|
||||||
|
<!-- suppress error around parameter bags - see https://github.com/symfony/symfony/issues/45609#issuecomment-1056816975 -->
|
||||||
|
<!-- maybe to desactivate with php 8.1 ? -->
|
||||||
|
<issueHandlers>
|
||||||
|
<UndefinedDocblockClass>
|
||||||
|
<errorLevel type="suppress">
|
||||||
|
<referencedClass name="UnitEnum" />
|
||||||
|
</errorLevel>
|
||||||
|
</UndefinedDocblockClass>
|
||||||
|
</issueHandlers>
|
||||||
|
|
||||||
</psalm>
|
</psalm>
|
||||||
|
@ -13,6 +13,7 @@ namespace Chill\BudgetBundle\Menu;
|
|||||||
|
|
||||||
use Chill\BudgetBundle\Security\Authorization\BudgetElementVoter;
|
use Chill\BudgetBundle\Security\Authorization\BudgetElementVoter;
|
||||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
|
use Chill\PersonBundle\Entity\Household\Household;
|
||||||
use Knp\Menu\MenuItem;
|
use Knp\Menu\MenuItem;
|
||||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
@ -13,6 +13,7 @@ namespace Chill\BudgetBundle\Menu;
|
|||||||
|
|
||||||
use Chill\BudgetBundle\Security\Authorization\BudgetElementVoter;
|
use Chill\BudgetBundle\Security\Authorization\BudgetElementVoter;
|
||||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Knp\Menu\MenuItem;
|
use Knp\Menu\MenuItem;
|
||||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\AMLI\FamilyMembersBundle\Repository;
|
namespace Chill\FamilyMembersBundle\Repository;
|
||||||
|
|
||||||
use Chill\AMLI\FamilyMembersBundle\Entity\FamilyMember;
|
use Chill\FamilyMembersBundle\Entity\FamilyMember;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
@ -160,6 +160,8 @@ class EntityWorkflowStep
|
|||||||
/**
|
/**
|
||||||
* get all the users which are allowed to apply a transition: those added manually, and
|
* get all the users which are allowed to apply a transition: those added manually, and
|
||||||
* those added automatically bu using an access key.
|
* those added automatically bu using an access key.
|
||||||
|
*
|
||||||
|
* @psalm-suppress DuplicateArrayKey
|
||||||
*/
|
*/
|
||||||
public function getAllDestUser(): Collection
|
public function getAllDestUser(): Collection
|
||||||
{
|
{
|
||||||
|
@ -553,8 +553,6 @@ class AccompanyingPeriod implements
|
|||||||
* 'now'.
|
* 'now'.
|
||||||
*
|
*
|
||||||
* @param mixed $person
|
* @param mixed $person
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function closeParticipationFor($person): ?AccompanyingPeriodParticipation
|
public function closeParticipationFor($person): ?AccompanyingPeriodParticipation
|
||||||
{
|
{
|
||||||
|
@ -880,7 +880,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection|BudgetCharges[]
|
* @return Collection|Charge[]
|
||||||
*/
|
*/
|
||||||
public function getBudgetCharges(): Collection
|
public function getBudgetCharges(): Collection
|
||||||
{
|
{
|
||||||
@ -888,7 +888,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection|BudgetResources[]
|
* @return Collection|Resource[]
|
||||||
*/
|
*/
|
||||||
public function getBudgetResources(): Collection
|
public function getBudgetResources(): Collection
|
||||||
{
|
{
|
||||||
|
@ -181,8 +181,12 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
|||||||
$this->assertEquals(1, $participations->count());
|
$this->assertEquals(1, $participations->count());
|
||||||
|
|
||||||
$participationL = $period->closeParticipationFor($person);
|
$participationL = $period->closeParticipationFor($person);
|
||||||
|
$this->assertNotNull($participationL);
|
||||||
|
|
||||||
|
if ($participationL instanceof AccompanyingPeriodParticipation) {
|
||||||
$this->assertSame($participationL, $participation);
|
$this->assertSame($participationL, $participation);
|
||||||
$this->assertTrue($participationL->getEndDate() instanceof DateTimeInterface);
|
$this->assertTrue($participationL->getEndDate() instanceof DateTimeInterface);
|
||||||
|
}
|
||||||
|
|
||||||
$participation = $period->getOpenParticipationContainsPerson($person);
|
$participation = $period->getOpenParticipationContainsPerson($person);
|
||||||
$this->assertNull($participation);
|
$this->assertNull($participation);
|
||||||
|
@ -11,10 +11,12 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Validator\Constraints\Relationship;
|
namespace Chill\PersonBundle\Validator\Constraints\Relationship;
|
||||||
|
|
||||||
|
use Chill\PersonBundle\Entity\Relationships\Relationship;
|
||||||
use Chill\PersonBundle\Repository\Relationships\RelationshipRepository;
|
use Chill\PersonBundle\Repository\Relationships\RelationshipRepository;
|
||||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||||
use Symfony\Component\Validator\Constraint;
|
use Symfony\Component\Validator\Constraint;
|
||||||
use Symfony\Component\Validator\ConstraintValidator;
|
use Symfony\Component\Validator\ConstraintValidator;
|
||||||
|
use Symfony\Component\Validator\Exception\UnexpectedValueException;
|
||||||
|
|
||||||
class RelationshipNoDuplicateValidator extends ConstraintValidator
|
class RelationshipNoDuplicateValidator extends ConstraintValidator
|
||||||
{
|
{
|
||||||
@ -25,14 +27,18 @@ class RelationshipNoDuplicateValidator extends ConstraintValidator
|
|||||||
$this->relationshipRepository = $relationshipRepository;
|
$this->relationshipRepository = $relationshipRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validate($relationship, Constraint $constraint)
|
public function validate($value, Constraint $constraint)
|
||||||
{
|
{
|
||||||
if (!$constraint instanceof RelationshipNoDuplicate) {
|
if (!$constraint instanceof RelationshipNoDuplicate) {
|
||||||
throw new UnexpectedTypeException($constraint, RelationshipNoDuplicate::class);
|
throw new UnexpectedTypeException($constraint, RelationshipNoDuplicate::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
$fromPerson = $relationship->getFromPerson();
|
if (!$value instanceof Relationship) {
|
||||||
$toPerson = $relationship->getToPerson();
|
throw new UnexpectedValueException($value, Relationship::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
$fromPerson = $value->getFromPerson();
|
||||||
|
$toPerson = $value->getToPerson();
|
||||||
|
|
||||||
$relationships = $this->relationshipRepository->findBy([
|
$relationships = $this->relationshipRepository->findBy([
|
||||||
'fromPerson' => [$fromPerson, $toPerson],
|
'fromPerson' => [$fromPerson, $toPerson],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user