8000 Merge pull request #130 from mixcom/2.x · reactphp/promise@8e41741 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8e41741

Browse files
authored
Merge pull request #130 from mixcom/2.x
Fix file_exists warning when resolving with long strings
2 parents f4edc25 + caaefe2 commit 8e41741

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/functions.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ function resolve($promiseOrValue = null)
88
return $promiseOrValue;
99
}
1010

11-
if (method_exists($promiseOrValue, 'then')) {
11+
// Check is_object() first to avoid method_exists() triggering
12+
// class autoloaders if $promiseOrValue is a string.
13+
if (is_object($promiseOrValue) && method_exists($promiseOrValue, 'then')) {
1214
$canceller = null;
1315

1416
if (method_exists($promiseOrValue, 'cancel')) {

0 commit comments

Comments
 (0)
0