1<?php 2public function someFunctionWithAVeryLongName( 3 $firstParameter='something', 4 $secondParameter='booooo', 5 $third=null, 6 $fourthParameter=false, 7 $fifthParameter=123.12, 8 $sixthParam=true 9) { 10} 11 12function someFunctionWithAVeryLongName2( 13 $firstParameter='something', 14 $secondParameter='booooo', 15) { 16} 17 18function blah() 19{ 20} 21 22function blah() 23{ 24} 25 26class MyClass 27{ 28 29 public function someFunctionWithAVeryLongName( 30 $firstParameter='something', 31 $secondParameter='booooo', 32 $third=null, 33 $fourthParameter=false, 34 $fifthParameter=123.12, 35 $sixthParam=true 36 ) /** w00t */ { 37 } 38 39 public function someFunctionWithAVeryLongName2( 40 $firstParameter='something', 41 $secondParameter='booooo', 42 $third=null 43 ) { 44 } 45 46 public function someFunctionWithAVeryLongName3( 47 $firstParameter, 48 $secondParameter, 49 $third=null 50 ) { 51 } 52 53 public function someFunctionWithAVeryLongName4( 54 $firstParameter, 55 $secondParameter 56 ) { 57 } 58 59 public function someFunctionWithAVeryLongName5( 60 $firstParameter, 61 $secondParameter=array(1,2,3), 62 $third=null 63 ) { 64 } 65 66} 67 68$noArgs_longVars = function () use ( 69 $longVar1, 70 $longerVar2, 71 $muchLongerVar3 72) { 73 // body 74}; 75 76$longArgs_longVars = function ( 77 $longArgument, 78 $longerArgument, 79 $muchLongerArgument 80) use ( 81 $longVar1, 82 $longerVar2, 83 $muchLongerVar3 84) { 85 // body 86}; 87 88$longArgs_longVars = function ( 89 $longArgument, 90 $muchLongerArgument 91) use ( 92 $muchLongerVar3 93) { 94 // body 95}; 96 97$noArgs_longVars = function () use ( 98 $longVar1, 99 $longerVar2, 100 $muchLongerVar3 101) { 102 // body 103}; 104 105usort( 106 $data, 107 function ($a, $b) { 108 // body 109 } 110); 111 112function myFunction( 113 $firstParameter, 114 $secondParameter=[1,2,3], 115 $third=null 116) { 117} 118 119if (array_filter( 120 $commands, 121 function ($cmd) use ($commandName) { 122 return ($cmd['name'] == $commandName); 123 } 124)) { 125 // Do something 126} 127 128function foo( // comment 129 $bar, 130 $baz 131) { // comment 132 // ... 133} 134 135function foo($bar = [ 136 1, 137 2, 138], $foo) 139{ 140 // body 141} 142 143$foo = function ($bar = [ 144 1, 145 2, 146]) use ($longVar1, $longerVar2) { 147 // body 148}; 149 150function foo( 151 $bar = [ 152 1, 153 2, 154], 155 $foo 156) { 157 // body 158} 159 160function foo( 161 $bar = [ 162 1, 163 2, 164 ], 165 $foo 166) { 167 // body 168} 169 170function foo( 171 $param1, 172 $param2, 173 $param3, 174) : SomeClass { 175} 176 177// Issue 1959. 178function __construct( 179 $foo, // This is foo 180 $bar 181) {} 182 183function __construct( 184 $foo /* this is foo */, 185 $bar // this is bar 186) {} 187 188function __construct( 189 $foo, // phpcs:ignore Standard.Category.Sniff -- for reasons. 190 $bar 191) {} 192 193public function hello(string $greeting) 194{ 195} 196 197public function hello(string $greeting // cant fix this 198) 199{ 200} 201 202public function hello(string $greeting // phpcs:ignore Standard.Category.Sniff -- for reasons. 203) 204{ 205} 206 207function foo( 208 $foo, 209 $bar 210) { 211} 212 213class ConstructorPropertyPromotionSingleLineDocblockIndentOK 214{ 215 public function __construct( 216 /** @var string */ 217 public string $public, 218 /** @var string */ 219 private string $private, 220 ) { 221 } 222} 223 224class ConstructorPropertyPromotionMultiLineDocblockAndAttributeIndentOK 225{ 226 public function __construct( 227 /** 228 * @var string 229 * @Assert\NotBlank() 230 */ 231 public string $public, 232 /** 233 * @var string 234 * @Assert\NotBlank() 235 */ 236 #[NotBlank] 237 private string $private, 238 ) { 239 } 240} 241 242class ConstructorPropertyPromotionSingleLineDocblockIncorrectIndent 243{ 244 public function __construct( 245 /** @var string */ 246 public string $public, 247 /** @var string */ 248 private string $private, 249 ) { 250 } 251} 252 253class ConstructorPropertyPromotionMultiLineDocblockAndAttributeIncorrectIndent 254{ 255 public function __construct( 256 /** 257 * @var string 258 * @Assert\NotBlank() 259 */ 260 public string $public, 261 /** 262 * @var string 263 * @Assert\NotBlank() 264 */ 265 #[NotBlank] 266 private string $private, 267 ) { 268 } 269} 270