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
Merge branch 'issue-81'

* issue-81:
  Fix chained method alignment
  Do not trigger search error in php-mode-test-issue-19
  Do not expect failure for test issue-19
README: Document how chained method alignment may fail

Because PHP mode uses CC mode for indentation a user may be using a
variety of styles that we cannot anticipate.  We implement chained
method alignment, e.g

    $object->foo()
           ->bar()
           ->baz();

by defining certain properties for the three indentation styles that
are special to PHP mode.  We cannot make these same modifications to
other styles because that would overstep the bounds of PHP mode; it
should not affect the behavior of other modes that also use CC mode
for indenting code in unrelated languages.

Therefore we need to make it clear to the user that method alignment
is only guaranteed to work if he or she is using one of the
indentation styles specific to PHP mode.

Github-issue: 81
Add STDOUT, STDIN, and STDERR to the php-constants list

When we run a PHP program from the command-line (i.e. via the CLI
SAPI) then we have access to the three constants above.  This patch
adds them to the ‘php-constants’ list so that PHP mode will give them
proper highlighting.

Github-issue: 82
Re-define C-M-h to mark-defun instead of c-mark-function

As the code commentary explains, there are situations where
c-mark-function oversteps its bounds and creates a region around more
than just the function at point.  Using mark-defun instead gives us
more ‘natural’ behavior.

This patch adds TatriX Imbra to the list of contributors because he
was the one who not only brought this bug to my attention but provided
the solution of using mark-defun.
README: Rename ‘TatritX Imbra’ to just ‘TatriX’ at his request
Improve the docstring for php-create-regexp-for-method

This patch not only gives the function a more appropriate parameter
name, it also explains the values we expect for that parameter and how
it is acceptable to pass in regular expressions as well.
List all methods via Imenu regardless of their visibility

To find a method using Imenu the programmer must remember its
visibility, e.g. if it was a ‘public’ or ‘private’ method, because we
group methods by their visibility.  If the user does not remember the
visibility then he must look through all of the sub-menus.

This patch adds an ‘All Methods’ entry to the Imenu list that contains
every method in a file, regardless of its visibility.  This makes it
possible for programmers to find methods more easily if they only
remember the name and not the visibility.