Skip to content
This repository was archived by the owner on Nov 14, 2024. It is now read-only.
This repository was archived by the owner on Nov 14, 2024. It is now read-only.

Functions / methods with same name allowed without warnings. Method attributes not considered. #24

Description

@morpheouss

`<?php
class test {

    function __construct($q) {
            echo "Constructor $q";
    }

    function a($a) {
            echo 'A';
    }

}

$x = new test('test');
$x->a();

?>`

I have created the following code snippet, and it works as expected. However I am missing any warning message about missing parameter. Since it is not optional, as there is no default value assigned to it, I believe there should be at least some information about that mistake.
What is more, if I implement additional a($a, $b) function which takes two arguments, the same code will execute the first function with matching name. I think that best solution would be that $x->a() returning NULL instead of executing some method/function that does not match parameters number.

Same happens if there are several methods with the same name / same number of parameters.
Only first declared is working and there is no information about duplicate function name.

In addition I were able to launch protected & private method from outside of class they were implemented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions