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

Support Class Move in combination with composer "repositories" of type "path" #2727

Open
d-s-codappix opened this issue Aug 28, 2024 · 1 comment · May be fixed by phpactor/class-to-file#33

Comments

@d-s-codappix
Copy link

d-s-codappix commented Aug 28, 2024

Given the following setup within composer.json of a project:

    "repositories": [
        {
            "type": "path",
            "url": "local_packages/*"
        }
    ],

One can provide project specific composer packages within local_packages.
We now have packages following that structure and want to use class:move feature, which fails with:

  [RuntimeException]
  There are no class name candidates

The Phpactor\ClassFileConverter\Adapter\Composer\Psr4NameInflector will not work as it will receive /vendor/prefix/name/Classes instead of the local_packages/package/Classes path.

Adding a realpath() call within class-to-file/lib/Adapter/Composer/ComposerFileToClass seems to help. I'm not sure if that might break other things.

@dantleech
Copy link
Collaborator

Shouldn't do, feel free to make a PR ideally with a test

d-s-codappix added a commit to d-s-codappix/fork-class-to-file that referenced this issue Sep 4, 2024
One can install packages from a local path via composers repositories
type "path".
Those are typically symlinks which were not resolved.
We therefore add a realpath() call, but falling back to old behavior if
it didn't resolve. That way we keep independent of realpath() as
requested by the inline comment.

Resolves: phpactor/phpactor#2727
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

Successfully merging a pull request may close this issue.

2 participants