Skip to content

Commit

Permalink
Merge pull request #306 from PrestaShop/dependabot/composer/develop/p…
Browse files Browse the repository at this point in the history
…hpstan/phpstan-2.0.2

build(deps-dev): bump phpstan/phpstan from 1.12.9 to 2.0.2
  • Loading branch information
Progi1984 authored Nov 25, 2024
2 parents a5c1a0f + 9c80c75 commit fbf4790
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"require-dev": {
"ergebnis/composer-normalize": "^2.41",
"friendsofphp/php-cs-fixer": "^3.45",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^11.0",
"symfony/browser-kit": "~7.1.0",
"symfony/css-selector": "~7.1.0",
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Controller/ImportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ImportController extends AbstractController

private ?string $filename;

private ?string $version;
private string $version;

private ?\stdClass $jsonContent;

Expand All @@ -36,7 +36,7 @@ class ImportController extends AbstractController

private ?string $campaign;

private ?\DateTime $startDate;
private \DateTime $startDate;

public function __construct(
ExecutionRepository $executionRepository,
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/Execution.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public function getInsertionEndDate(): ?\DateTimeInterface
return $this->insertion_end_date;
}

public function setInsertionEndDate(\DateTimeInterface $insertion_end_date): static
public function setInsertionEndDate(?\DateTimeInterface $insertion_end_date): static
{
$this->insertion_end_date = $insertion_end_date;

Expand Down
4 changes: 2 additions & 2 deletions src/Repository/ExecutionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
* @extends ServiceEntityRepository<Execution>
*
* @method Execution|null find($id, $lockMode = null, $lockVersion = null)
* @method Execution|null findOneBy(array $criteria, array $orderBy = null)
* @method Execution|null findOneBy(array<string, mixed> $criteria, array<string, mixed> $orderBy = null)
* @method Execution[] findAll()
* @method Execution[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
* @method Execution[] findBy(array<string, mixed> $criteria, array<string, mixed> $orderBy = null, $limit = null, $offset = null)
*/
class ExecutionRepository extends ServiceEntityRepository
{
Expand Down
4 changes: 2 additions & 2 deletions src/Repository/SettingsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
* @extends ServiceEntityRepository<Settings>
*
* @method Settings|null find($id, $lockMode = null, $lockVersion = null)
* @method Settings|null findOneBy(array $criteria, array $orderBy = null)
* @method Settings|null findOneBy(array<string, mixed> $criteria, array<string, mixed> $orderBy = null)
* @method Settings[] findAll()
* @method Settings[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
* @method Settings[] findBy(array<string, mixed> $criteria, array<string, mixed> $orderBy = null, $limit = null, $offset = null)
*/
class SettingsRepository extends ServiceEntityRepository
{
Expand Down
4 changes: 2 additions & 2 deletions src/Repository/SuiteRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
* @extends ServiceEntityRepository<Suite>
*
* @method Suite|null find($id, $lockMode = null, $lockVersion = null)
* @method Suite|null findOneBy(array $criteria, array $orderBy = null)
* @method Suite|null findOneBy(array<string, mixed> $criteria, array<string, mixed> $orderBy = null)
* @method Suite[] findAll()
* @method Suite[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
* @method Suite[] findBy(array<string, mixed> $criteria, array<string, mixed> $orderBy = null, $limit = null, $offset = null)
*/
class SuiteRepository extends ServiceEntityRepository
{
Expand Down
4 changes: 2 additions & 2 deletions src/Repository/TestRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
* @extends ServiceEntityRepository<Test>
*
* @method Test|null find($id, $lockMode = null, $lockVersion = null)
* @method Test|null findOneBy(array $criteria, array $orderBy = null)
* @method Test|null findOneBy(array<string, mixed> $criteria, array<string, mixed> $orderBy = null)
* @method Test[] findAll()
* @method Test[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
* @method Test[] findBy(array<string, mixed> $criteria, array<string, mixed> $orderBy = null, $limit = null, $offset = null)
*/
class TestRepository extends ServiceEntityRepository
{
Expand Down
4 changes: 2 additions & 2 deletions src/Service/ReportSuiteBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function toArray(): array
}

/**
* @return array<string, string|array<string, string>>
* @return array<string, array<int|string, array<string, array<string, string>|string>|int>|int|string|null>
*/
private function formatSuite(Suite $suite): array
{
Expand Down Expand Up @@ -157,7 +157,7 @@ private function formatSuite(Suite $suite): array
}

/**
* @return array<string, string>
* @return array<string, int|string|null>
*/
private function formatTest(Test $test): array
{
Expand Down
12 changes: 7 additions & 5 deletions tests/Controller/ReportControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public function testReportID(int $reportId, array $campaigns): void
}

/**
* @return array<array<int>>
* @return array<int, list<int|list<string>>>
*/
public static function dataProviderReportID(): array
{
Expand Down Expand Up @@ -421,12 +421,10 @@ private function partialCompareTest(array $expected, array $actual): void
}

/**
* @param array<string, string> $item
* @param array<string, string|int> $item
*/
private function partialTestSuite(int $executionId, int $id, array $item, ?int $idParent = null, ?bool $hasChildrenData = null): void
{
$this->assertIsInt($id);

$this->assertArrayHasKey('id', $item);
$this->assertIsInt($item['id']);
$this->assertEquals($item['id'], $id);
Expand Down Expand Up @@ -465,15 +463,18 @@ private function partialTestSuite(int $executionId, int $id, array $item, ?int $

if ($item['hasSuites']) {
$this->assertArrayHasKey('suites', $item);
// @phpstan-ignore-next-line : https://github.com/phpstan/phpstan/issues/8438
$this->assertIsArray($item['suites']);
$this->assertGreaterThan(0, count($item['suites']));
foreach ($item['suites'] as $suiteChildId => $suiteChild) {
// @phpstan-ignore-next-line : https://github.com/phpstan/phpstan/issues/8438
$this->assertIsInt($suiteChildId);
$this->partialTestSuite($executionId, $suiteChildId, $suiteChild, $id);
}
}
if ($item['hasTests']) {
$this->assertArrayHasKey('tests', $item);
// @phpstan-ignore-next-line : https://github.com/phpstan/phpstan/issues/8438
$this->assertIsArray($item['tests']);
$this->assertGreaterThan(0, count($item['tests']));
foreach ($item['tests'] as $testItem) {
Expand All @@ -483,6 +484,7 @@ private function partialTestSuite(int $executionId, int $id, array $item, ?int $

if (is_bool($hasChildrenData) && $hasChildrenData) {
$this->assertArrayHasKey('childrenData', $item);
// @phpstan-ignore-next-line : https://github.com/phpstan/phpstan/issues/8438
$this->assertIsArray($item['childrenData']);
$this->assertArrayHasKey('totalPasses', $item['childrenData']);
$this->assertIsInt($item['childrenData']['totalPasses']);
Expand All @@ -502,7 +504,7 @@ private function partialTestSuite(int $executionId, int $id, array $item, ?int $
}

/**
* @param array<string, string> $test
* @param array<string, string|int> $test
*/
private function partialTestTest(int $suiteId, array $test): void
{
Expand Down

0 comments on commit fbf4790

Please sign in to comment.