-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Chore] Fix phpstan issues #5786
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
asispts
commented
Jun 6, 2023
Both failed tests and linter issues are unrelated. |
It's merged now! Thanks! |
javiereguiluz
added a commit
that referenced
this pull request
Jun 22, 2023
This PR was squashed before being merged into the 4.x branch. Discussion ---------- [Chore] Fix phpstan issues This PR will fix several `PHPStan` issues: - [x] Fix `Cannot unset offset string on array<int, EasyCorp\Bundle\EasyAdminBundle\Dto\ActionDto>.` - [x] Fix `Variable method call on Twig\Extension\RuntimeExtensionInterface.` - [x] Refactor `EasyAdminTwigExtension::applyFilterIfExists` - [x] Add integration tests for `applyFilterIfExists`. Issues #3762 and #4808 have been taken into consideration. - [x] Update parameter type declaration of `Action::new`. We can't use ``@var`` to annotate a parameter. See: https://phpstan.org/r/7695e922-db7f-42b3-ac4f-8ff65a8a37b9 - [x] Modify incorrect PHPDoc. See: https://phpstan.org/r/df4eb1c2-7286-4aa7-b276-f36ff2c0c82c These issues are a little bit tricky. Both `TranslatableMessageBuilder::withParameters` and `TranslatableChoiceMessage::__toString` are not compatible with `TranslatableInterface`. Those functions should depend on `TranslatableMessage`. ```txt ------ ----------------------------------------------------------------------- Line Field/Configurator/ChoiceConfigurator.php ------ ----------------------------------------------------------------------- 124 Parameter #1 $message of class EasyCorp\Bundle\EasyAdminBundle\Translation\TranslatableChoiceMessage constructor expects Symfony\Component\Translation\TranslatableMessage, Symfony\Contracts\Translation\TranslatableInterface given. ------ ----------------------------------------------------------------------- ------ ----------------------------------------------------------------------- Line Translation/TranslatableMessageBuilder.php ------ ----------------------------------------------------------------------- 28 Call to an undefined method Symfony\Contracts\Translation\TranslatableInterface::getMessage(). 29 Call to an undefined method Symfony\Contracts\Translation\TranslatableInterface::getParameters(). 30 Call to an undefined method Symfony\Contracts\Translation\TranslatableInterface::getDomain(). ------ ----------------------------------------------------------------------- ``` Commits ------- 053f62c [Chore] Fix phpstan issues
I'm closing manually because the tool I use to merge PRs didn't close it. But, this PR is merged (see 2c52fb8) |
javiereguiluz
added a commit
that referenced
this pull request
Jun 23, 2023
This PR was squashed before being merged into the 4.x branch. Discussion ---------- Throw RuntimeError when unable to load twig filter Throw a `RuntimeError` as mentioned in #5786 (comment) Also, simplify function `applyFilterIfExists` and modify test cases. Commits ------- 5eb41cb Throw RuntimeError when unable to load twig filter
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR will fix several
PHPStan
issues:Cannot unset offset string on array<int, EasyCorp\Bundle\EasyAdminBundle\Dto\ActionDto>.
Variable method call on Twig\Extension\RuntimeExtensionInterface.
EasyAdminTwigExtension::applyFilterIfExists
applyFilterIfExists
. Issues imagine_filter causing problems when LiipImagineBundle is not enabled #3762 and imagine_filter fail when lazy mode is enabled #4808 have been taken into consideration.Action::new
. We can't use@var
to annotate a parameter. See: https://phpstan.org/r/7695e922-db7f-42b3-ac4f-8ff65a8a37b9These issues are a little bit tricky. Both
TranslatableMessageBuilder::withParameters
andTranslatableChoiceMessage::__toString
are not compatible withTranslatableInterface
. Those functions should depend onTranslatableMessage
.------ ----------------------------------------------------------------------- Line Field/Configurator/ChoiceConfigurator.php ------ ----------------------------------------------------------------------- 124 Parameter #1 $message of class EasyCorp\Bundle\EasyAdminBundle\Translation\TranslatableChoiceMessage constructor expects Symfony\Component\Translation\TranslatableMessage, Symfony\Contracts\Translation\TranslatableInterface given. ------ ----------------------------------------------------------------------- ------ ----------------------------------------------------------------------- Line Translation/TranslatableMessageBuilder.php ------ ----------------------------------------------------------------------- 28 Call to an undefined method Symfony\Contracts\Translation\TranslatableInterface::getMessage(). 29 Call to an undefined method Symfony\Contracts\Translation\TranslatableInterface::getParameters(). 30 Call to an undefined method Symfony\Contracts\Translation\TranslatableInterface::getDomain(). ------ -----------------------------------------------------------------------