<?php
// Return type declaration,
// how does it work with nullable declaration
// and void / null / nothing returned ...
function return_null_or_void_1(): ?string {
return null;
}
function return_null_or_void_2(): ?string {
return;
}
function return_null_or_void_3(): ?string {
// return;
}
var_dump(return_null_or_void_1()).'<br>';
var_dump(return_null_or_void_2()).'<br>';
var_dump(return_null_or_void_3()).'<br>';
Fatal error: A function with return type must return a value (did you mean "return null;" instead of "return;"?) in /in/5NTvg on line 12
Process exited with code 255.
Output for 7.0.0 - 7.0.33
Parse error: syntax error, unexpected '?' in /in/5NTvg on line 7
Process exited with code 255.