Skip to content
Open
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
8 changes: 4 additions & 4 deletions src/Rules/Debug/DumpNativeTypeRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ public function processNode(Node $node, Scope $scope): array
return [];
}

$functionName = $this->reflectionProvider->resolveFunctionName($node->name, $scope);
if ($functionName === null) {
if (count($node->getArgs()) === 0) {
return [];
}

if (strtolower($functionName) !== 'phpstan\dumpnativetype') {
$functionName = $this->reflectionProvider->resolveFunctionName($node->name, $scope);
if ($functionName === null) {
return [];
}

if (count($node->getArgs()) === 0) {
if (strtolower($functionName) !== 'phpstan\dumpnativetype') {
return [];
}

Expand Down
8 changes: 4 additions & 4 deletions src/Rules/Debug/DumpPhpDocTypeRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ public function processNode(Node $node, Scope $scope): array
return [];
}

$functionName = $this->reflectionProvider->resolveFunctionName($node->name, $scope);
if ($functionName === null) {
if (count($node->getArgs()) === 0) {
return [];
}

if (strtolower($functionName) !== 'phpstan\dumpphpdoctype') {
$functionName = $this->reflectionProvider->resolveFunctionName($node->name, $scope);
if ($functionName === null) {
return [];
}

if (count($node->getArgs()) === 0) {
if (strtolower($functionName) !== 'phpstan\dumpphpdoctype') {
return [];
}

Expand Down
8 changes: 4 additions & 4 deletions src/Rules/Debug/DumpTypeRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ public function processNode(Node $node, Scope $scope): array
return [];
}

$functionName = $this->reflectionProvider->resolveFunctionName($node->name, $scope);
if ($functionName === null) {
if (count($node->getArgs()) === 0) {
return [];
}

if (strtolower($functionName) !== 'phpstan\dumptype') {
$functionName = $this->reflectionProvider->resolveFunctionName($node->name, $scope);
if ($functionName === null) {
return [];
}

if (count($node->getArgs()) === 0) {
if (strtolower($functionName) !== 'phpstan\dumptype') {
return [];
}

Expand Down
28 changes: 8 additions & 20 deletions src/Rules/Debug/FileAssertRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public function processNode(Node $node, Scope $scope): array
return [];
}

if (count($node->getArgs()) !== 2) {
return [];
}

if (!$this->reflectionProvider->hasFunction($node->name, $scope)) {
return [];
}
Expand All @@ -67,15 +71,11 @@ public function processNode(Node $node, Scope $scope): array
}

/**
* @param Node\Arg[] $args
* @param array{Node\Arg, Node\Arg} $args
* @return list<IdentifierRuleError>
*/
private function processAssertType(array $args, Scope $scope): array
{
if (count($args) !== 2) {
return [];
}

$expectedTypeStrings = $scope->getType($args[0]->value)->getConstantStrings();
if (count($expectedTypeStrings) !== 1) {
return [
Expand All @@ -100,15 +100,11 @@ private function processAssertType(array $args, Scope $scope): array
}

/**
* @param Node\Arg[] $args
* @param array{Node\Arg, Node\Arg} $args
* @return list<IdentifierRuleError>
*/
private function processAssertNativeType(array $args, Scope $scope): array
{
if (count($args) !== 2) {
return [];
}

$expectedTypeStrings = $scope->getNativeType($args[0]->value)->getConstantStrings();
if (count($expectedTypeStrings) !== 1) {
return [
Expand All @@ -133,15 +129,11 @@ private function processAssertNativeType(array $args, Scope $scope): array
}

/**
* @param Node\Arg[] $args
* @param array{Node\Arg, Node\Arg} $args
* @return list<IdentifierRuleError>
*/
private function processAssertSuperType(array $args, Scope $scope): array
{
if (count($args) !== 2) {
return [];
}

$expectedTypeStrings = $scope->getType($args[0]->value)->getConstantStrings();
if (count($expectedTypeStrings) !== 1) {
return [
Expand All @@ -167,15 +159,11 @@ private function processAssertSuperType(array $args, Scope $scope): array
}

/**
* @param Node\Arg[] $args
* @param array{Node\Arg, Node\Arg} $args
* @return list<IdentifierRuleError>
*/
private function processAssertVariableCertainty(array $args, Scope $scope): array
{
if (count($args) !== 2) {
return [];
}

$certainty = $args[0]->value;
if (!$certainty instanceof StaticCall) {
return [
Expand Down
Loading