Skip to content

Support strict types. #129

Description

@glennpratt

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions