In php, what do the question marks mean in this function signature?
private static function getBooleanAnnotationSetting(string $className, ?string $methodName, string $settingName): ?bool {
}
In php, what do the question marks mean in this function signature?
private static function getBooleanAnnotationSetting(string $className, ?string $methodName, string $settingName): ?bool {
}
The question mark represents a nullable type:
Type declarations for parameters and return values can now be marked as nullable by prefixing the type name with a question mark. This signifies that as well as the specified type, NULL can be passed as an argument, or returned as a value, respectively.
This allows you to provision null
as an argument without receiving a TypeError
.