Remove mention of better heredoc formatting from the README

Commit f910f9e9 reverts a series of buggy patches related to improving
heredoc support.  However, the README still incorrectly claims to have
that improvement.
Treat ‘encoding’ and ‘ticks’ as keywords

PHP allows the declaration of certain directives:

    http://php.net/declare

We currently highlight those directives in the warning font-face.
This patch presents a simple solution: treat the acceptable directives
as keywords.  This is not the most ideal implementation, but it is the
most simple so that we can fix the incorrect fontification we
currently have.
Update the Changelog for version 1.10
Update php-mode to version 1.10
Use "magic" comments in PHP files to simplify indentation testing

If a line in a PHP test file contains the magic comment
`###php-mode-test### (SPEC ...)`, then each `SPEC` is executed. Each `SPEC` is
of the form `(NAME [ARG ...])` and is a test which applies to the current line
and returns non-nil if it passes. Each `ARG` is `eval`ed before being passed to
`NAME`.

A magic comment looks like this

    header('Location: http://github.com'); // ###php-mode-test### ((indent c-basic-offset))

In this case, it indicates that the current line should be indented by one
`c-basic-offset'.

Currently, the only available test is for indentation.

Signed-off-by: Eric James Michael Ritz <lobbyjones@gmail.com>
Use magic for tests of issues #14, #19, #27, #29, #42

This massively cuts back on the elisp code needed.

Signed-off-by: Eric James Michael Ritz <lobbyjones@gmail.com>
Merge branch 'haxney/tests-with-magic-comments'

* haxney/tests-with-magic-comments:
  Use magic for tests of issues #14, #19, #27, #29, #42
  Use "magic" comments in PHP files to simplify indentation testing
Added "function" as a PHP keyword.

This allows the function keyword to be highlighted in closures.

Signed-off-by: Eric James Michael Ritz <lobbyjones@gmail.com>
Update php-mode-modified for ‘function’ keyword addition
README: Change the absolute link to the Changelog to a relative link

Developers who create forks of php-mode may modify the Changelog to
reflect their additions, bug fixes, and so on.  But the README uses an
absolute link to the Changelog.  That means people viewing forks of
php-mode will only see a link to my copy of the Changelog, and that
will never reflect the Changelog in anyone’s fork.  Make the link
relative fixes this problem.

Admittedly this is a minuscule change.  But it is a good practice on
GitHub, where php-mode currently resides, to use relative links the
README so that forks will point to their own files.
Improve the plain-text formatting of the README

This patch changes no real content in the README besides some
formatting improvements and some reworded sentences to improve grammar
and clarity.
Correct syntax highlighting for ‘parent’ and ‘self’

Previously we would only look for the two words in isolation without
considering their surrounding context, under the assumption that they
are special keywords.  But this assumption is incorrect.

The ‘self’ token can appear in code such as

    self::foo();

but we do not properly highlight ‘self’ in this situation.

We face similar situations with ‘parent’.  Consider this code:

    1.  echo $parent;
    2.  echo parent::$foo;
    3.  echo $this->parent;
    4.  $foo = new parent();

Lines one and three should treat ‘parent’ as a variable and highlight
it accordingly.  Lines two and four should treat it as a special
word.  Previously php-mode would fail to highlight lines three and
four correctly.

This patch corrects all of these problems.

Special thanks to the following people who helped me craft this patch:

1. Nate Eagleson
2. David Harkness
3. Ángel González
4. Kalle Sommer Nielsen
5. Nikita Popov

Github-issue: 77
Update php-mode-modified
README: Use syntax highlighting for the method alignment example
Highlight ‘static’ as a constant when it appears in a class context

In commit 90c53729 we fixed the highlighting for ‘self’ and ‘parent’
when they appear in a class context, e.g. self::foo().  However, we
forgot to treat ‘static’ in the same way.  When we have code like

    static::foo();

we want ‘static’ to appear in the constant font face because that is
consistent with how we treat the other two words.  This patch gives
‘static’ the proper face in that situation.  Note that we must tell
font lock mode to override any existing face for ‘static’ or otherwise
it will not work since we apply faces to it for other reasons.
Associate file extensions when installing from an Elisp repository

If a user installs php-mode from a repository, e.g. MELPA, then Emacs
will not recognize the file extensions for PHP.  This happens because
we add those extensions to ‘auto-mode-alist’ via code in a ‘defcustom’
definition.  However, there is no guarantee that Emacs will execute
that code when we install php-mode from a repository.

This patch removes that ‘defcustom’ code and replaces it with a loop
that will always add the appropriate extensions to ‘auto-mode-alist’.
Because of this change users can no longer customize the valid
extensions for PHP files, but it is worthwhile to temporarily remove
that customization in order to fix this more important problem.

Github-issue: 79
Correct indentation for array arguments (tests/issues-14.php)

Commit 055d0810 began a transition to using more of cc-mode’s
machinery for customizing indentation.  In the process this broke the
indentation we expect from the ‘tests/issues-14.php’ script.  This
failure went unnoticed because we expected the test to fail, and so
every time we would run the test suite the test would successfully
fail.  After the code was in place to make indentation work properly
we failed to update the test accordingly so that it would no longer
expect a failure.

Due to this mismanagement of the test suite on my part, a regression
which re-broke indentation entered the master branch unnoticed.

This patch corrects the problem in a number of ways:

1. We no longer expect ‘php-mode-test-issue-14’ to fail.  When we run
the test suite it must pass.

2. We explicitly use the ‘php-lineup-arglist-intro’ and
‘php-lineup-arglist-close’ functions for the cc-mode offsets
‘arglist-intro’ and ‘arglist-close’, respectively.  We use these in
all three styles.

3. When loading php-mode we explicitly enable the user’s coding style
before running associated hooks.

With this patch in place we can start a fresh instance of ‘emacs -Q’,
load php-mode, and get the expected indentation in the issue-14 test
for all three coding styles we define: PEAR, Drupal, and WordPress.

Finally, this patch performs some reformatting of the Elisp itself for
readability and consistency.

Github-issue: 80
Do not expect failure for test issue-19

If php-mode fails to properly align arrows for chained method calls
then we want to know that.

Github-issue: 81
Do not trigger search error in php-mode-test-issue-19

We search for the string ‘$object->’ to determine if its position
matches the arrow on the next line.  Because we test this in different
contexts (e.g. in methods, in closures, at the top level) we search
for the string in a loop.  When we reach the end of the buffer,
however, search-forward returns an error because there are no more
‘$object->’ strings to find.  This patch changes the search so it does
not raise the error but only returns nil at the end, causing the loop
to end normally.

Github-issue: 81
Fix chained method alignment

Commit f933ec2d removed the cc-mode setting for ‘statement-cont’ but
we never re-introduced it when implementing the different PHP styles.
That breaks the alignment of chained methods across different lines.
This patch fixes this by re-introducing ‘statement-cont’ to each style
and by giving ‘brace-list-intro’ and ‘brace-list-entry’ proper values
so that methods are correctly aligned in the different contexts
presented in the issue-19 test.

This patch causes php-mode-test-issue-19 to pass successfully.

Github-issue: 81