mirror of
https://github.com/danog/psalm-plugin-symfony.git
synced 2024-11-26 20:04:58 +01:00
[validator] add ConstraintViolationListInterface.stubphp (#222)
This commit is contained in:
parent
0831a0160c
commit
6558660423
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\Validator;
|
||||
|
||||
/**
|
||||
* @extends \Traversable<int, ConstraintViolationInterface>
|
||||
*/
|
||||
interface ConstraintViolationListInterface extends \Traversable, \Countable, \ArrayAccess
|
||||
{
|
||||
}
|
@ -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
|
Loading…
Reference in New Issue
Block a user