Skip to content

Commit

Permalink
[Strict] Skip docblock on BooleanInBooleanNotRuleFixerRector (#4640)
Browse files Browse the repository at this point in the history
* [Strict] Skip docblock on BooleanInBooleanNotRuleFixerRector

* Fixed 🎉

* Fixed 🎉
  • Loading branch information
samsonasik committed Aug 3, 2023
1 parent 8f6b366 commit 8ffacac
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace Rector\Tests\Strict\Rector\BooleanNot\BooleanInBooleanNotRuleFixerRector\Fixture;

final class SkipDocblock
{
/**
* @param null|string $value
*/
public function run($value)
{
if (!$value) {
return 'empty';
}

return 'full';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ namespace Rector\Tests\Strict\Rector\BooleanNot\BooleanInBooleanNotRuleFixerRect

final class UnionWithNull
{
/**
* @var string|null
*/
private $value;
private string|null $value = null;

public function run()
{
Expand All @@ -31,10 +28,7 @@ namespace Rector\Tests\Strict\Rector\BooleanNot\BooleanInBooleanNotRuleFixerRect

final class UnionWithNull
{
/**
* @var string|null
*/
private $value;
private string|null $value = null;

public function run()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ namespace Rector\Tests\Strict\Rector\BooleanNot\BooleanInBooleanNotRuleFixerRect

final class UnionWithNull
{
/**
* @var string|null
*/
private $value;
private string|null $value = null;

public function run()
{
Expand All @@ -31,10 +28,7 @@ namespace Rector\Tests\Strict\Rector\BooleanNot\BooleanInBooleanNotRuleFixerRect

final class UnionWithNull
{
/**
* @var string|null
*/
private $value;
private string|null $value = null;

public function run()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function getNodeTypes(): array
*/
public function refactorWithScope(Node $node, Scope $scope): ?Expr
{
$exprType = $scope->getType($node->expr);
$exprType = $scope->getNativeType($node->expr);
if ($exprType->isBoolean()->yes()) {
return null;
}
Expand Down

0 comments on commit 8ffacac

Please sign in to comment.