Skip to content

Commit

Permalink
[validator] add ConstraintViolationListInterface.stubphp (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
vudaltsov committed Oct 14, 2021
1 parent 0831a01 commit 6558660
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
@@ -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

0 comments on commit 6558660

Please sign in to comment.