Insolita / unused-scanner

Detect unused composer dependencies
MIT License
429 stars 38 forks source link

Usage of classes without declared namespaces not detected #2

Closed elazar closed 6 years ago

elazar commented 6 years ago

One of the dependencies of my project is datadog/php-datadogstatsd. This library uses a classmap autoloader and references a directory containing a single class file that does not include a namespace directive.

Under one of the directories included in the scanDirectories setting, I have a class that extends from this library's class. This class usage is not detected.

Insolita commented 6 years ago

Not clear. I just install this library, and last version use psr4 autoload, With example

<?php

namespace Acme\Scanner;

use DataDog\BatchedDogStatsd;

class DatadogUsage extends BatchedDogStatsd
{
    public function foo(){
        echo 'bar';
    }
}

This usage detect successfully

Show your example

elazar commented 6 years ago

Looks like the namespace was added in version 1.0.0. Try an older version. I'm using 0.3.0.

Insolita commented 6 years ago

try with updated version

elazar commented 6 years ago

Appears to be fixed under 1.0.6. Thanks for the prompt reply! 😄