Skip to content

Commit 59330eb

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: [Security] Fix token user usage in SwitchUserListenerTest [Security] PassportInterface deprecations fixes [Security] Remove faulty legacy mark from SwitchUserListenerTest [Yaml] Add an --exclude option to lint:yaml command * Deprecated calling `FormErrorIterator::children()` if the current element is not iterable
2 parents b0d1664 + 4139a0c commit 59330eb

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ CHANGELOG
2121
5.4
2222
---
2323

24+
* Deprecate calling `FormErrorIterator::children()` if the current element is not iterable.
2425
* Allow to pass `TranslatableMessage` objects to the `help` option
2526

2627
5.3

FormErrorIterator.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Form\Exception\BadMethodCallException;
1515
use Symfony\Component\Form\Exception\InvalidArgumentException;
16+
use Symfony\Component\Form\Exception\LogicException;
1617
use Symfony\Component\Form\Exception\OutOfBoundsException;
1718
use Symfony\Component\Validator\ConstraintViolation;
1819

@@ -186,11 +187,13 @@ public function hasChildren(): bool
186187
return current($this->errors) instanceof self;
187188
}
188189

189-
/**
190-
* Alias of {@link current()}.
191-
*/
192190
public function getChildren(): self
193191
{
192+
if (!$this->hasChildren()) {
193+
trigger_deprecation('symfony/form', '5.4', 'Calling "%s()" if the current element is not iterable is deprecated, call "%s" to get the current element.', __METHOD__, self::class.'::current()');
194+
// throw new LogicException(sprintf('The current element is not iterable. Use "%s" to get the current element.', self::class.'::current()'));
195+
}
196+
194197
return current($this->errors);
195198
}
196199

0 commit comments

Comments
 (0)