-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Regarding this portion....
silverstripe-salsify/src/Traits/Yieldable.php
Lines 36 to 38 in 6068d6c
| if (is_callable($callback)) { | |
| $this->callback(); | |
| } |
...of this method...
silverstripe-salsify/src/Traits/Yieldable.php
Lines 17 to 39 in 6068d6c
| /** | |
| * @param array|iterable $list | |
| * @param callable|null $callback | |
| * @return \Generator | |
| */ | |
| public function yieldSingle($list, $callback = null) | |
| { | |
| if (!is_array($list) && !$list instanceof \Traversable) { | |
| $list = [$list]; | |
| } | |
| foreach ($list as $item) { | |
| $injected = (yield $item); | |
| if ($injected === static::$STOP_GENERATOR) { | |
| break; | |
| } | |
| } | |
| if (is_callable($callback)) { | |
| $this->callback(); | |
| } | |
| } |
We check to see if $callback is callable, but then we call $this->callback() instead of $callback().
Is this intentional? If so, shouldn't $callback just be boolean?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels