FAQ
Edit report at https://pear.php.net/bugs/bug.php?id=19791&edit=1

ID: 19791
Updated by: gsherwood@squiz.net
Reported By: cweiske@php.net
Summary: "Useless method override" vs. changing of default
values
-Status: Open
+Status: Duplicate
Type: Bug
Package: PHP_CodeSniffer
Package Version: 1.4.3
PHP Version: Irrelevant
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:

-Status: Open
+Status: Duplicate
-Assigned To:
+Assigned To: squiz
This is a known issue that I don't know how to fix. See the discussion
on bug #19481


Previous Comments:
------------------------------------------------------------------------

[2013-01-16 13:57:55] cweiske

Description:
------------
When a method is overridden and changes the default values of
parameters, it still gets marked as "Useless method overriding
detected".


Test script:
---------------
<?php

class A
{
public function foo($var = 'A')
{
}
}

class B extends A
{
public function foo($var = 'Foo')
{
parent::foo($var);
}
}

?>

Expected result:
----------------
No "useless method overrideing detected" warning

Actual result:
--------------
12 | WARNING | Useless method overriding detected

------------------------------------------------------------------------

Search Discussions

  • Gsherwood at Jan 16, 2013 at 8:47 pm
    Edit report at https://pear.php.net/bugs/bug.php?id=19791&edit=1

    ID: 19791
    Updated by: gsherwood@squiz.net
    Reported By: cweiske@php.net
    Summary: "Useless method override" vs. changing of default
    values
    Status: Duplicate
    Type: Bug
    Package: PHP_CodeSniffer
    Package Version: 1.4.3
    PHP Version: Irrelevant
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    Forgot to say: it isn't the exact same issue, but it is the same general
    problem with
    detecting changes to method params across classes. A fix for one would
    solve the
    other.


    Previous Comments:
    ------------------------------------------------------------------------

    [2013-01-16 20:46:16] squiz

    -Status: Open
    +Status: Duplicate
    -Assigned To:
    +Assigned To: squiz
    This is a known issue that I don't know how to fix. See the discussion
    on bug #19481

    ------------------------------------------------------------------------

    [2013-01-16 13:57:55] cweiske

    Description:
    ------------
    When a method is overridden and changes the default values of
    parameters, it still gets marked as "Useless method overriding
    detected".


    Test script:
    ---------------
    <?php

    class A
    {
    public function foo($var = 'A')
    {
    }
    }

    class B extends A
    {
    public function foo($var = 'Foo')
    {
    parent::foo($var);
    }
    }

    ?>

    Expected result:
    ----------------
    No "useless method overrideing detected" warning

    Actual result:
    --------------
    12 | WARNING | Useless method overriding detected

    ------------------------------------------------------------------------

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJan 16, '13 at 8:46p
activeJan 16, '13 at 8:47p
posts2
users1
websitepear.php.net

1 user in discussion

Gsherwood: 2 posts

People

Translate

site design / logo © 2022 Grokbase