Skip to content

Commit d55c5c4

Browse files
ArshidArshid
authored andcommitted
[php 8.3] Add json_validate rule
1 parent 22de000 commit d55c5c4

4 files changed

Lines changed: 16 additions & 13 deletions

File tree

phpunit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
colors="true"
77
executionOrder="defects"
88
defaultTestSuite="main"
9+
stopOnError="true"
910
displayDetailsOnTestsThatTriggerWarnings="true"
1011
displayDetailsOnPhpunitDeprecations="true"
1112
>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Rector\Tests\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector\Fixture;
4+
5+
final class SkipComplexAssign
6+
{
7+
private $name;
8+
9+
public function __construct($name)
10+
{
11+
$this->name = $name;
12+
}
13+
}

rules/Php83/Rector/BooleanAnd/JsonValidateRector.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
use PhpParser\Node\Expr\ConstFetch;
1313
use PhpParser\Node\Expr\FuncCall;
1414
use PhpParser\Node\Name;
15-
use PHPStan\Analyser\Scope;
1615
use Rector\NodeManipulator\BinaryOpManipulator;
17-
use Rector\NodeTypeResolver\Node\AttributeKey;
1816
use Rector\Php71\ValueObject\TwoNodeMatch;
1917
use Rector\PhpParser\Node\Value\ValueResolver;
2018
use Rector\Rector\AbstractRector;
@@ -89,14 +87,9 @@ public function refactor(Node $node): ?Node
8987
return null;
9088
}
9189

92-
$scope = $node->getAttribute(AttributeKey::SCOPE);
93-
if (! $scope instanceof Scope) {
94-
return null;
95-
}
96-
9790
$args = $funcCall->getArgs();
9891

99-
if ($args === []) {
92+
if (count($args) < 1 ){
10093
return null;
10194
}
10295

tests/bootstrap.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
require_once __DIR__ . '/../vendor/autoload.php';
88

99
// silent deprecations, since we test them
10-
// error_reporting(E_ALL ^ E_DEPRECATED);
11-
error_reporting(E_ALL);
12-
set_error_handler(function (int $severity, string $message, string $file, int $line): bool {
13-
throw new \ErrorException($message, 0, $severity, $file, $line);
14-
});
10+
error_reporting(E_ALL ^ E_DEPRECATED);
1511

1612
// performance boost
1713
gc_disable();

0 commit comments

Comments
 (0)