Skip to content

Upgrade to PHPStan 2.x#6855

Merged
javiereguiluz merged 1 commit intoEasyCorp:4.xfrom
javiereguiluz:phpstan_up
Mar 10, 2025
Merged

Upgrade to PHPStan 2.x#6855
javiereguiluz merged 1 commit intoEasyCorp:4.xfrom
javiereguiluz:phpstan_up

Conversation

@javiereguiluz
Copy link
Copy Markdown
Collaborator

@javiereguiluz javiereguiluz commented Mar 6, 2025

There are two issues that I can't fix, even with AI help:

https://github.com/EasyCorp/EasyAdminBundle/blob/4.x/src/Dto/EntityDto.php#L170-L171

 ------ ------------------------------------------------------------------------------------------------------------------------------------
  Line   Dto/EntityDto.php
 ------ ------------------------------------------------------------------------------------------------------------------------------------
  175    PHPDoc tag @var with type array|Doctrine\ORM\Mapping\FieldMapping is not subtype of native type Doctrine\ORM\Mapping\FieldMapping.
         🪪  varTag.nativeType
 ------ ------------------------------------------------------------------------------------------------------------------------------------

/** @var string|false $formattedCurrency */
$formattedCurrency = $formatter->formatCurrency($amount, $currency);

 ------ -----------------------------------------------------------------------
  Line   Intl/IntlFormatter.php
 ------ -----------------------------------------------------------------------
  112    PHPDoc tag @var with type string|false is not subtype of type string.
         🪪  varTag.type
 ------ -----------------------------------------------------------------------

@javiereguiluz javiereguiluz added this to the 4.x milestone Mar 6, 2025
@JorickPepin
Copy link
Copy Markdown
Contributor

Hello @javiereguiluz.

For the second case, I think you can simply remove the @var annotation as the false case is handled by the if just below.

For the first one, it seems to be related to the fact that with Doctrine ORM 3.x, $fieldMapping can only be of type FieldMapping but I don't know how to fix that.

@javiereguiluz javiereguiluz merged commit 68cdc0d into EasyCorp:4.x Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants