Changes between Version 4 and Version 5 of CodingStandard
- Timestamp:
- 2012-05-03T01:01:17Z (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CodingStandard
v4 v5 7 7 == Indenting and Whitespace == 8 8 9 * '''Never use tabulations''' in the code. Indentation is done by steps of ''' 2spaces''':9 * '''Never use tabulations''' in the code. Indentation is done by steps of '''4 spaces''': 10 10 11 11 {{{ … … 14 14 class sfFoo 15 15 { 16 public function bar() {17 sfCoffee::make();16 public function bar() { 17 sfCoffee::make(); 18 18 } 19 19 } … … 67 67 <?php 68 68 if ($condition1 || $condition2) { 69 action1;69 action1; 70 70 } elseif ($condition3 && $condition4) { 71 action2;71 action2; 72 72 } else { 73 defaultaction;73 defaultaction; 74 74 } 75 75 }}} … … 80 80 <?php 81 81 switch ($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; 92 92 } 93 93 }}} … … 98 98 <?php 99 99 do { 100 actions;100 actions; 101 101 } while ($condition); 102 102 }}} … … 124 124 function makeCoffee() 125 125 { 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; 135 135 } 136 136 }}} … … 165 165 <?php 166 166 $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.'), 172 172 ); 173 173 }}} … … 228 228 <?php 229 229 class Coffee { 230 const HAZ_SUGAR = true;230 const HAZ_SUGAR = true; 231 231 } 232 232 var_dump(Coffee::HAZ_SUGAR);