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

Files in scan directory root gets additional postfix \ in their namespace #9

Open
RafalSalwa opened this issue Feb 22, 2024 · 2 comments

Comments

@RafalSalwa
Copy link

Hi, two things related to swiss-knife

  1. Namespace root files get additional backslash
  2. On second run, swiss-knife throws a syntax error

How to reproduce:
command:
vendor/bin/swiss-knife namespace-to-psr-4 src --namespace-root "App\\"

run in symfony project (6.3) on src directory with following structure

src
  Controller/
  Entity/
  Repository/
  Kernel.php

Fixer works flawlessly for every file inside directories :=)
Unfortunately files in scan directory root are getting App\ namespace with additional backslash.

declare(strict_types=1);

namespace App\;

use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;

class Kernel extends BaseKernel
{
    use MicroKernelTrait;
}

after running swiss-knife and then paraller-lint linter for example, i got this error:
image

Also in second run You will get error:

image

@TomasVotruba
Copy link
Member

Hi, thanks for reporting. This package is in its early development, so testing like your is very important to us.

Could you send us a PR with fix?

@RafalSalwa
Copy link
Author

yes, within this week i will sit and help with this one:)

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

2 participants