Introduce ‘C-c C-w’ to toggle Subword Mode

Programmers who use cameCase may prefer to use Subword Mode. The keys
‘C-c C-w’ exist in cc-mode, performing the exact same behavior.
Because we have gradually move towards using cc-mode as the foundation
of new features it seems reasonable to introduce this change.

The source code contains a URL to the official GNU Emacs manual here
it explains exactly what Subword Mode does.

GitHub-Issue: 89
Document Subword Mode in the README

The README briefly explains the purpose of Subword Mode, linking to
the official manual for more information.  PHP Mode does not enable
Subword Mode by default.  So the README describes two ways to use it:

1. We can add a hook to PHP Mode that enables Subword Mode.  The
README demonstrates an example of this.

2. We can toggle the minor mode on and off by using ‘C-c C-w’ in PHP
Mode (and other modes based on cc-mode).

Adding (global-subword-mode t) to an Emacs config file will enable
Subword Mode for all buffers.  The README omits this third method
because, based on personal experience, I do not want the mode
affecting every buffer and file I use.  Instead I find it easier to
setup a hook or toggling the mode, as described in the README.

GitHub-Issue: 89
Merge branch 'ejmr/subword-mode'

* ejmr/subword-mode:
  Document Subword Mode in the README
  Introduce ‘C-c C-w’ to toggle Subword Mode
Fix indentation of statements after ‘foreach’ without braces

PHP Mode fails to indent the following code:

    foreach ($x as $s)
        echo $s;

It does not indent the second line if there are no braces following
the ‘foreach’.  Commit 89eefdf7 previously fixed this problem but a
regression happened when making changes to all of the indentation
styles.  Each CC Mode style that PHP Mode provides defines a value for
‘statement-cont’.  That controls the second line in the example.

We changed ‘statement-cont’ in the three original styles to use the
lineup function ‘c-lineup-cascaded-calls’ because that tells PHP Mode
to properly indent cascaded method calls, e.g.:

    foreach ($x as $s)
        echo $s->foo()
               ->bar();

However, changing the value of ‘statement-cont’ broke indentation for
the first example.  We address this problem by redefining
‘statement-cont’ in every style except ‘Symfony2’.  Each style
attempts to first use ‘c-lineup-cascaded-calls’ when indenting a line
that falls under the control of ‘statement-cont’, but if that returns
nil, which happens in the first ‘foreach’ above, then the style
defaults to indenting by ‘c-basic-offset’.  In other words, we first
attempt to align the code as a chained method, and failing that we
simply indent it normally.

This patch omits any change to the ‘Symfony2’ style because it uses a
different function for ‘statement-cont’ than all of the rest and will
require separate testing and modification.

Finally, this patch also introduces a unit-test for this problem so
that we can avoid future regressions.  The test contains the first
example in the commit message and makes sure that PHP indents the
second line by the value described by ‘c-basic-offset’.

GitHub-Issue: 99
Workaround "bug" in `load-theme`

If you have `php-mode-coding-style` set and you run `load-theme`, it
calls `php-mode-custom-coding-style-set` from
`custom-theme-recalc-variable`.  This happens regardless of what type
of buffer you are in, so if you are in a buffer whose major mode is
not based on `cc-mode`, you can get an error like this:

> Debugger entered--Lisp error: (error "Buffer  *temp* is not a CC Mode buffer (c-set-style)")
>   signal(error ("Buffer  *temp* is not a CC Mode buffer (c-set-style)"))
>   error("Buffer %s is not a CC Mode buffer (c-set-style)" " *temp*")
>   c-set-style("symfony2")
>   php-enable-symfony2-coding-style()
>   php-mode-custom-coding-style-set(php-mode-coding-style symfony2)
>   custom-theme-recalc-variable(php-mode-coding-style)
>   enable-theme(user)
>   enable-theme(solarized-dark)
>   load-theme(solarized-dark)
>   eval((load-theme (quote solarized-dark)) nil)
>   eval-last-sexp-1(nil)
>   eval-last-sexp(nil)
>   call-interactively(eval-last-sexp nil nil)

 This patch makes `php-mode-custom-coding-style-set` check to make
 sure it's in a `php-mode` buffer.

Signed-off-by: Eric James Michael Ritz <lobbyjones@gmail.com>
Be nice to PSR standards (there should be 4 spaces)

Signed-off-by: Eric James Michael Ritz <lobbyjones@gmail.com>
Added myself as contributor

Signed-off-by: Eric James Michael Ritz <lobbyjones@gmail.com>
README: Reword the mention of Web Mode for clarity

Saying the mode ‘complements’ PHP Mode makes it sound as if the two
can work together, but since they are both major modes that is not
really accurate.  Instead it is better to call Web Mode a great
‘alternative’ to PHP Mode when editing files that contain a lot of
HTML and other markup alongside PHP code.

GitHub-Issue: 107
brace-list-entry whould have offset set to 4 - PSR

Signed-off-by: Eric James Michael Ritz <lobbyjones@gmail.com>
proper statement-case-intro indent for symfony2

Signed-off-by: Eric James Michael Ritz <lobbyjones@gmail.com>
Merge branch 'jw/issue-112'

* jw/issue-112:
  proper statement-case-intro indent for symfony2
  brace-list-entry whould have offset set to 4 - PSR
README: Remove a stray comma to correct the text about Subword Mode
Tests: Remove executable permissions from the issue 27 test

There is no reason for this script to be executable.  The test suite
does not require it.

GitHub-Issue: 27
Remove the unnecessary &optional from the with-php-mode-test macro

All of the tests behave as expected without &optional since using &key
is sufficient for the optional parameters we allow, which are all
keywords.
Update the Changelog and relevant constants to release version 1.11
Automatically enable PHP Mode for Amaka scripts

See the project page

    http://trashofmasters.github.io/amaka/

for more information about the Amaka build tool.  Amaka’s build
scripts are PHP files, and so this patch adds `Amkfile` (the name of
those scripts) to `auto-mode-alist` so that Emacs will enable PHP Mode
when viewing or editing them.
Also enable PHP Mode for Amaka scripts using the ‘*.amk’ extension

See the thread at

    https://github.com/trashofmasters/amaka/issues/12

for more information.
Use mode-specific functions for defun movement

We derive PHP Mode from CC Mode.  So by default PHP Mode inherits
these bindings:

1. C-M-a    c-beginning-of-defun

2. C-M-e    c-end-of-defun

This patch replaces those functions with php-beginning-of-defun and
php-end-of-defun, respectively, so that Emacs uses them when people
are using PHP Mode.  We remap the functions themselves and not their
key-bindings so that Emacs will use those two PHP-specific functions
for any keys which the user binds to the default CC Mode commands.

Special thanks to Tom Willemse for providing this idea.  This patch
also makes a correction in the README where I had mistakenly
misspelled his name.

GitHub-Issue: 116
Added newline at end of file restriction to Symfony2 style.

Signed-off-by: Eric James Michael Ritz <lobbyjones@gmail.com>
Treat `const` as a keyword instead of a type-hint

PHP does not use `const` as a type-hint like it does with `array`,
`callable`, and so forth.  Semantically we should treat it as a
built-in keyword instead.