Skip to content

Commit 6558660

Browse files
authored
[validator] add ConstraintViolationListInterface.stubphp (#222)
1 parent 0831a01 commit 6558660

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Symfony\Component\Validator;
4+
5+
/**
6+
* @extends \Traversable<int, ConstraintViolationInterface>
7+
*/
8+
interface ConstraintViolationListInterface extends \Traversable, \Countable, \ArrayAccess
9+
{
10+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
@symfony-common
2+
Feature: ConstraintViolationListInterface
3+
4+
Background:
5+
Given I have Symfony plugin enabled
6+
7+
Scenario: ConstraintViolationListInterface is a Traversable with int key and ConstraintViolationInterface value
8+
Given I have the following code
9+
"""
10+
<?php
11+
12+
use Symfony\Component\Validator\ConstraintViolationListInterface;
13+
14+
function run(ConstraintViolationListInterface $list): void
15+
{
16+
foreach ($list as $key => $value) {
17+
/** @psalm-trace $key */
18+
echo $key;
19+
/** @psalm-trace $value */
20+
}
21+
}
22+
"""
23+
When I run Psalm
24+
Then I see these errors
25+
| Type | Message |
26+
| Trace | $key: int |
27+
| Trace | $value: Symfony\Component\Validator\ConstraintViolationInterface |
28+
And I see no other errors

0 commit comments

Comments
 (0)