diff --git a/composer.json b/composer.json index 317f815..42ea4d9 100644 --- a/composer.json +++ b/composer.json @@ -27,18 +27,18 @@ "require": { "php": "^7.2 || ^8", "composer/semver": "^1.4 || ^2.0 || ^3.0", - "vimeo/psalm": "^4.9", + "vimeo/psalm": "^4.28", "phpstan/phpdoc-parser": "~1.5.0" }, "conflict": { - "doctrine/collections": "<1.6", + "doctrine/collections": "<1.8", "doctrine/orm": "<2.6", "doctrine/persistence": "<2.0" }, "require-dev": { "codeception/codeception": "^4.0", "doctrine/coding-standard": "^9.0", - "doctrine/collections": "^1.0", + "doctrine/collections": "^1.8 || ^2.0", "doctrine/doctrine-bundle": "^1.11 || ^2.0", "doctrine/orm": "^2.6", "doctrine/persistence": "^2.0", diff --git a/src/Provider/ReturnTypeProvider/CollectionFirstAndLast.php b/src/Provider/ReturnTypeProvider/CollectionFirstAndLast.php index 9006f32..0e556e3 100644 --- a/src/Provider/ReturnTypeProvider/CollectionFirstAndLast.php +++ b/src/Provider/ReturnTypeProvider/CollectionFirstAndLast.php @@ -25,7 +25,10 @@ class CollectionFirstAndLast implements MethodReturnTypeProviderInterface */ public static function getClassLikeNames(): array { - return ['Doctrine\Common\Collections\Collection']; + return [ + 'Doctrine\Common\Collections\Collection', + 'Doctrine\Common\Collections\ReadableCollection', + ]; } public static function getMethodReturnType(MethodReturnTypeProviderEvent $event): ?Type\Union @@ -50,16 +53,18 @@ public static function getMethodReturnType(MethodReturnTypeProviderEvent $event) $varParts[] = $varStmt->name; $scopedVarName = '$' . implode('->', array_reverse($varParts)) . '->isempty()'; - if ($event->getMethodNameLowercase() === 'add') { - $event->getContext()->vars_in_scope[$scopedVarName] = Type::getFalse(); + if ($event->getFqClasslikeName() === 'Doctrine\Common\Collections\Collection') { + if ($event->getMethodNameLowercase() === 'add') { + $event->getContext()->vars_in_scope[$scopedVarName] = Type::getFalse(); - return null; - } + return null; + } - if ($event->getMethodNameLowercase() === 'remove' || $event->getMethodNameLowercase() === 'removeelement') { - $event->getContext()->remove($scopedVarName); + if ($event->getMethodNameLowercase() === 'remove' || $event->getMethodNameLowercase() === 'removeelement') { + $event->getContext()->remove($scopedVarName); - return null; + return null; + } } if ( diff --git a/stubs/Collections.phpstub b/stubs/Collections.phpstub index 165465d..ef2192d 100644 --- a/stubs/Collections.phpstub +++ b/stubs/Collections.phpstub @@ -11,10 +11,10 @@ use ArrayAccess; * @template TKey as array-key * @template TValue * - * @template-extends IteratorAggregate + * @template-extends ReadableCollection * @template-extends ArrayAccess */ -interface Collection extends Countable, IteratorAggregate, ArrayAccess +interface Collection extends ReadableCollection, ArrayAccess { /** @@ -36,28 +36,57 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess public function clear(); /** - * @param TValue $element - * @return bool + * @param TKey $key + * @return TValue|null */ - public function contains($element); + public function remove($key); /** + * @param TValue $element * @return bool - * @psalm-mutation-free */ - public function isEmpty(); + public function removeElement($element); /** * @param TKey $key - * @return TValue|null + * @param TValue $value + * @return void */ - public function remove($key); + public function set($key, $value); + + /** + * @param Closure(TValue=):bool $p + * @return Collection + */ + public function filter(Closure $p); + + /** + * @param Closure(TKey=,TValue=):bool $p + * @return array{0:Collection,1:Collection} + */ + public function partition(Closure $p); +} + +/** + * @template TKey as array-key + * @template-covariant TValue + * + * @template-extends IteratorAggregate + */ +interface ReadableCollection extends Countable, IteratorAggregate +{ /** * @param TValue $element * @return bool */ - public function removeElement($element); + public function contains($element); + + /** + * @return bool + * @psalm-mutation-free + */ + public function isEmpty(); /** * @param TKey $key @@ -81,13 +110,6 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess */ public function getValues(); - /** - * @param TKey $key - * @param TValue $value - * @return void - */ - public function set($key, $value); - /** * @return array */ @@ -118,6 +140,13 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess */ public function next(); + /** + * @param int $offset + * @param int|null $length + * @return array + */ + public function slice($offset, $length = null); + /** * @param Closure(TKey=,TValue=):bool $p * @return bool @@ -126,16 +155,10 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess /** * @param Closure(TValue=):bool $p - * @return Collection + * @return ReadableCollection */ public function filter(Closure $p); - /** - * @param Closure(TKey=,TValue=):bool $p - * @return bool - */ - public function forAll(Closure $p); - /** * @template T * @param Closure(TValue=):T $func @@ -145,22 +168,21 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess /** * @param Closure(TKey=,TValue=):bool $p - * @return array{0:Collection,1:Collection} + * @return array{0:ReadableCollection,1:ReadableCollection} */ public function partition(Closure $p); /** - * @param TValue $element - * @return false|TKey + * @param Closure(TKey=,TValue=):bool $p + * @return bool */ - public function indexOf($element); + public function forAll(Closure $p); /** - * @param int $offset - * @param int|null $length - * @return array + * @param TValue $element + * @return false|TKey */ - public function slice($offset, $length = null); + public function indexOf($element); } /** diff --git a/tests/acceptance/Collections.feature b/tests/acceptance/Collections.feature index 7ecf92a..02a38fe 100644 --- a/tests/acceptance/Collections.feature +++ b/tests/acceptance/Collections.feature @@ -9,6 +9,7 @@ Feature: Collections """ provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but list provided | And I see no other errors @Collection::getValues @@ -222,8 +223,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, list provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but list provided | And I see no other errors @Collection::set @@ -236,8 +237,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of Doctrine\Common\Collections\Collection::set expects int, "string key" provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of Doctrine\Common\Collections\Collection::set expects int, but "string key" provided | And I see no other errors @Collection::set @@ -250,8 +251,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 2 of Doctrine\Common\Collections\Collection::set expects string, 1 provided | + | Type | Message | + | InvalidScalarArgument | Argument 2 of Doctrine\Common\Collections\Collection::set expects string, but 1 provided | And I see no other errors @Collection::toArray @@ -264,8 +265,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, array provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but array provided | And I see no other errors @Collection::first @@ -278,8 +279,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of atan expects float, false\|string provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of atan expects float, but false\|string provided | And I see no other errors @Collection::first @@ -294,8 +295,24 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of atan expects float, string provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of atan expects float, but string provided | + And I see no other errors + + @Collection::first + Scenario: Getting first item of a non empty readable collection + Given I have the following code + """ + /** @var ReadableCollection */ + $c = new ArrayCollection(["a", "b", "c"]); + if (!$c->isEmpty()) { + atan($c->first()); + } + """ + When I run Psalm + Then I see these errors + | Type | Message | + | InvalidScalarArgument | Argument 1 of atan expects float, but string provided | And I see no other errors @Collection::first @@ -311,8 +328,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of atan expects float, string provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of atan expects float, but string provided | And I see no other errors @Collection::first @@ -326,8 +343,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of atan expects float, string provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of atan expects float, but string provided | And I see no other errors @Collection::last @@ -340,8 +357,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of atan expects float, false\|string provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of atan expects float, but false\|string provided | And I see no other errors @Collection::last @@ -356,8 +373,24 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of atan expects float, string provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of atan expects float, but string provided | + And I see no other errors + + @Collection::last + Scenario: Getting last item of a non empty readable collection + Given I have the following code + """ + /** @var ReadableCollection */ + $c = new ArrayCollection(["a", "b", "c"]); + if (!$c->isEmpty()) { + atan($c->last()); + } + """ + When I run Psalm + Then I see these errors + | Type | Message | + | InvalidScalarArgument | Argument 1 of atan expects float, but string provided | And I see no other errors @Collection::key @@ -370,8 +403,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of strlen expects string, int\|null provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of strlen expects string, but int\|null provided | And I see no other errors @Collection::current @@ -384,8 +417,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of atan expects float, false\|string provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of atan expects float, but false\|string provided | And I see no other errors @Collection::next @@ -398,8 +431,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of atan expects float, false\|string provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of atan expects float, but false\|string provided | And I see no other errors @Collection::exists @@ -412,8 +445,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::exists expects Closure\(int=, string=\):bool, (impure-)?Closure\(int, int\):bool provided\|Type (int\|string) should be a subtype of (int\|string)/ | + | Type | Message | + | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::exists expects Closure\(int=, string=\):bool, but (impure-)?Closure\(int, int\):bool provided\|Type (int\|string) should be a subtype of (int\|string)/ | And I see no other errors @Collection::exists @@ -426,8 +459,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::exists expects Closure\(int=, string=\):bool, (impure-)?Closure\(int, string\):int(<0, 1>)? provided/ | + | Type | Message | + | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::exists expects Closure\(int=, string=\):bool, but (impure-)?Closure\(int, string\):int(<0, 1>)? provided/ | And I see no other errors @Collection::exists @@ -462,8 +495,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, Doctrine\Common\Collections\Collection provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but Doctrine\Common\Collections\Collection provided | And I see no other errors @Collection::filter @@ -476,8 +509,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::filter expects Closure\(string=\):bool, (impure-)?Closure\(int\):bool provided\|Type (int\|string) should be a subtype of (int\|string)/ | + | Type | Message | + | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::filter expects Closure\(string=\):bool, but (impure-)?Closure\(int\):bool provided\|Type (int\|string) should be a subtype of (int\|string)/ | And I see no other errors @Collection::filter @@ -490,8 +523,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::filter expects Closure\(string=\):bool, (impure-)?Closure\(string\):int(<0, 1>)? provided/ | + | Type | Message | + | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::filter expects Closure\(string=\):bool, but (impure-)?Closure\(string\):int(<0, 1>)? provided/ | And I see no other errors # TODO: find out if this is applicable @@ -528,8 +561,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::forAll expects Closure\(int=, string=\):bool, (impure-)?Closure\(string, string\):bool provided\|Type (int\|string) should be a subtype of (int\|string)/ | + | Type | Message | + | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::forAll expects Closure\(int=, string=\):bool, but (impure-)?Closure\(string, string\):bool provided\|Type (int\|string) should be a subtype of (int\|string)/ | And I see no other errors @Collection::forAll @@ -542,8 +575,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::forAll expects Closure\(int=, string=\):bool, (impure-)?Closure\(int, int\):bool provided\|Type (int\|string) should be a subtype of (int\|string)/ | + | Type | Message | + | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::forAll expects Closure\(int=, string=\):bool, but (impure-)?Closure\(int, int\):bool provided\|Type (int\|string) should be a subtype of (int\|string)/ | And I see no other errors @Collection::forAll @@ -556,8 +589,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::forAll expects Closure\(int=, string=\):bool, (impure-)?Closure\(int, string\):int(<0, 1>)? provided/ | + | Type | Message | + | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::forAll expects Closure\(int=, string=\):bool, but (impure-)?Closure\(int, string\):int(<0, 1>)? provided/ | And I see no other errors @Collection::forAll @@ -592,8 +625,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, Doctrine\Common\Collections\Collection provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but Doctrine\Common\Collections\Collection provided | And I see no other errors @Collection::map @@ -606,8 +639,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::map expects Closure\(string=\):mixed, (impure-)?Closure\(int\):bool provided\|Type (int\|string) should be a subtype of (int\|string)/ | + | Type | Message | + | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::map expects Closure\(string=\):mixed, but (impure-)?Closure\(int\):bool provided\|Type (int\|string) should be a subtype of (int\|string)/ | And I see no other errors @Collection::map @@ -631,8 +664,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, array{0: Doctrine\Common\Collections\Collection, 1: Doctrine\Common\Collections\Collection} provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but array{0: Doctrine\Common\Collections\Collection, 1: Doctrine\Common\Collections\Collection} provided | And I see no other errors @Collection::partition @@ -645,8 +678,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::partition expects Closure\(int=, string=\):bool, (impure-)?Closure\(string\):bool provided\|Type (int\|string) should be a subtype of (int\|string)/ | + | Type | Message | + | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::partition expects Closure\(int=, string=\):bool, but (impure-)?Closure\(string\):bool provided\|Type (int\|string) should be a subtype of (int\|string)/ | And I see no other errors @Collection::partition @@ -659,8 +692,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::partition expects Closure\(int=, string=\):bool, (impure-)?Closure\(int\):int(<0, 1>)? provided/ | + | Type | Message | + | InvalidScalarArgument | /Argument 1 of Doctrine\\Common\\Collections\\Collection::partition expects Closure\(int=, string=\):bool, but (impure-)?Closure\(int\):int(<0, 1>)? provided/ | And I see no other errors @Collection::partition @@ -684,8 +717,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of Doctrine\Common\Collections\Collection::indexOf expects string, 1 provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of Doctrine\Common\Collections\Collection::indexOf expects string, but 1 provided | And I see no other errors @Collection::indexOf @@ -698,8 +731,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of strlen expects string, false\|int provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of strlen expects string, but false\|int provided | And I see no other errors @Collection::slice @@ -712,8 +745,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of Doctrine\Common\Collections\Collection::slice expects int, "string key" provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of Doctrine\Common\Collections\Collection::slice expects int, but "string key" provided | And I see no other errors @Collection::slice @@ -726,8 +759,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 2 of Doctrine\Common\Collections\Collection::slice expects int\|null, "zzzz" provided | + | Type | Message | + | InvalidScalarArgument | Argument 2 of Doctrine\Common\Collections\Collection::slice expects int\|null, but "zzzz" provided | And I see no other errors @Collection::slice @@ -743,9 +776,9 @@ Feature: Collections When I run Psalm Then I see these errors | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, array provided | - | InvalidArgument | Argument 1 of atan expects float, array provided | - | InvalidArgument | Argument 1 of atan expects float, array provided | + | InvalidArgument | Argument 1 of atan expects float, but array provided | + | InvalidArgument | Argument 1 of atan expects float, but array provided | + | InvalidArgument | Argument 1 of atan expects float, but array provided | And I see no other errors @Collections::ArrayAccess @@ -791,8 +824,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 2 of Doctrine\Common\Collections\Collection::offsetSet expects string, float(1.1) provided | + | Type | Message | + | InvalidScalarArgument | Argument 2 of Doctrine\Common\Collections\Collection::offsetSet expects string, but float(1.1) provided | And I see no other errors @Collections::ArrayAccess @@ -805,8 +838,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 2 of Doctrine\Common\Collections\Collection::offsetSet expects string, float(1.1) provided | + | Type | Message | + | InvalidScalarArgument | Argument 2 of Doctrine\Common\Collections\Collection::offsetSet expects string, but float(1.1) provided | And I see no other errors @Collections::ArrayAccess @@ -819,8 +852,8 @@ Feature: Collections """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of Doctrine\Common\Collections\Collection::offsetSet expects int\|null, "10" provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of Doctrine\Common\Collections\Collection::offsetSet expects int\|null, but "10" provided | And I see no other errors @Collections::ArrayCollection diff --git a/tests/acceptance/EntityManager.feature b/tests/acceptance/EntityManager.feature index 4d64fcb..b243882 100644 --- a/tests/acceptance/EntityManager.feature +++ b/tests/acceptance/EntityManager.feature @@ -31,8 +31,8 @@ Feature: EntityManager """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, Doctrine\ORM\EntityRepository provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but Doctrine\ORM\EntityRepository provided | And I see no other errors @EntityManager::getRepository @@ -43,8 +43,8 @@ Feature: EntityManager """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of Doctrine\ORM\EntityManager::getRepository expects class-string, 123 provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of Doctrine\ORM\EntityManager::getRepository expects class-string, but 123 provided | And I see no other errors @EntityManager::find @@ -55,8 +55,8 @@ Feature: EntityManager """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, I\|null provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but I\|null provided | And I see no other errors @EntityManager::find @@ -67,8 +67,8 @@ Feature: EntityManager """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of Doctrine\ORM\EntityManager::find expects class-string, 123 provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of Doctrine\ORM\EntityManager::find expects class-string, but 123 provided | And I see no other errors @EntityManager::getReference @@ -79,8 +79,8 @@ Feature: EntityManager """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, I\|null provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but I\|null provided | And I see no other errors @EntityManager::getReference @@ -91,8 +91,8 @@ Feature: EntityManager """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of Doctrine\ORM\EntityManager::getReference expects class-string, 123 provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of Doctrine\ORM\EntityManager::getReference expects class-string, but 123 provided | And I see no other errors @EntityManager::inheritance diff --git a/tests/acceptance/EntityManagerInterface.feature b/tests/acceptance/EntityManagerInterface.feature index f73e600..b4d4a2e 100644 --- a/tests/acceptance/EntityManagerInterface.feature +++ b/tests/acceptance/EntityManagerInterface.feature @@ -27,8 +27,8 @@ Feature: EntityManagerInterface """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, Doctrine\ORM\EntityRepository provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but Doctrine\ORM\EntityRepository provided | And I see no other errors @EntityManagerInterface::getRepository @@ -41,8 +41,8 @@ Feature: EntityManagerInterface """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of Doctrine\ORM\EntityManagerInterface::getRepository expects class-string, 123 provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of Doctrine\ORM\EntityManagerInterface::getRepository expects class-string, but 123 provided | And I see no other errors @EntityManagerInterface::find @@ -55,8 +55,8 @@ Feature: EntityManagerInterface """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, I\|null provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but I\|null provided | And I see no other errors @EntityManagerInterface::find @@ -69,8 +69,8 @@ Feature: EntityManagerInterface """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of Doctrine\ORM\EntityManagerInterface::find expects class-string, 123 provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of Doctrine\ORM\EntityManagerInterface::find expects class-string, but 123 provided | And I see no other errors @EntityManagerInterface::getReference @@ -83,8 +83,8 @@ Feature: EntityManagerInterface """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, I\|null provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but I\|null provided | And I see no other errors @EntityManagerInterface::getReference @@ -97,6 +97,6 @@ Feature: EntityManagerInterface """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of Doctrine\ORM\EntityManagerInterface::getReference expects class-string, 123 provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of Doctrine\ORM\EntityManagerInterface::getReference expects class-string, but 123 provided | And I see no other errors diff --git a/tests/acceptance/EntityRepository.feature b/tests/acceptance/EntityRepository.feature index 8b5d772..abc87bc 100644 --- a/tests/acceptance/EntityRepository.feature +++ b/tests/acceptance/EntityRepository.feature @@ -34,8 +34,8 @@ Feature: EntityRepository """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, I\|null provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but I\|null provided | And I see no other errors @EntityRepository::findAll @@ -46,8 +46,8 @@ Feature: EntityRepository """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, list provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but list provided | And I see no other errors @EntityRepository::findBy @@ -58,8 +58,8 @@ Feature: EntityRepository """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, list provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but list provided | And I see no other errors @EntityRepository::findOneBy @@ -70,8 +70,8 @@ Feature: EntityRepository """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, I\|null provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but I\|null provided | And I see no other errors @EntityRepository::matching diff --git a/tests/acceptance/ObjectManager.feature b/tests/acceptance/ObjectManager.feature index 40e0f7f..ea73740 100644 --- a/tests/acceptance/ObjectManager.feature +++ b/tests/acceptance/ObjectManager.feature @@ -30,8 +30,8 @@ Feature: ObjectManager """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, Doctrine\Persistence\ObjectRepository provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but Doctrine\Persistence\ObjectRepository provided | @ObjectManager::getRepository Scenario: Calling getRepository with a wrong argument type @@ -41,8 +41,8 @@ Feature: ObjectManager """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of Doctrine\Persistence\ObjectManager::getRepository expects class-string, 123 provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of Doctrine\Persistence\ObjectManager::getRepository expects class-string, but 123 provided | @ObjectManager::getClassMetadata Scenario: Calling getClassMetadata with a class-string argument @@ -52,8 +52,8 @@ Feature: ObjectManager """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, Doctrine\Persistence\Mapping\ClassMetadata provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but Doctrine\Persistence\Mapping\ClassMetadata provided | @ObjectManager::getClassMetadata Scenario: Calling getClassMetadata with a wrong argument type @@ -63,8 +63,8 @@ Feature: ObjectManager """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of Doctrine\Persistence\ObjectManager::getClassMetadata expects class-string, 123 provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of Doctrine\Persistence\ObjectManager::getClassMetadata expects class-string, but 123 provided | @ObjectManager::find Scenario: Calling find with a class-string argument @@ -74,8 +74,8 @@ Feature: ObjectManager """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, I\|null provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but I\|null provided | @ObjectManager::find Scenario: Calling find with a wrong argument type @@ -85,5 +85,5 @@ Feature: ObjectManager """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of Doctrine\Persistence\ObjectManager::find expects class-string, 123 provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of Doctrine\Persistence\ObjectManager::find expects class-string, but 123 provided | diff --git a/tests/acceptance/Paginator.feature b/tests/acceptance/Paginator.feature index cf85a43..6a13cff 100644 --- a/tests/acceptance/Paginator.feature +++ b/tests/acceptance/Paginator.feature @@ -44,6 +44,6 @@ Feature: Paginator """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidArgument | Argument 1 of atan expects float, I provided | + | Type | Message | + | InvalidArgument | Argument 1 of atan expects float, but I provided | And I see no other errors diff --git a/tests/acceptance/QueryBuilder.feature b/tests/acceptance/QueryBuilder.feature index e374699..44a06f6 100644 --- a/tests/acceptance/QueryBuilder.feature +++ b/tests/acceptance/QueryBuilder.feature @@ -93,8 +93,8 @@ Feature: QueryBuilder """ When I run Psalm Then I see these errors - | Type | Message | - | ImplicitToStringCast | Argument 1 of Doctrine\ORM\QueryBuilder::select expects Doctrine\ORM\Query\Expr\Func\|array\|null\|string, Doctrine\ORM\Query\Expr\Andx provided with a __toString method | + | Type | Message | + | ImplicitToStringCast | Argument 1 of Doctrine\ORM\QueryBuilder::select expects Doctrine\ORM\Query\Expr\Func\|array\|null\|string, but Doctrine\ORM\Query\Expr\Andx provided with a __toString method | @QueryBuilder Scenario: QueryBuilder::select() rejects wrong non-stringable arguments @@ -104,8 +104,8 @@ Feature: QueryBuilder """ When I run Psalm Then I see these errors - | Type | Message | - | InvalidScalarArgument | Argument 1 of Doctrine\ORM\QueryBuilder::select expects Doctrine\ORM\Query\Expr\Func\|array\|null\|string, float(2.2) provided | + | Type | Message | + | InvalidScalarArgument | Argument 1 of Doctrine\ORM\QueryBuilder::select expects Doctrine\ORM\Query\Expr\Func\|array\|null\|string, but float(2.2) provided | @QueryBuilder Scenario: QueryBuilder ::where(), ::orWhere() and ::andWhere accept Expr\Comparison