Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

[Bug] Trait & unused variable #244

Open
ddmler opened this issue Oct 12, 2016 · 5 comments
Open

[Bug] Trait & unused variable #244

ddmler opened this issue Oct 12, 2016 · 5 comments
Labels

Comments

@ddmler
Copy link
Collaborator

ddmler commented Oct 12, 2016

Warning: Unused variable $fqcnParts in method getMetadata() in ./src/Analyzer/Pass/Statement/ConstantNaming.php [unused-variable]
Warning: Unused variable $name in method getMetadata() in ./src/Analyzer/Pass/Statement/ConstantNaming.php [unused-variable]
Warning: Unused variable $description in method getMetadata() in ./src/Analyzer/Pass/Statement/ConstantNaming.php [unused-variable]

for every analyzer. But all of them are used in the trait method.

@ddmler ddmler added the bug label Oct 12, 2016
@ovr
Copy link
Owner

ovr commented Oct 12, 2016

This is caused because Trait method is merged into this Class
but anyway We cannot compile method in Trait because Trait's method can use another Class where it's used, recursion oops

Another moment $fqcnParts is not used because FunctionCall to end, didnt mark this argument is used, I am worry about FunctionCall, can you take a look?

@kilgaloon
Copy link
Contributor

kilgaloon commented Dec 6, 2016

Unused variable happens for me in class, variable is initialized and passed as argument to method of a class, im getting noticed that it is unused but clearly it is.

Also i noticed that all warning of unused variables are when variable is passed to method as argument.

@ovr
Copy link
Owner

ovr commented Dec 7, 2016

@kilgaloon This is caused only for static method call, I am going to fix it

@ovr
Copy link
Owner

ovr commented Dec 7, 2016

@kilgaloon

Fixed in master branch in 9bcb42c

Tested on

class Test
{
    /**
     * @return bool
     */
    public function returnTrue()
    {
        $a = '127.0.0.1';

        self::inet_pton($a);
    }

    /**
     * @param $test
     * @return int
     */
    public static function inet_pton($test)
    {
        return inet_pton($test);
    }
}

Can you try latest changes from master branch?

Thanks

@kilgaloon
Copy link
Contributor

kilgaloon commented Dec 7, 2016

I can confirm that this is working now, but another problem is happening right now. It is related with unused variables, i will create new issue about this. #280

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants