Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UnusedLocalVariable to recognize compact function. #10

Merged
merged 1 commit into from Dec 14, 2012

Conversation

jrbasso
Copy link
Contributor

@jrbasso jrbasso commented Mar 16, 2012

The test case explain by itself.

@tariquesani
Copy link

Thanks - this is what I was looking for. Should be merged ASAP :-)

manuelpichler added a commit that referenced this pull request Sep 7, 2012
@ceeram
Copy link

ceeram commented Dec 14, 2012

+1 for this to be merged

manuelpichler added a commit that referenced this pull request Dec 14, 2012
Fix UnusedLocalVariable to recognize compact function.
@manuelpichler manuelpichler merged commit e478912 into phpmd:master Dec 14, 2012
@svscorp
Copy link
Contributor

svscorp commented Dec 27, 2012

Hello!

I've downloaded 1.4.1 version, after getting 'UnusedLocalVariable' message in my controller with using compact function. Run phpmd again, and I've got the same message :(

public function foo(){
$id = 1;
return $this->redirect($this->generateUrl('foo.php', compact('id')));
}

Doesn't work...

@ceeram
Copy link

ceeram commented Dec 27, 2012

@svscorp Strange that it doesnt work for you, with the 1.4.1 release all the warnings in cakephp core are gone for compact() and UnusedLocalVariable

@svscorp
Copy link
Contributor

svscorp commented Dec 28, 2012

@ceeram Yes, strange for me too. We use Symfony 2.1

@svscorp
Copy link
Contributor

svscorp commented Dec 28, 2012

Should I create a new ticket?

@rakeshtembhurne
Copy link

Via @svscorp:
In Symfony 2.1 $func->getImage() returns a string like "Acme/SomethingBundle/compact"
line no. 144, file src/main/php/PHP/PMD/Rule/UnusedLocalVariable.php, code if(strpos($func->getImage(),'compact'))

I am using CakePHP 2.2 and on my machine $func->getImage() returns string "__".

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

Successfully merging this pull request may close these issues.

None yet

7 participants