|
163 | 163 | </rule>
|
164 | 164 | <!-- Require usage of ::class instead of __CLASS__, get_class(), get_class($this), get_called_class() and get_parent_class() -->
|
165 | 165 | <rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference"/>
|
| 166 | + <!-- Require usage of constructor property promotion --> |
| 167 | + <rule ref="SlevomatCodingStandard.Classes.RequireConstructorPropertyPromotion"/> |
166 | 168 | <!-- Forbid uses of multiple traits separated by comma -->
|
167 | 169 | <rule ref="SlevomatCodingStandard.Classes.TraitUseDeclaration"/>
|
168 | 170 | <!-- Require no spaces before trait use, between trait uses and one space after trait uses -->
|
|
174 | 176 | <property name="linesCountBetweenUses" value="0"/>
|
175 | 177 | </properties>
|
176 | 178 | </rule>
|
177 |
| - <!-- Forbid dead code --> |
178 |
| - <rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements"/> |
179 | 179 | <!-- Require specific order of phpDoc annotations with empty newline between specific groups -->
|
180 | 180 | <rule ref="SlevomatCodingStandard.Commenting.DocCommentSpacing">
|
181 | 181 | <properties>
|
|
306 | 306 | <exclude name="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing.IncorrectLinesCountBeforeControlStructure" />
|
307 | 307 | <exclude name="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing.IncorrectLinesCountBeforeFirstControlStructure" />
|
308 | 308 | <properties>
|
309 |
| - <property name="tokensToCheck" type="array"> |
310 |
| - <element value="T_IF" /> |
311 |
| - <element value="T_DO" /> |
312 |
| - <element value="T_WHILE" /> |
313 |
| - <element value="T_FOR" /> |
314 |
| - <element value="T_FOREACH" /> |
315 |
| - <element value="T_SWITCH" /> |
316 |
| - <element value="T_TRY" /> |
317 |
| - <element value="T_DEFAULT" /> |
| 309 | + <property name="controlStructures" type="array"> |
| 310 | + <element value="if" /> |
| 311 | + <element value="do" /> |
| 312 | + <element value="while" /> |
| 313 | + <element value="for" /> |
| 314 | + <element value="foreach" /> |
| 315 | + <element value="switch" /> |
| 316 | + <element value="try" /> |
| 317 | + <element value="default" /> |
318 | 318 | </property>
|
319 | 319 | </properties>
|
320 | 320 | </rule>
|
|
329 | 329 | <!-- Require consistent spacing for jump statements -->
|
330 | 330 | <rule ref="SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing">
|
331 | 331 | <properties>
|
332 |
| - <property name="tokensToCheck" type="array"> |
333 |
| - <element value="T_RETURN" /> |
334 |
| - <element value="T_THROW" /> |
335 |
| - <element value="T_YIELD" /> |
336 |
| - <element value="T_YIELD_FROM" /> |
| 332 | + <property name="jumpStatements" type="array"> |
| 333 | + <element value="return" /> |
| 334 | + <element value="throw" /> |
| 335 | + <element value="yield" /> |
| 336 | + <element value="yield_from" /> |
337 | 337 | </property>
|
338 | 338 | </properties>
|
339 | 339 | </rule>
|
|
343 | 343 | <rule ref="SlevomatCodingStandard.ControlStructures.NewWithParentheses"/>
|
344 | 344 | <!-- Require usage of null coalesce operator when possible -->
|
345 | 345 | <rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator"/>
|
| 346 | + <!-- Require usage of null safe object operator when possible --> |
| 347 | + <rule ref="SlevomatCodingStandard.ControlStructures.RequireNullSafeObjectOperator"/> |
346 | 348 | <!-- Forbid usage of conditions when a simple return can be used -->
|
347 | 349 | <rule ref="SlevomatCodingStandard.ControlStructures.UselessIfConditionWithReturn"/>
|
348 | 350 | <!-- Forbid usage of boolean-only ternary operator usage (e.g. $foo ? true : false) -->
|
|
351 | 353 | <rule ref="SlevomatCodingStandard.Exceptions.DeadCatch"/>
|
352 | 354 | <!-- Require using Throwable instead of Exception -->
|
353 | 355 | <rule ref="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly"/>
|
| 356 | + <!-- Require non-capturing catch when the variable with exception is not used --> |
| 357 | + <rule ref="SlevomatCodingStandard.Exceptions.RequireNonCapturingCatch"/> |
354 | 358 | <!-- Require closures not referencing $this be static -->
|
355 | 359 | <rule ref="SlevomatCodingStandard.Functions.StaticClosure"/>
|
356 | 360 | <!-- Require calls to PHP functions that have a `$strict` parameter to always set that to `true` -->
|
357 | 361 | <rule ref="SlevomatCodingStandard.Functions.StrictCall"/>
|
| 362 | + <!-- Require trailing commas in multi-line declarations --> |
| 363 | + <rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration"/> |
358 | 364 | <!-- Forbid unused variables passed to closures via `use` -->
|
359 | 365 | <rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure"/>
|
360 | 366 | <!-- Check the formatting of "fn" arrow functions -->
|
|
426 | 432 | <rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
|
427 | 433 | <properties>
|
428 | 434 | <property
|
429 |
| - name="newlinesCountBetweenOpenTagAndDeclare" |
430 |
| - value="2" |
| 435 | + name="declareOnFirstLine" |
| 436 | + value="false" |
| 437 | + /> |
| 438 | + <property |
| 439 | + name="linesCountBeforeDeclare" |
| 440 | + value="1" |
431 | 441 | />
|
432 | 442 | <property
|
433 | 443 | name="spacesCountAroundEqualsSign"
|
434 | 444 | value="0"
|
435 | 445 | />
|
436 | 446 | <property
|
437 |
| - name="newlinesCountAfterDeclare" |
438 |
| - value="2" |
| 447 | + name="linesCountAfterDeclare" |
| 448 | + value="1" |
439 | 449 | />
|
440 | 450 | </properties>
|
441 | 451 | </rule>
|
|
489 | 499 | </property>
|
490 | 500 | </properties>
|
491 | 501 | </rule>
|
| 502 | + <rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat"> |
| 503 | + <properties> |
| 504 | + <property name="withSpaces" value="no"/> |
| 505 | + <property name="shortNullable" value="no"/> |
| 506 | + <property name="nullPosition" value="last"/> |
| 507 | + </properties> |
| 508 | + </rule> |
492 | 509 | <!-- Forbid useless @var for constants -->
|
493 | 510 | <rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint"/>
|
494 | 511 | <!-- Forbid useless phpDocs for functions -->
|
|
0 commit comments