Skip to content
This repository has been archived by the owner on Jul 12, 2020. It is now read-only.

[RuntimeException] Adding more than one operation to line 21 is not allowed. #26

Open
umpirsky opened this issue Jul 1, 2013 · 5 comments

Comments

@umpirsky
Copy link

umpirsky commented Jul 1, 2013

I get this error when I tried to fix class names on SyliusPaymentsBundle:

git clone [email protected]:Sylius/SyliusPaymentsBundle.git
cd SyliusPaymentсBundle
refactor.phar fix-class-names .

  [RuntimeException]                                         
  Adding more than one operation to line 21 is not allowed.  



Exception trace:
 () at phar:///usr/local/bin/refactor.phar/src/main/QafooLabs/Patches/PatchBuilder.php:165
 QafooLabs\Patches\PatchBuilder->assertValidOriginalLine() at phar:///usr/local/bin/refactor.phar/src/main/QafooLabs/Patches/PatchBuilder.php:72
 QafooLabs\Patches\PatchBuilder->changeToken() at phar:///usr/local/bin/refactor.phar/src/main/QafooLabs/Refactoring/Adapters/Patches/PatchBuffer.php:45
 QafooLabs\Refactoring\Adapters\Patches\PatchBuffer->replaceString() at phar:///usr/local/bin/refactor.phar/src/main/QafooLabs/Refactoring/Application/FixClassNames.php:84
 QafooLabs\Refactoring\Application\FixClassNames->refactor() at phar:///usr/local/bin/refactor.phar/src/main/QafooLabs/Refactoring/Adapters/Symfony/Commands/FixClassNamesCommand.php:70
 QafooLabs\Refactoring\Adapters\Symfony\Commands\FixClassNamesCommand->execute() at phar:///usr/local/bin/refactor.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:244
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/refactor.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:899
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/refactor.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:191
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/refactor.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:121
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/refactor.phar/src/bin/refactor:10
 require() at /usr/local/bin/refactor.phar:5


fix-class-names dir
@beberlei
Copy link
Contributor

beberlei commented Jul 1, 2013

Yeah i had this before, i will fix it sometime this month.

@umpirsky
Copy link
Author

umpirsky commented Jul 1, 2013

Can you give me any hints? Why does it happens?

@beberlei
Copy link
Contributor

beberlei commented Jul 1, 2013

@umpirsky the replaceString call needs to accept an array of changes and perform them together (a new method actually). Building patches can always only change one line. But in your case it wants to change the same line multiple times.

@umpirsky
Copy link
Author

umpirsky commented Jul 1, 2013

@beberlei Thanks.

@beberlei
Copy link
Contributor

beberlei commented Jul 6, 2013

@umpirsky I just realized, this will not work on bundles, because by using 'target-dir' - they are normally not PSR-0 in their github repository structure.

I did fix a bunch of bugs with the renaming and for a repository with PSR-0 directory structures, it should work much better now. I havened fixed the not allowing 2 changes to one line though, this might be a bit more tricky.

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

No branches or pull requests

2 participants