Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report incorrect types of return values and function arguments #516

Closed
hazzus opened this issue Jun 19, 2020 · 1 comment
Closed

Report incorrect types of return values and function arguments #516

hazzus opened this issue Jun 19, 2020 · 1 comment

Comments

@hazzus
Copy link

hazzus commented Jun 19, 2020

Code Example

function f() : int {
  return "hello";
}

function g(array $x) {}

g(1);

Actual Behavior

No warnings

Expected Behavior

Warning about return "hello", where "hello" doesn't match int return type of f
Warning about g(1), where 1 doesn't match array argument type of g

PHP7 actually fails stage of execution of such code with uncaught TypeError. But with some exceptions:

function u(string $x) {}

u(1)

It's executable without errors, but semantically may be not right

@i582
Copy link
Contributor

i582 commented Aug 28, 2021

Will be tracked further in #1123.

@i582 i582 closed this as completed Aug 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants