-
Notifications
You must be signed in to change notification settings - Fork 35
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
Conversation
Added reverse functionality (changes "[]" to "array()")
$this->{$propertyName}['index'] would give a false positive.
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 :). |
Oh and remove the debug |
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. |
I did, however leave the replacement count report at the end. Useful to see which files were changed when batch-converting complete projects, |
Now it's spaces, not tabs :-/ |
I am having a really bad day.
Please accept my apologies, kind sir, there was a bee in my coffee and I forgot how to code properly. :) |
Added revert functionality
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.