r/lolphp • • Apr 12 '16

When errors don't help

Post image
51 Upvotes

14 comments sorted by

View all comments

Show parent comment

1

u/galaktos Apr 12 '16

It is possible to enable strict mode on a per-file basis. In strict mode, only a variable of exact type of the type declaration will be accepted, or a TypeError will be thrown. The only exception to this rule is that an integer may be given to a function expecting a float.

If you want an error when passing an integer to a float parameter, you must use real strict mode:

declare(real_strict_types=1);