Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Eventjet/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,6 @@
<!-- Require new instances with parentheses -->
<rule ref="SlevomatCodingStandard.ControlStructures.NewWithParentheses"/>

<!-- Forbid usage of conditions when a simple return can be used -->
<rule ref="SlevomatCodingStandard.ControlStructures.UselessIfConditionWithReturn"/>

<!-- Forbid unused variables passed to closures via `use` -->
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure"/>

Expand Down
1 change: 0 additions & 1 deletion php-cs-fixer-rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@
'phpdoc_var_annotation_correct_order' => false,
'php_unit_data_provider_static' => true,
'self_accessor' => true,
'simplified_if_return' => true,
'single_quote' => true,
'single_space_around_construct' => true,
// Loose comparison is lint territory — PHPStan and Psalm both flag it. Kept
Expand Down
11 changes: 0 additions & 11 deletions tests/fixtures/invalid/useless-if-with-return.php

This file was deleted.

22 changes: 22 additions & 0 deletions tests/fixtures/valid/useless-if-with-return.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

// The `if (cond) { return true; } return false;` shape is allowed — the rules
// that would collapse it (`SlevomatCodingStandard.ControlStructures.UselessIfConditionWithReturn`
// and `simplified_if_return`) are off. The pattern is useful in functions
// where several branches each return a boolean: collapsing only the last
// branch would make it visually inconsistent with the ones above it.
function canProceed(int $value, bool $locked): bool
{
if ($locked) {
return false;
}
if ($value < 0) {
return false;
}
if ($value > 0) {
return true;
}
return false;
}
Loading