Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

felixele217's avatar

Strict Typing a Laravel App

Hey guys,

is there a way to globally strict type your Laravel apps. I was reading about writing

declare(strict_types=1);

in your php files but asked myself if there is a better way e.g. declaring it once and then it works globally for your whole project. Thanks in advance and greetings!

0 likes
2 replies
thinkverse's avatar

There is no way of enabling strict typing globally in PHP no, it's enabled per module, and does not leak to other modules. If you have strict types in file x and include that in file y then file y will not automatically have strict types.

Please or to participate in this conversation.