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

Support strict types. #129

Open
glennpratt opened this issue Oct 25, 2017 · 0 comments
Open

Support strict types. #129

glennpratt opened this issue Oct 25, 2017 · 0 comments

Comments

@glennpratt
Copy link

glennpratt commented Oct 25, 2017

PHP projects I'm working on lately are adding:

declare(strict_types=1);

to the top of every file, but I don't know how or if it's possible to enable this in boris.

This isn't a huge issue assuming you test your code, but it's nice to have the same behavior for things I write in boris as the code I'm working on.

$ boris

[1] boris> declare(strict_types=1);
[2] boris> function foo(): int { return '123'; }
// NULL
[3] boris> foo();
// 123

$ php -r "declare(strict_types=1); function foo(): int { return '123'; }; foo();"

PHP Fatal error:  Uncaught TypeError: Return value of foo() must be of the type integer, string returned in Command line code:1
Stack trace:
#0 Command line code(1): foo()
#1 {main}
  thrown in Command line code on line 1
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

1 participant