Wednesday, March 7, 2012

How to check php syntax of multiple files at once?


i have a svn server that i checkout the repository in my computer



the main repositiry is about 2k files



  • 3rd party

  • generic code classes

  • custom classes



i have made changes to lots of files (mainly php) and i want to make sure they are all valid before i commit




svn commit -m "i fix the bug #293"



how can i check all the files at once to make sure they are valid and no php errors so i dont have to manually check all these files



thanks

1 comment:

  1. This bash oneliner will the modified php files and filter the ones that have no syntax errors:

    for i in $(svn status | grep -v ^? | grep php | awk '{print $2}') ; do php -l $i ; done | grep 'Parse error'

    ReplyDelete