Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2c59be5

Browse filesBrowse files
committed
bug #17818 [Console] InvalidArgumentException is thrown under wrong condition (robinkanters)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #17818). Discussion ---------- [Console] InvalidArgumentException is thrown under wrong condition | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | N/A | License | MIT | Doc PR | no When an object is passed to `setAutocompleterValues` that implements `\Countable` and `\Traversable`, an `InvalidArgumentException` is thrown, even though its message says that the argument should implement both of those interfaces. Instead, the exception should be thrown if the parameter fails to implement either `\Countable` or `\Traversable`, like the exception message says. _Disclaimer: I've been looking at this line for 10min, and I've become convinced it should be changed according to my PR, but I could be wrong._ Commits ------- 8eea65e The exception should be thrown if an object doesn't implement Traversable AND doesn't implement Countable, not when it doesn't implement Traversable but DOES implement Countable
2 parents a515383 + 8eea65e commit 2c59be5
Copy full SHA for 2c59be5

File tree

Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed

‎src/Symfony/Component/Console/Question/Question.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Question/Question.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function setAutocompleterValues($values)
140140
}
141141

142142
if (null !== $values && !is_array($values)) {
143-
if (!$values instanceof \Traversable || $values instanceof \Countable) {
143+
if (!$values instanceof \Traversable || !$values instanceof \Countable) {
144144
throw new \InvalidArgumentException('Autocompleter values can be either an array, `null` or an object implementing both `Countable` and `Traversable` interfaces.');
145145
}
146146
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.