Skip to content

No warning or error when returning invalid response. #1991

@ruudboon

Description

@ruudboon

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions