+
+ // Filter out classes that will be found by PSR4
+ $result = array_filter( $result, function ( $class ) use ( $inputPath ) {
+ $parts = explode( '\\', $class );
+ for ( $i = count( $parts ) - 1; $i > 0; $i-- ) {
+ $ns = implode( '\\', array_slice( $parts, 0, $i ) ) . '\\';
+ if ( isset( $this->psr4Namespaces[$ns] ) ) {
+ $expectedPath = $this->psr4Namespaces[$ns] . '/'
+ . implode( '/', array_slice( $parts, $i ) )
+ . '.php';
+ if ( $inputPath === $expectedPath ) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ } );
+