mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
parent
b49444b8ad
commit
a1ea5c38c2
@ -627,8 +627,8 @@ class AssignmentAnalyzer
|
||||
$method_pure_compatible = !empty($assign_var->var->inferredType->external_mutation_free)
|
||||
|| isset($assign_var->var->pure);
|
||||
|
||||
if (($context->mutation_free
|
||||
|| ($context->external_mutation_free && !$method_pure_compatible))
|
||||
if (($context->mutation_free || $context->external_mutation_free)
|
||||
&& !$method_pure_compatible
|
||||
&& !$context->collect_mutations
|
||||
&& !$context->collect_initializations
|
||||
) {
|
||||
|
@ -125,9 +125,6 @@ class ImmutableAnnotationTest extends TestCase
|
||||
$this->bar = $bar;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-external-mutation-free
|
||||
*/
|
||||
public function withBar(string $bar): self {
|
||||
$new = new Foo("hello");
|
||||
/** @psalm-suppress InaccessibleProperty */
|
||||
@ -149,9 +146,6 @@ class ImmutableAnnotationTest extends TestCase
|
||||
$this->bar = $bar;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-external-mutation-free
|
||||
*/
|
||||
public function withBar(string $bar): self {
|
||||
$new = clone $this;
|
||||
/** @psalm-suppress InaccessibleProperty */
|
||||
@ -280,9 +274,6 @@ class ImmutableAnnotationTest extends TestCase
|
||||
$this->bar = $bar;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-external-mutation-free
|
||||
*/
|
||||
public function withBar(Bar $b): Bar {
|
||||
$new = clone $b;
|
||||
$b->a = $this->bar;
|
||||
|
Loading…
Reference in New Issue
Block a user