When the value is a constant, the initialization can be done
way up together with the property declaration. I believe
this makes the code easier to read because it's not spread
out so much.
Change-Id: I5af482feccb746c144c0f318e119165cf5a56cbe
array_fill_keys() was introduced in PHP 5.2.0 and works like
array_flip() except that it does only one thing (copying keys) instead
of two things (copying keys and values). That makes it faster and more
obvious.
When array_flip() calls were paired, I left them as is, because that
pattern is too cute. I couldn't kill something so cute.
Sometimes it was hard to figure out whether the values in array_flip()
result were used. That's the point of this change. If you use
array_fill_keys(), the intention is obvious.
Change-Id: If8d340a8bc816a15afec37e64f00106ae45e10ed
I had to write a little test to understand what this loop is supposed
to do: All it really does is counting the number of consecutive empty
lines in the $this->lines array, starting at the offset $this->pos.
The only edge-case is when the array does not contain anything but empty
lines. In this case, the last empty line is skipped. This is because
explode( …, "\n\n\n" ) returns 4 elements, but we want to count the
number of newline characters, which is 3.
Change-Id: I74ae1ed6ba0a8d65a92a1dd07f681fd7ae4221b4
The first newline was missing so a block like:
!! hooks
source
!! endhooks
would turn into:
!! hookssource
!! endhooks
Change-Id: I2a4c5e52050d55fb0c9b4f5d0494eb00e34b233c
Add editTests.php, which provides an interactive interface to the
parser tests, with semi-automated editing.
Change-Id: I1a20d007ba4627d562a16c03849bbad7aec0e516