Skip to content

Commit d7a6969

Browse files
authored
[PHP] Update phpstan libs (parti-renaissance#7192)
1 parent 96feeb4 commit d7a6969

28 files changed

+266
-55
lines changed

composer.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@
154154
"friendsofphp/php-cs-fixer": "^3.0",
155155
"league/flysystem-memory": "^1.0",
156156
"pedrotroller/php-cs-custom-fixer": "^2.25",
157-
"phpstan/phpstan": "^0.12.66",
157+
"phpstan/extension-installer": "^1.1",
158+
"phpstan/phpstan": "^1.5",
159+
"phpstan/phpstan-doctrine": "^1.3",
160+
"phpstan/phpstan-symfony": "^1.1",
158161
"phpunit/phpunit": "^9.5",
159162
"symfony/css-selector": "^4.4",
160163
"symfony/debug-bundle": "^4.4",

composer.lock

+195-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan.neon.dist

+2
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ parameters:
55
- src
66
- config
77
- migrations
8+
symfony:
9+
containerXmlPath: var/cache/dev/srcApp_KernelDevDebugContainer.xml

src/Admin/Filter/AdherentRoleFilter.php

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Sonata\DoctrineORMAdminBundle\Filter\CallbackFilter;
1616
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
1717

18+
/** @phpstan-ignore-next-line */
1819
class AdherentRoleFilter extends CallbackFilter
1920
{
2021
public function getDefaultOptions()

src/Admin/Filter/ReferentTagAutocompleteFilter.php

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Sonata\AdminBundle\Form\Type\ModelAutocompleteType;
77
use Sonata\DoctrineORMAdminBundle\Filter\CallbackFilter;
88

9+
/** @phpstan-ignore-next-line */
910
class ReferentTagAutocompleteFilter extends CallbackFilter
1011
{
1112
public function getDefaultOptions()

src/Admin/Filter/ZoneAutocompleteFilter.php

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQuery;
1010
use Sonata\DoctrineORMAdminBundle\Filter\CallbackFilter;
1111

12+
/** @phpstan-ignore-next-line */
1213
class ZoneAutocompleteFilter extends CallbackFilter
1314
{
1415
public function getDefaultOptions(): array

src/Command/ReferentTagImportCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ private function importReferentManagedAreas(InputInterface $input, OutputInterfa
171171
throw new \RuntimeException(sprintf('No Adherent found with uuid "%s". (line %d)', $uuid, $index + 2));
172172
}
173173

174-
if (empty($tags)) {
174+
if (!\count($tags)) {
175175
throw new \RuntimeException(sprintf('No tag found for Adherent "%s %s". (line %d)', $firstName, $lastName, $index + 2));
176176
}
177177

src/Controller/EnMarche/CommitteeDesignation/CandidatureController.php

-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ public function candidacyListAction(Committee $committee, CommitteeCandidacyRepo
322322
return $this->render('committee/candidacy/candidacy_list.html.twig', [
323323
'candidacies' => $repository->findAllConfirmedForElection($election),
324324
'election' => $election,
325-
'membership' => $membership ?? null,
326325
'committee' => $committee,
327326
'designation' => $election->getDesignation(),
328327
]);

src/Entity/AdherentMessage/Segment/AudienceSegment.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use App\AdherentMessage\DynamicSegmentInterface;
77
use App\Entity\Adherent;
88
use App\Entity\AdherentMessage\Filter\AudienceFilter;
9-
use App\Entity\AdherentMessage\Filter\SegmentFilterInterface;
109
use App\Entity\AuthorInterface;
1110
use App\Entity\DynamicSegmentTrait;
1211
use App\Entity\EntityIdentityTrait;
@@ -90,7 +89,7 @@ public function __construct(UuidInterface $uuid = null)
9089
$this->uuid = $uuid ?? Uuid::uuid4();
9190
}
9291

93-
public function getFilter(): ?SegmentFilterInterface
92+
public function getFilter(): ?AudienceFilter
9493
{
9594
return $this->filter;
9695
}

src/Entity/Jecoute/SurveyQuestion.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function getDataAnswers(): Collection
143143
}
144144

145145
/**
146-
* @return false|Collection|DataAnswer[]
146+
* @return false|DataAnswer
147147
*/
148148
public function getDataAnswersFor(SurveyQuestion $surveyQuestion, DataSurvey $dataSurvey)
149149
{

src/Entity/VotingPlatform/Designation/CandidacyInvitationInterface.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ interface CandidacyInvitationInterface
1111
public function setCandidacy(CandidacyInterface $candidacy): void;
1212

1313
public function isPending(): bool;
14+
15+
public function getMembership(): ?object;
1416
}

src/Form/Admin/AvailableDistrictAutocompleteType.php

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Sonata\AdminBundle\Form\Type\ModelAutocompleteType;
77
use Symfony\Component\OptionsResolver\OptionsResolver;
88

9+
/** @phpstan-ignore-next-line */
910
class AvailableDistrictAutocompleteType extends ModelAutocompleteType
1011
{
1112
public function configureOptions(OptionsResolver $resolver)

src/Mailchimp/Campaign/SegmentConditionsBuilder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function buildFromMailchimpCampaign(MailchimpCampaign $campaign): array
5656
'list_id' => $this->getListId($message),
5757
'segment_opts' => array_merge($savedSegment, [
5858
'match' => 'all',
59-
'conditions' => $conditions ?? [],
59+
'conditions' => $conditions,
6060
]),
6161
];
6262
}
@@ -84,7 +84,7 @@ public function buildFromDynamicSegment(DynamicSegmentInterface $dynamicSegment)
8484

8585
return [
8686
'match' => 'all',
87-
'conditions' => $conditions ?? [],
87+
'conditions' => $conditions,
8888
];
8989
}
9090

src/Normalizer/CampaignRepliesDataSurveyNormalizer.php

+4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ public function normalize($object, $format = null, array $context = [])
4343
'gender' => $object->getPapCampaignHistory()->getGender(),
4444
'age_range' => $object->getPapCampaignHistory()->getAgeRange(),
4545
];
46+
/** @phpstan-ignore-next-line */
4647
$dataSurvey['begin_at'] = $dataSurvey['pap_campaign_history']['begin_at'] ?? null;
48+
/** @phpstan-ignore-next-line */
4749
$dataSurvey['finish_at'] = $dataSurvey['pap_campaign_history']['finish_at'] ?? null;
4850
} elseif ($object->isOfPhoningCampaignHistory()) {
4951
$dataSurvey['type'] = 'Phoning';
@@ -55,7 +57,9 @@ public function normalize($object, $format = null, array $context = [])
5557
'age_range' => null,
5658
]
5759
: null;
60+
/** @phpstan-ignore-next-line */
5861
$dataSurvey['begin_at'] = $dataSurvey['phoning_campaign_history']['begin_at'] ?? null;
62+
/** @phpstan-ignore-next-line */
5963
$dataSurvey['finish_at'] = $dataSurvey['phoning_campaign_history']['finish_at'] ?? null;
6064
} elseif ($object->isOfJemarcheDataSurvey()) {
6165
$dataSurvey['type'] = 'Libre';

0 commit comments

Comments
 (0)