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

Only migrate php files when migrating from the old to new namespace #6752

Merged

Conversation

helturkey
Copy link
Contributor

fix upgrade issue while migrating old namespaces for a directory has none-php files such as .DSStore or any hidden files by filtering collected files collection to exclude files not ended with .php

collect($this->filesystem()->allFiles('app/Http/Livewire'))
         + => =>       ->filter(fn($file) => str($file)->endsWith('.php'))

before map the collection

   ErrorException

  file_get_contents(/Users/XUser/Sites/projectName/app/Http/Livewire/DSStore.php): Failed to open stream: No such file or directory

  at vendor/livewire/livewire/src/Features/SupportConsoleCommands/Commands/ComponentParserFromExistingComponent.php:18
     14▕     }
     1516public function classContents($inline = false)
     17▕     {
  ➜  18$originalFile = file_get_contents($this->existingParser->classPath());
     1920$escapedClassNamespace = preg_replace('/\\\/', '\\\\\\', $this->existingParser->classNamespace());
     2122return preg_replace_array(

      +2 vendor frames

  3   [internal]:0
      Livewire\Features\SupportConsoleCommands\Commands\Upgrade\ChangeDefaultNamespace::Livewire\Features\SupportConsoleCommands\Commands\Upgrade\{closure}("Dashboard/.DS_Store")
      +21 vendor frames

  25  artisan:35
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

hope you find this usefull

thanks

…tory which has none php files such as .DSStore
@joshhanley joshhanley changed the title fix upgrade issue while migrating old namespaces for a directory has none-php files such as .DSStore Fix upgrade issue while migrating old namespaces for a directory has no php files such as .DSStore Sep 12, 2023
@joshhanley
Copy link
Member

@helturkey thanks for the PR! Can you please remove any of the code linting changes, so the PR only shows your fix? Thanks!

@PhiloNL if you get a chance, can you have a look at this?

…tory which has none php files such as .DSStore
@helturkey
Copy link
Contributor Author

@helturkey thanks for the PR! Can you please remove any of the code linting changes, so the PR only shows your fix? Thanks!

@PhiloNL if you get a chance, can you have a look at this?

code linting removed

@PhiloNL PhiloNL changed the title Fix upgrade issue while migrating old namespaces for a directory has no php files such as .DSStore Only migrate php files when migrating from the old to new namespace Sep 13, 2023
@PhiloNL PhiloNL merged commit 266c356 into livewire:main Sep 13, 2023
2 checks passed
@PhiloNL
Copy link
Collaborator

PhiloNL commented Sep 13, 2023

Thanks @helturkey 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants