Type Hinting No ReturnVoid

suggest change

In PHP 7.1, the void return type was added. While PHP has no actual void value, it is generally understood across programming languages that a function that returns nothing is returning void. This should not be confused with returning null, as null is a value that can be returned.

function lacks_return(): void {
    // valid
}

Note that if you declare a void return, you cannot return any values or you will get a fatal error:

function should_return_nothing(): void {
    return null; // Fatal error: A void function must not return a value
}

However, using return to exit the function is valid:

function returns_nothing(): void {
    return; // valid
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Type hinting:
* Type Hinting No ReturnVoid

Table Of Contents
2 Arrays
4 Types
10 Cookies
14 JSON
15 SOAP
17 cURL
19 XML
21 Traits
29 Type hinting
35 UTF-8
36 URLs
38 PHPDoc
41 Loops
44 Closur
72 YAML
77 Cache
78 Streams
81 PDO
82 SQLite3
83 Sockets
87 MongoDB
93 IMAP
94 Redis
95 Imagick
102 APCu
108 PSR