Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[validator] add ConstraintViolationListInterface.stubphp (#222)
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
src/Stubs/common/Component/Validator/ConstraintViolationListInterface.stubphp
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\Validator; | ||
|
||
/** | ||
* @extends \Traversable<int, ConstraintViolationInterface> | ||
*/ | ||
interface ConstraintViolationListInterface extends \Traversable, \Countable, \ArrayAccess | ||
{ | ||
} |
28 changes: 28 additions & 0 deletions
28
tests/acceptance/acceptance/ConstraintViolationListInterface.feature
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
@symfony-common | ||
Feature: ConstraintViolationListInterface | ||
|
||
Background: | ||
Given I have Symfony plugin enabled | ||
|
||
Scenario: ConstraintViolationListInterface is a Traversable with int key and ConstraintViolationInterface value | ||
Given I have the following code | ||
""" | ||
<?php | ||
use Symfony\Component\Validator\ConstraintViolationListInterface; | ||
function run(ConstraintViolationListInterface $list): void | ||
{ | ||
foreach ($list as $key => $value) { | ||
/** @psalm-trace $key */ | ||
echo $key; | ||
/** @psalm-trace $value */ | ||
} | ||
} | ||
""" | ||
When I run Psalm | ||
Then I see these errors | ||
| Type | Message | | ||
| Trace | $key: int | | ||
| Trace | $value: Symfony\Component\Validator\ConstraintViolationInterface | | ||
And I see no other errors |