Commit 82417b3d authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Merge branch 'switch-and-use' into 'master'

Switch and use

- switch control struct
- namespace/use line spacing

See merge request !13
parents fb05427a 22e6068b
......@@ -374,6 +374,33 @@ try {
## 7.4. switch, case
There MUST be a space after the switch keyword and the opening brace MUST be on the same line as the closing brace.
The case statement must be indented once from the switch and the break or terminating keyword must be indented once
from case.
switch ($expr) {
case 0:
echo 'First case, with a break';
case 1:
echo 'Second case, which falls through';
// no break
case 2:
case 3:
case 4:
echo 'Third case, return instead of break';
echo 'Default case';
## 8. HTML PHP Mixed
### 8.1. No indentation for php tags unless it's on 1 line
Example... opening and closing php tags at start of line
......@@ -454,7 +481,26 @@ function autoload($className)
// PHP 5.3 and later:
namespace Vendor\Namespace
namespace Vendor\Namespace;
## 9.3. Namespaces and Use Declarations
When present, there MUST be one blank line after the namespace declaration.
When present, all use declarations MUST go after the namespace declaration.
There MUST be only 1 use keywordsd per declaration.
There MUST be 3 blank lines after the use block.
namespace Vendor\Namespace;
use FooClass;
use BarClass as Bar;
use Vendor\Package\ClassName;
// rest of PHP code
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment