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

UnusedLocalVariable fix for compact handling in Symfony2 #61

Merged
merged 2 commits into from Jan 13, 2014

Conversation

svscorp
Copy link
Contributor

@svscorp svscorp commented Jan 7, 2013

This is a fix for my issue: #60

Here is a little bug. In Symfony 2.1 $func->getImage() returns a string like "Acme/SomethingBundle/compact"

So current code can't handle it. Because this string is not equals to 'compact'.

@beberlei
Copy link
Contributor

This is to broad, you have to check for

(substr($func->getName(), 1 + (strrpos($func->getName(), "\\") ?: -1)) === "compact"

@svscorp
Copy link
Contributor Author

svscorp commented Jan 22, 2013

Hi.

It returns FALSE in my case.

Even separately:
$var = "Acme/SomethingBundle/compact";
$a = (substr($var, 1 + (strrpos($var, "") ?: -1)) === "compact");

var_dump($a);

bool(false)

@svscorp
Copy link
Contributor Author

svscorp commented Dec 17, 2013

It is still exists... I have updated my phpmd and I getting violations in my Symfony2 project about unused local variables again :(

@svscorp
Copy link
Contributor Author

svscorp commented Dec 17, 2013

Please, review the latest PR

@thecodeassassin
Copy link

Please accept this PR @beberlei

manuelpichler pushed a commit that referenced this pull request Jan 13, 2014
UnusedLocalVariable fix for compact handling in Symfony2
@manuelpichler manuelpichler merged commit 64ed2a6 into phpmd:master Jan 13, 2014
@ghost ghost assigned manuelpichler Jan 13, 2014
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

4 participants