This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
en:dev:all:psr:psr-2 [26.05.2015 20:07] – [switch, case] translated mrbaseman | en:dev:all:psr:psr-2 [26.05.2015 20:23] – finished translation mrbaseman | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | FIXME **This page is not fully translated, yet. Please help completing the translation.**\\ //(remove this paragraph once the translation is finished)// | ||
- | |||
[size=10]originating from [[http:// | [size=10]originating from [[http:// | ||
====== Coding Style Guide ====== | ====== Coding Style Guide ====== | ||
Line 277: | Line 275: | ||
==== while, do while ==== | ==== while, do while ==== | ||
- | Ein **while**-Statement sieht wie nachfolgend aus. Beachten Sie die Plazierung von Klammern, Leerstellen und geschweiften Klammern. | + | A **while** |
<PHP> | <PHP> | ||
while ($expr) { | while ($expr) { | ||
Line 283: | Line 281: | ||
} | } | ||
</ | </ | ||
- | ebenso sieht ein **do while**-Statement wie nachfolgend aus. Beachten Sie die Plazierung von Klammern, Leerstellen und geschweiften Klammern. | + | Similarly, a **do while** |
<PHP> | <PHP> | ||
do { | do { | ||
Line 289: | Line 287: | ||
} while ($expr); | } while ($expr); | ||
</ | </ | ||
- | |||
- | |||
==== for ==== | ==== for ==== | ||
- | Ein **for**-Statement sieht wie nachfolgend aus. Beachten Sie die Plazierung von Klammern, Leerstellen und geschweiften Klammern. | + | A **for** |
<PHP> | <PHP> | ||
for ($i = 0; $i < 10; $i++) { | for ($i = 0; $i < 10; $i++) { | ||
Line 299: | Line 295: | ||
} | } | ||
</ | </ | ||
- | |||
==== foreach ==== | ==== foreach ==== | ||
- | Ein **foreach**-Statement sieht wie nachfolgend aus. Beachten Sie die Plazierung von Klammern, Leerstellen und geschweiften Klammern. | + | A **foreach** |
<PHP> | <PHP> | ||
foreach ($iterable as $key => $value) { | foreach ($iterable as $key => $value) { | ||
Line 311: | Line 306: | ||
==== try, catch ==== | ==== try, catch ==== | ||
- | Ein **try catch**-Statement sieht wie nachfolgend aus. Beachten Sie die Plazierung von Klammern, Leerstellen und geschweiften Klammern. | + | A **try catch** |
<PHP> | <PHP> | ||
try { | try { | ||
Line 324: | Line 319: | ||
===== Closures ===== | ===== Closures ===== | ||
- | * Closures | + | * Closures |
- | * Die öffnende, geschweifte Klammer MUSS in der selben Zeile wie das Schlüsselwort | + | * The opening brace MUST go on the same line as the **function** |
- | * Nach der öffnenden Klammer der Argumentenliste DARF NICHT ein Leerzeichen stehen und vor der schließenden Klammer DARF NICHT ein Leerzeichen sein. | + | * There MUST NOT be a space after the opening parenthesis of the argument list or variable list, and there MUST NOT be a space before the closing parenthesis of the argument list or variable list. |
- | * In der Argumentenliste und der Variablenliste DARF NICHT ein Leerzeichen vor einem Komma stehen und nach einem Komma MUSS ein Leerzeichen sein. | + | * In the argument list and variable list, there MUST NOT be a space before each comma, and there MUST be one space after each comma. |
- | * Closure | + | * Closure |
- | Eine Closure Deklaration sieht wie nachfolgend aus. Beachten Sie die Plazierung von Klammern, Leerstellen und geschweiften Klammern. | + | A closure declaration looks like the following. Note the placement of parentheses, commas, spaces, and braces: |
<PHP> | <PHP> | ||
$closureWithArgs = function ($arg1, $arg2) { | $closureWithArgs = function ($arg1, $arg2) { | ||
Line 339: | Line 334: | ||
}; | }; | ||
</ | </ | ||
- | * Argumenten- und Variablenlisten KÖNNEN über mehrere Zeilen gesplittet werden, wenn jede Unterzeile um eine Stufe eingerückt wird. Wenn so verfahren wird, MUSS das erste Element | + | * Argument lists and variable lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument or variable per line. |
- | * Wenn eine Argumenten- oder Variablenliste gesplittet wird, so MUSS die schließende Klammer und die öffnende geschweifte Klammer mit einer Leerstelle dazwischen in eine eigene Zeile. | + | * When the ending list (whether or arguments or variables) is split across multiple lines, the closing parenthesis and opening brace MUST be placed together on their own line with one space between them. |
- | Beispiele von Closures mit und ohne Argumentenliste und Variableliste die über mehrere Zeilen gesplittet sind. | + | * The following are examples of closures with and without argument lists and variable lists split across multiple lines. |
<PHP> | <PHP> | ||
$longArgs_noVars = function ( | $longArgs_noVars = function ( | ||
Line 387: | Line 382: | ||
}; | }; | ||
</ | </ | ||
- | Beachten Sie, dass die Formatierungsregeln auch greifen, wenn ein Closure direkt | + | Note that the formatting rules also apply when the closure is used directly |
<PHP> | <PHP> | ||
$foo-> | $foo-> | ||
Line 397: | Line 392: | ||
); | ); | ||
</ | </ | ||
- | |||
- | |||
- | |||
- | |||