phan -f filelist.txt
I generated my
filelist.txt files with a little help from grep – by looking for all files with opening PHP tags in, and putting that list of filenames into a file. My command looks like this:
grep -R -l "<?php" * > filelist.txt
This simply greps recursively (the
-R switch) in all files looking for
<?php and when it finds it, outputs only the filename (the
-l switch does that bit). Then I just put all the output into my
Phan is in its early stages but it’s ready for you to run on your own projects. Look out that you may need to put your bootstrap or other include files first in the
filelist.txt file if phan isn’t finding things in the right order – luckily with it all in one file, it’s relatively easy to move things around if you need to.
In PHP 5, we already have a ternary operator, which tests a value, and then returns the second element if that returns true and the third if it doesn’t:
echo $count ? $count : 10; // outputs 10
This graph shows the time it takes for each version of PHP to perform the same task, on average, with oldest PHP on the left and moving forward in time.
Total lines of code change needed to make the @joindin API work on PHP7: zero
— Lorna Mitchell (@lornajane) May 14, 2015