[validator] add ConstraintViolationListInterface.stubphp (#222)

This commit is contained in:
Valentin Udaltsov 2021-10-14 07:48:39 +03:00 committed by GitHub
parent 0831a0160c
commit 6558660423
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,10 @@
<?php
namespace Symfony\Component\Validator;
/**
* @extends \Traversable<int, ConstraintViolationInterface>
*/
interface ConstraintViolationListInterface extends \Traversable, \Countable, \ArrayAccess
{
}

View File

@ -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