-
-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[php74] Skip conditinal assign in RestoreDefaultNullToNullableTypePro…
…pertyRector as most likely desired to assign or fail
- Loading branch information
1 parent
7bb5384
commit 1250b2f
Showing
7 changed files
with
64 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\NodeDecorator; | ||
|
||
use PhpParser\Node\Stmt\ClassMethod; | ||
use PhpParser\Node\Stmt\Expression; | ||
use Rector\NodeTypeResolver\Node\AttributeKey; | ||
|
||
final class StatementDepthAttributeDecorator | ||
{ | ||
/** | ||
* @param ClassMethod[] $classMethods | ||
*/ | ||
public static function decorateClassMethods(array $classMethods): void | ||
{ | ||
foreach ($classMethods as $classMethod) { | ||
foreach ((array) $classMethod->stmts as $methodStmt) { | ||
$methodStmt->setAttribute(AttributeKey::IS_FIRST_LEVEL_STATEMENT, true); | ||
|
||
if ($methodStmt instanceof Expression) { | ||
$methodStmt->expr->setAttribute(AttributeKey::IS_FIRST_LEVEL_STATEMENT, true); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters