Skip to content

Commit 3b6c70d

Browse files
minor #47672 Leverage First-class callable syntax (tigitz)
This PR was merged into the 6.2 branch. Discussion ---------- Leverage First-class callable syntax | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | no | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | - | License | MIT | Doc PR | - ### Rationale https://wiki.php.net/rfc/first_class_callable_syntax Mainly: > The advantage is that the new syntax is accessible to static analysis, and respects the scope at the point where the callable is created. I'd argue that it also improves readability and IDE color syntax also helps: ![image](https://user-images.githubusercontent.com/1524501/191912084-7ee933c5-dda1-4176-86f1-cd6511c58aa4.png) I've manually reviewed each changes and discarded some of them where `[Foo::class, 'method']` was intended to be tested with this specific syntax Commits ------- 26d9ce9520 Leverage First-class callable syntax
2 parents 7f31d25 + d85146f commit 3b6c70d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Response/AmpResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ private static function select(ClientState $multi, float $timeout): int
207207
$timeout += microtime(true);
208208
self::$delay = Loop::defer(static function () use ($timeout) {
209209
if (0 < $timeout -= microtime(true)) {
210-
self::$delay = Loop::delay(ceil(1000 * $timeout), [Loop::class, 'stop']);
210+
self::$delay = Loop::delay(ceil(1000 * $timeout), Loop::stop(...));
211211
} else {
212212
Loop::stop();
213213
}
@@ -447,6 +447,6 @@ private static function stopLoop(): void
447447
self::$delay = null;
448448
}
449449

450-
Loop::defer([Loop::class, 'stop']);
450+
Loop::defer(Loop::stop(...));
451451
}
452452
}

0 commit comments

Comments
 (0)