With IDE's like Visual Studio Code there are PHP language server plugins like "PHP Intelephense" that offer IntelliSense and error checking for type hinting. The @return type in the getInstance() docblock indicates "bool|null" and all variables assigned to this return type will assume a 'bool' value.
Instantiating the variable:
$conn = \ToolkitService::getInstance($db, $userOrI5NamingFlag='0', $password='', $transportType='pdo');
Using the variable will highlight an error detected with varaible "$conn":
$conn->setOptions(['stateless'=>true]);
Error message:
Expected type 'object'. Found 'bool|null'.
Changing the @return type to "Toolkit" removes the error syntax highlighting from the IDE, and correctly interprets/inspects the functions that the variable uses.
With IDE's like Visual Studio Code there are PHP language server plugins like "PHP Intelephense" that offer IntelliSense and error checking for type hinting. The @return type in the getInstance() docblock indicates "bool|null" and all variables assigned to this return type will assume a 'bool' value.
Instantiating the variable: $conn = \ToolkitService::getInstance($db, $userOrI5NamingFlag='0', $password='', $transportType='pdo');
Using the variable will highlight an error detected with varaible "$conn": $conn->setOptions(['stateless'=>true]);
Error message: Expected type 'object'. Found 'bool|null'.
Changing the @return type to "Toolkit" removes the error syntax highlighting from the IDE, and correctly interprets/inspects the functions that the variable uses.