OC Coding Style: Unterschied zwischen den Versionen
fixed some syntax errors at ends of SQL-Strings
(→PHP) |
(fixed some syntax errors at ends of SQL-Strings) |
||
(5 dazwischenliegende Versionen von einem anderen Benutzer werden nicht angezeigt) | |||
Zeile 11: | Zeile 11: | ||
== PHP == | == PHP == | ||
All contributed or modified code sections must fully comply to the [http://www.php-fig.org/psr/psr- | All contributed or modified code sections must fully comply to the [http://www.php-fig.org/psr/psr-2/ PSR-2] standard (which includes [http://www.php-fig.org/psr/psr-1/ PSR-1]), with these exceptions: | ||
* When referencing identifiers (e.g. class and function names) that are defined in non-PSR-2-compliant source code files, | * When referencing identifiers (e.g. class and function names) that are defined in non-PSR-2-compliant source code files, their names need not be PSR-2 compliant. | ||
* When writing standalone scripts like those in the 'local', 'util' and 'util2' directories, they need not to comply to the PSR-1 "Side Effects" rule. | * When writing standalone scripts like those in the 'local', 'util' and 'util2' directories, they need not to comply to the PSR-1 "Side Effects" rule. | ||
Zeile 29: | Zeile 29: | ||
FROM `caches` | FROM `caches` | ||
JOIN `cache_logs` ON `cache_logs`.`cache_id` = `caches`.`cache_id` | JOIN `cache_logs` ON `cache_logs`.`cache_id` = `caches`.`cache_id` | ||
WHERE `caches`.`status` IN ('&1', '&2')" | WHERE `caches`.`status` IN ('&1', '&2')", | ||
$status1, | $status1, | ||
$status2 | $status2 | ||
Zeile 36: | Zeile 36: | ||
Note that the opening " is on a tab position, while the following lines start one column to the right. | Note that the opening " is on a tab position, while the following lines start one column to the right. | ||
If lines get too long, the parameters are moved to the next line(s) and indented to the next | If lines get too long, the parameters are moved to the next line(s) and indented to the next indent column (which is ''three'' chars right of the preceding line's keyword): | ||
$result = sql( | $result = sql( | ||
Zeile 50: | Zeile 50: | ||
WHERE | WHERE | ||
`caches`.`status` = '&2' | `caches`.`status` = '&2' | ||
AND `cache_logs`.`user_id` = '&3' | AND `cache_logs`.`user_id` = '&3'", | ||
$logType, | $logType, | ||
$cacheStatus, | $cacheStatus, | ||
Zeile 57: | Zeile 57: | ||
[[Kategorie:Entwicklung|Coding Style]] | [[Kategorie:Entwicklung|Coding Style]] | ||
[[Kategorie:English pages]] |