zephir
zephir copied to clipboard
No warning or error when returning invalid response.
See below simplified Router class.
namespace Phalcon\Mvc;
class Router
{
protected action = null;
/**
* Returns the processed action name
*/
public function getActionName() -> string
{
return this->action;
}
}
This class will return null when getActionName() is called even when our return type specifies it as a string. I'm expecting a Fatal error: Uncaught TypeError. It would be nice if our static code analyser / compiler would detect that our member variable is incompatible.
Related - https://github.com/php/php-src/blob/4034d83432a9d4b1d3c8d334d382871e4146f664/Zend/tests/return_types/internal_functions001.phpt#L16