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

Development Code Fragment feature is not working #345

Open
chrisyue opened this Issue Feb 5, 2016 · 12 comments

Comments

Projects
None yet
7 participants
@chrisyue

chrisyue commented Feb 5, 2016

$ phpmd --version
PHPMD 2.3.2

$ phpmd path/to/File.php text design

the exit code is 0, but the File.php does contain var_dump and print_r

and the other features in design are working i think (I only test checking die/exit, goto, eval)

@ravage84 ravage84 added the Bug label Feb 5, 2016

@ravage84 ravage84 added this to the 2.3.3 milestone Feb 5, 2016

@ravage84 ravage84 modified the milestones: 2.3.3, 2.4.2 Mar 8, 2016

@manuelpichler manuelpichler modified the milestones: 2.4.2, 2.4.3 Mar 10, 2016

@manuelpichler

This comment has been minimized.

Member

manuelpichler commented Mar 10, 2016

Can you please provide a reproducable file for this issue

@chrisyue

This comment has been minimized.

chrisyue commented Mar 21, 2016

@manuelpichler here is the file content:

<?php

namespace AppBundle\Controller\Front;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

/**
 * @Route("/hotsale")
 */
class HotSaleController extends Controller
{
    /**
     * @Route("/", name="front_hotsale_index", methods={"GET"})
     */
    public function indexAction(Request $request)
    {
        $hotsales = $this->getDoctrine()->getRepository('AppBundle:HotSale')
            ->createQueryBuilder('h')
            ->select('h, v')
            ->join('h.video', 'v')
            ->orderBy('h.sequence')
            ->getQuery()
            ->getResult();

        var_dump($hotsales);

        $banners = $this->get('app.banner.file_manager')->findAll();

        return $this->render('front/hotsale/index.html.twig', compact('hotsales', 'banners'));
    }
}

and I also found it maybe related to the namespace, because it can work after I remove the line of namespace declaration.

@chrisyue

This comment has been minimized.

chrisyue commented Mar 22, 2016

Maybe PHPMD thinks var_dump is AppBundle\Controller\Front\var_dump?

@ravage84

This comment has been minimized.

Member

ravage84 commented Mar 22, 2016

@chrisyue can you reduce the example to the following and still confirm the issue?

<?php

namespace AppBundle\Controller\Front;

class Foo
{
    public function testFoo()
    {
        var_dump($hotsales = '');
    }
}
@chrisyue

This comment has been minimized.

chrisyue commented Mar 23, 2016

@ravage84 same issue, won't work until I remove namespace.

And it is also strange that it shows the message The method Foo::testFoo() calls the typical debug function var_dump() which is mostly only used during development. twice, it should show only once? Maybe it's another issue, I don't know..

@ravage84 ravage84 added the PDepend label Mar 25, 2016

@ravage84 ravage84 modified the milestones: 2.4.3, 2.4.4 Apr 25, 2016

@torkiljohnsen

This comment has been minimized.

torkiljohnsen commented Jun 30, 2016

I can confirm this issue.

@manuelpichler

This comment has been minimized.

Member

manuelpichler commented Jan 20, 2017

Works in the latest version that will be release today.

@chilion

This comment has been minimized.

chilion commented Mar 14, 2017

Any clue when this will be fixed? Our builds are not failing while they should now :octocat:

@ravage84

This comment has been minimized.

Member

ravage84 commented Mar 14, 2017

@chilion have you updated PHPMD and PDepend to the newest version? With which version of these tools are you seeing this issue, still?

@chilion

This comment has been minimized.

chilion commented Mar 14, 2017

@ravage84 phpmd version 2.6.0 && pdepend version 2.5.0

@qkdreyer

This comment has been minimized.

qkdreyer commented Dec 5, 2017

Still an issue for me :

image

@stepansib

This comment has been minimized.

stepansib commented May 7, 2018

Same for me(
phpmd 2.6.0

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