Skip to content

Namespaces are still being duplicated #58

@EvanShaw

Description

@EvanShaw

#11 doesn't seem to be fully resolved.

If I'm not mistaken, the initial issue was caused when 2 or more packages with the same dependency were included in the packages array. This would cause the namespace of said dependency to be escaped more than once. This issue appears to be resolved.

However, I still see this happening with certain libraries unrelated to the cause written above. For example, guzzlehttp/guzzle has duplicated namespaces in certain files. In some files the namespace isn't inserted at all.

Here's a sample composer.json:

{
  "name": "guzzle-demo",
  "require": {
    "guzzlehttp/guzzle": "^7.0"
  },
  "require-dev": {
    "coenjacobs/mozart": "^0.5.1"
  },
  "extra": {
    "mozart": {
      "dep_namespace": "DUPTEST\\",
      "dep_directory": "/dist/DUPTEST/",
      "classmap_directory": "/dist/classes/",
      "classmap_prefix": "DUPTEST_",
      "packages": [
        "guzzlehttp/guzzle"
      ]
    }
  },
  "autoload": {
    "psr-4": {
      "DUPTEST\\": "dist/DUPTEST"
    }
  }
}

And here is the first few lines of dist/DUPTEST/GuzzleHttp/Client.php:

<?php

namespace DUPTEST\GuzzleHttp;

use DUPTEST\GuzzleHttp\Cookie\CookieJar;
use DUPTEST\GuzzleHttp\Exception\GuzzleException;
use DUPTEST\GuzzleHttp\Exception\InvalidArgumentException;
use DUPTEST\DUPTEST\GuzzleHttp\Promise\PromiseInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\UriInterface;

class Client implements ClientInterface, \DUPTEST\Psr\Http\Client\ClientInterface
{
.....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions