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

Added revert functionality #4

Merged
merged 7 commits into from
Nov 22, 2015
Merged

Conversation

dizyart
Copy link
Contributor

@dizyart dizyart commented Dec 4, 2013

The new revert.php script is based completely on convert.php and behaves pretty much the same from the CLI point of view.

Since finding an "[" array token is not possible, I have taken the approach to consider every "[" token as an array and check for what is not an array by checking previous tokens for variables, object properties, functions (which might return arrays) and variable references ($this->{$varname}['index']).

Tested on a badly conventioned app with 6.500 files with approx. 1.650 replacements. No false positives were found. Still checking for false negatives (missed instances).

This should not be considered a thourough test though, additional test must be carried out.

Added reverse functionality (changes "[]" to "array()")
$this->{$propertyName}['index'] would give a false positive.
@thomasbachem
Copy link
Owner

Great, thanks! Could you fix indentation (you doubled the number of tabs) and remove the unnecessary blank lines at lines 72, 81, 100 and 106? I'll merge it then :).

@thomasbachem
Copy link
Owner

Oh and remove the debug echo statements of course!

@dizyart
Copy link
Contributor Author

dizyart commented Dec 4, 2013

Oops, first time using github online editor - forgot to check indents. Thanks for the comment and if you have the time, please double-check if my offset code is OK, since I had some issues with the backward-checking and counting bytes.

@dizyart
Copy link
Contributor Author

dizyart commented Dec 4, 2013

I did, however leave the replacement count report at the end. Useful to see which files were changed when batch-converting complete projects,

@thomasbachem
Copy link
Owner

Now it's spaces, not tabs :-/

@dizyart
Copy link
Contributor Author

dizyart commented Dec 5, 2013

Please accept my apologies, kind sir, there was a bee in my coffee and I forgot how to code properly. :)
I believe it should be OK now. Cheers.

@malukenho malukenho mentioned this pull request Jan 22, 2015
thomasbachem added a commit that referenced this pull request Nov 22, 2015
Added revert functionality
@thomasbachem thomasbachem merged commit 9217086 into thomasbachem:master Nov 22, 2015
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 this pull request may close these issues.

None yet

2 participants