Closed Girgias closed 3 years ago
thanx for the suggestion. Just rephrase that section, what do you think ? Is it any better ?
A couple of nits, it's not really an expected data type, as in coercive typing mode you can pass an integer to a string type declaration or an integer-string to an int
type declaration (well some caveats on the latter case).
Also technically you could use parameter types for array and class-types prior to PHP 7.
For void
"should not return" is incorrect, "does not return a value" is more correct (although PHP will always assign a return value to a function, but that's internal details and not an API indication), as never
(PHP 8.1) fills this niche for when a function does not return (by always throwing an exception, calling exit/die, or being an infinite loop)
Finally intersection types are missing from it, although that's PHP 8.1 only. :-)
Thanx for sharing !
Just found out about the strict mode : https://twitter.com/enunomaduro/status/1452568654420267008
I didn't know about those new 8.1 features. Feel free to make a PR as it will be out soon !
The PHP engine enforces the types at runtime, therefore they aren't merely just hints but actual type declarations.