| Request #14917 | Improve PHPCS results |
| Submitted: |
2008年10月29日 14:59 UTC |
| From: |
doconnor |
Assigned: |
doconnor |
| Status: |
Closed |
Package: |
File_SearchReplace (version CVS) |
| PHP Version: |
5.2.4 |
OS: |
| Roadmaps: |
(Not assigned) |
[2008年10月29日 14:59 UTC] doconnor
(Daniel O'Connor)
Comments
[2008年10月29日 15:01 UTC] doconnor
(Daniel O'Connor)
http://pastebin.com/f52496e15
1. Patch refactors some duplicate code and introduces private getters
2. Made use of foreach()
3. Fixed a bug very similar to
Bug #14892 (php5 not doing lots of type casting, the getters resolve this)
[2008年10月30日 08:02 UTC] techtonik
(anatoly techtonik)
First. I appreciate your work on this package, but please note that I abandoned it for a reason. The API names are misleading and can be called "dangerous" in that main method is named "search" when in fact it performs replace (I've just updated package description). I once submitted a proposal for class with search capabilities, but it was declined. You may have a better luck to try another proposal instead of fixing bugs in this not-so-useful-as-it-may-be stuff.
Now about your fixes. Space and comments formatting won't do any good for code history. CS in this case are not as important. It also doesn't worth the hassle in this case of crippled package functionality, but the codebase is small and clear, so if you want - feel free to commit.
_getFind() and _getReplace(): all functions accept array params, so you may remove these indirectors and place argument conversions right into setFind()/setReplace(), which would be right to call from constructor also.
Line 331: it is better to rename $file to $line
Everything else seems good to me.
[2008年10月30日 16:40 UTC] doconnor
(Daniel O'Connor)
This bug has been fixed in CVS.
If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).
If this was a problem with the pear.php.net website, the change should be live shortly.
Otherwise, the fix will appear in the package's next release.
Thank you for the report and for helping us make PEAR better.
I've:
* Applied multiple, sensible changes for PHPCS; committing appropriately to better show change history
* Created
Request #14926 to deal with type casting, setters, getters.