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

nesbot/carbon empty searchNamespace #109

Open
BrianHenryIE opened this issue Dec 29, 2020 · 1 comment
Open

nesbot/carbon empty searchNamespace #109

BrianHenryIE opened this issue Dec 29, 2020 · 1 comment

Comments

@BrianHenryIE
Copy link
Contributor

BrianHenryIE commented Dec 29, 2020

nesbot/carbon 1.39.0 "prefixes" the end of lines because its autoload key has an empty key.

Output src/carbon/Carbon.php :

<?php
Mozart\
/*Mozart\
 *Mozart\ This file is part of the Carbon package.Mozart\
 *Mozart\
 *Mozart\ (c)Mozart\ Brian Nesbitt <[email protected]>Mozart\
 *Mozart\
 *Mozart\ For the full copyright and license information,Mozart\ please view the LICENSE
Mozart\ *Mozart\ file that was distributed with this source code.Mozart\
 */Mozart\

namespace Carbon;Mozart\

use Carbon\Exceptions\InvalidDateException;Mozart\
use Closure;Mozart\
use DateInterval;Mozart\
use DatePeriod;Mozart\
use DateTime;Mozart\
use DateTimeInterface;Mozart\
use DateTimeZone;Mozart\
use InvalidArgumentException;Mozart\

The autoload key:

"autoload": {
    "psr-4": {
        "": "src/"
    }
},

Minimal reproducible composer.json:

{
  "minimum-stability": "dev",
  "prefer-stable": true,
  "require": {
    "nesbot/carbon":"1.39.0"
  },
  "require-dev": {
    "coenjacobs/mozart": "dev-master",
    "cweagans/composer-patches": "*"
  },
  "extra": {
    "mozart": {
      "dep_namespace": "Mozart\\",
      "dep_directory": "/dep_directory/",
      "classmap_prefix": "Mozart_",
      "classmap_directory": "/classmap_directory/",
      "delete_vendor_directories": false,
      "override_autoload": {
        "kylekatarnls/update-helper": {},
        "symfony/polyfill-intl-idn": {},
        "symfony/translation":{},
        "symfony/polyfill-mbstring": {},
        "symfony/translation-contracts": {}
      }
    }
  }
}

The solution might be in the NamespaceReplacer's regex, which would properly match if $searchNamespace was not an empty string.

I tried all the open PRs but they don't help.

@BrianHenryIE
Copy link
Contributor Author

A working solution with failing tests, not even ready for a draft PR but good enough for me to use:

https://github.com/coenjacobs/mozart/compare/master...BrianHenryIE:empty-namespace-key?expand=1

BrianHenryIE added a commit to BrianHenryIE/strauss that referenced this issue May 1, 2021
szepeviktor pushed a commit to szepeviktor/BrianHenryIE_mozart that referenced this issue Jun 10, 2024
…presence

fix: check input options presence when updating config from CLI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant