Skip to content

Commit

Permalink
Revert "Passing a variable by reference to a function and method has …
Browse files Browse the repository at this point in the history
…side effects"

This reverts commit 1070788.
  • Loading branch information
ondrejmirtes committed Jan 8, 2023
1 parent 35e4813 commit 705d0f8
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 91 deletions.
8 changes: 0 additions & 8 deletions src/Reflection/Annotations/AnnotationMethodReflection.php
Expand Up @@ -113,14 +113,6 @@ public function hasSideEffects(): TrinaryLogic
return TrinaryLogic::createYes();
}

foreach ($this->getVariants() as $variant) {
foreach ($variant->getParameters() as $parameter) {
if ($parameter->passedByReference()->yes()) {
return TrinaryLogic::createYes();
}
}
}

return TrinaryLogic::createMaybe();
}

Expand Down
7 changes: 0 additions & 7 deletions src/Reflection/Native/NativeFunctionReflection.php
Expand Up @@ -81,13 +81,6 @@ public function hasSideEffects(): TrinaryLogic
if ($this->isVoid()) {
return TrinaryLogic::createYes();
}
foreach ($this->variants as $variant) {
foreach ($variant->getParameters() as $parameter) {
if ($parameter->passedByReference()->yes()) {
return TrinaryLogic::createYes();
}
}
}

return $this->hasSideEffects;
}
Expand Down
7 changes: 0 additions & 7 deletions src/Reflection/Native/NativeMethodReflection.php
Expand Up @@ -136,13 +136,6 @@ public function hasSideEffects(): TrinaryLogic
) {
return TrinaryLogic::createYes();
}
foreach ($this->variants as $variant) {
foreach ($variant->getParameters() as $parameter) {
if ($parameter->passedByReference()->yes()) {
return TrinaryLogic::createYes();
}
}
}

return $this->hasSideEffects;
}
Expand Down
7 changes: 0 additions & 7 deletions src/Reflection/Php/PhpFunctionFromParserNodeReflection.php
Expand Up @@ -199,13 +199,6 @@ public function hasSideEffects(): TrinaryLogic
if ($this->isPure !== null) {
return TrinaryLogic::createFromBoolean(!$this->isPure);
}
foreach ($this->getVariants() as $variant) {
foreach ($variant->getParameters() as $parameter) {
if ($parameter->passedByReference()->yes()) {
return TrinaryLogic::createYes();
}
}
}

return TrinaryLogic::createMaybe();
}
Expand Down
7 changes: 0 additions & 7 deletions src/Reflection/Php/PhpFunctionReflection.php
Expand Up @@ -245,13 +245,6 @@ public function hasSideEffects(): TrinaryLogic
if ($this->isPure !== null) {
return TrinaryLogic::createFromBoolean(!$this->isPure);
}
foreach ($this->getVariants() as $variant) {
foreach ($variant->getParameters() as $parameter) {
if ($parameter->passedByReference()->yes()) {
return TrinaryLogic::createYes();
}
}
}

return TrinaryLogic::createMaybe();
}
Expand Down
7 changes: 0 additions & 7 deletions src/Reflection/Php/PhpMethodReflection.php
Expand Up @@ -416,13 +416,6 @@ public function hasSideEffects(): TrinaryLogic
if ($this->isPure !== null) {
return TrinaryLogic::createFromBoolean(!$this->isPure);
}
foreach ($this->getVariants() as $variant) {
foreach ($variant->getParameters() as $parameter) {
if ($parameter->passedByReference()->yes()) {
return TrinaryLogic::createYes();
}
}
}

return TrinaryLogic::createMaybe();
}
Expand Down
1 change: 0 additions & 1 deletion tests/PHPStan/Analyser/NodeScopeResolverTest.php
Expand Up @@ -1171,7 +1171,6 @@ public function dataFileAsserts(): iterable
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-8635.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-8625.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-8621.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-8084.php');
}

/**
Expand Down
20 changes: 0 additions & 20 deletions tests/PHPStan/Analyser/data/bug-8084.php

This file was deleted.

8 changes: 0 additions & 8 deletions tests/PHPStan/Rules/Variables/NullCoalesceRuleTest.php
Expand Up @@ -360,12 +360,4 @@ public function testBug7968(): void
$this->analyse([__DIR__ . '/data/bug-7968.php'], []);
}

public function testBug8084(): void
{
$this->treatPhpDocTypesAsCertain = true;
$this->strictUnnecessaryNullsafePropertyFetch = true;

$this->analyse([__DIR__ . '/data/bug-8084.php'], []);
}

}
19 changes: 0 additions & 19 deletions tests/PHPStan/Rules/Variables/data/bug-8084.php

This file was deleted.

0 comments on commit 705d0f8

Please sign in to comment.