3 ms·
Objects are enforced and a simple declaration can make PHP enforce the scalars as well. https://3v4l.org/6UU2v https://3v4l.org/6UU2v https://3v4l.org/q1PAq htt
by chx 7y ago
Objects are enforced and a simple declaration can make PHP enforce the scalars as well. https://3v4l.org/6UU2v https://3v4l.org/6UU2v https://3v4l.org/q1PAq https://3v4l.org/q1PAq In PHP 7.4 due in a few weeks covariant return types / contravariant arguments will arrive. https://stitcher.io/blog/new-in-php-74#improved-type-variance-rfc https://stitcher.io/blog/new-in-php-74#improved-type-varianc...
- sedeki 7y agoIt seems as if declare(strict_types) works for scalars as well (first example)? However, if I remove that declare from your latter example, only one output is shown. Edit: Nevermind, I get it.