diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-01-18 14:41:27 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-01-18 14:41:53 +0100 |
commit | 496e4741a39365f948af8f239187417aca077fb0 (patch) | |
tree | e1a9ccfe99acaa2d358a350c78b4e6cf4dba8a3e /build | |
parent | 49e030d551472143d7f3ac47d8d710105d5db958 (diff) | |
download | php-git-496e4741a39365f948af8f239187417aca077fb0.tar.gz |
gen_stub: Compare phpdoc return type in --verify
Diffstat (limited to 'build')
-rwxr-xr-x | build/gen_stub.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/build/gen_stub.php b/build/gen_stub.php index c765102999..ee19f57a0c 100755 --- a/build/gen_stub.php +++ b/build/gen_stub.php @@ -1932,11 +1932,12 @@ if ($verify) { $aliasArgs, $aliasedArgs ); - if ((!$aliasedFunc->isMethod() || $aliasedFunc->isFinalMethod()) && - (!$aliasFunc->isMethod() || $aliasFunc->isFinalMethod()) && - $aliasFunc->return != $aliasedFunc->return - ) { - $errors[] = "{$aliasFunc->name}() and {$aliasedFunc->name}() must have the same return type"; + if (!$aliasedFunc->name->isConstructor() && !$aliasFunc->name->isConstructor()) { + $aliasedReturnType = $aliasedFunc->return->type ?? $aliasedFunc->return->phpDocType; + $aliasReturnType = $aliasFunc->return->type ?? $aliasFunc->return->phpDocType; + if ($aliasReturnType != $aliasedReturnType) { + $errors[] = "{$aliasFunc->name}() and {$aliasedFunc->name}() must have the same return type"; + } } } |