Changes between Version 4 and Version 5 of CodingStandard


Ignore:
Timestamp:
2012-05-03T01:01:17Z (12 years ago)
Author:
Pan Luo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CodingStandard

    v4 v5  
    77== Indenting and Whitespace ==
    88
    9 * '''Never use tabulations''' in the code. Indentation is done by steps of '''2 spaces''':
     9* '''Never use tabulations''' in the code. Indentation is done by steps of '''4 spaces''':
    1010
    1111{{{
     
    1414class sfFoo
    1515{
    16   public function bar() {
    17     sfCoffee::make();
     16    public function bar() {
     17        sfCoffee::make();
    1818  }
    1919}
     
    6767<?php
    6868if ($condition1 || $condition2) {
    69   action1;
     69    action1;
    7070} elseif ($condition3 && $condition4) {
    71   action2;
     71    action2;
    7272} else {
    73   defaultaction;
     73    defaultaction;
    7474}
    7575}}}
     
    8080<?php
    8181switch ($condition) {
    82   case 1:
    83     action1;
    84     break;
    85 
    86   case 2:
    87     action2;
    88     break;
    89 
    90   default:
    91     defaultaction;
     82    case 1:
     83        action1;
     84        break;
     85
     86    case 2:
     87        action2;
     88        break;
     89
     90    default:
     91        defaultaction;
    9292}
    9393}}}
     
    9898<?php
    9999do {
    100   actions;
     100    actions;
    101101} while ($condition);
    102102}}}
     
    124124function makeCoffee()
    125125{
    126   if (false !== isSleeping() && false !== hasEnoughCaffeineForToday()) {
    127     canMakeCoffee();
    128 
    129     return 1;
    130   } else {
    131     cantMakeCoffee();
    132   }
    133 
    134   return null;
     126    if (false !== isSleeping() && false !== hasEnoughCaffeineForToday()) {
     127        canMakeCoffee();
     128
     129        return 1;
     130    } else {
     131        cantMakeCoffee();
     132    }
     133
     134    return null;
    135135}
    136136}}}
     
    165165<?php
    166166$form['title'] = array(
    167   '#type' => 'textfield',
    168   '#title' => t('Title'),
    169   '#size' => 60,
    170   '#maxlength' => 128,
    171   '#description' => t('The title of your node.'),
     167    '#type' => 'textfield',
     168    '#title' => t('Title'),
     169    '#size' => 60,
     170    '#maxlength' => 128,
     171    '#description' => t('The title of your node.'),
    172172);
    173173}}}
     
    228228<?php
    229229class Coffee {
    230   const HAZ_SUGAR = true;
     230    const HAZ_SUGAR = true;
    231231}
    232232var_dump(Coffee::HAZ_SUGAR);