Closed jordisala1991 closed 2 years ago
There are a lot of deprecated code on 4.x that makes difficult to increase psalm there, wdyt on doing it directly for 5.x?
Not sure how to deal with:
ERROR: DocblockTypeContradiction - src/Block/BlockLoaderChain.php:52:13 - Docblock-defined type array<string, mixed> for $configuration is always array (see https://psalm.dev/155)
if (!\is_string($configuration) && !\is_array($configuration)) {
ERROR: DocblockTypeContradiction - src/Block/BlockLoaderChain.php:71:13 - Docblock-defined type array<string, mixed> for $configuration is always array (see https://psalm.dev/155)
if (!\is_string($configuration) && !\is_array($configuration)) {
ERROR: RedundantConditionGivenDocblockType - src/Block/BlockServiceManager.php:89:17 - Docblock-defined type Sonata\BlockBundle\Block\Service\BlockServiceInterface for $service is always object (see https://psalm.dev/156)
\is_object($service) ? \get_class($service) : \gettype($service)
ERROR: DocblockTypeContradiction - src/Block/BlockServiceManager.php:89:63 - Docblock-defined type Sonata\BlockBundle\Block\Service\BlockServiceInterface for $service is always object (see https://psalm.dev/155)
\is_object($service) ? \get_class($service) : \gettype($service)
ERROR: DocblockTypeContradiction - src/Block/Loader/ServiceLoader.php:47:13 - Docblock-defined type array<string, mixed> for $configuration is always array (see https://psalm.dev/155)
if (!\is_string($configuration) && !\is_array($configuration)) {
ERROR: DocblockTypeContradiction - src/Block/Loader/ServiceLoader.php:81:13 - Docblock-defined type array<string, mixed> for $configuration is always array (see https://psalm.dev/155)
if (!\is_string($configuration) && !\is_array($configuration)) {
Psalm is right, PHPDOC says we pass array or string and we are checking for it because its only phpdoc , no real typing. For PHPStan we enable the "Do not trust phpdoc" flag, but what should we do for Psalm?
Can you wait for my merge and NEXT_MAJOR cleanup? There might be more stuff to fix :see_no_evil:
Can you wait for my merge and NEXT_MAJOR cleanup? There might be more stuff to fix 🙈
Ofc I can wait, anyway think of it as an improvement to catch errors made during deprecation PRs, so getting an error on a cleanup PR might save time of bug fixing later
Everything is merged now. Can you rebase?
Subject
I am targeting this branch, because applying this to 5.x is easier due to deprecated code removed.