diff --git a/src/Psalm/Internal/Codebase/Reflection.php b/src/Psalm/Internal/Codebase/Reflection.php index fc30c134c..7e244f545 100644 --- a/src/Psalm/Internal/Codebase/Reflection.php +++ b/src/Psalm/Internal/Codebase/Reflection.php @@ -243,6 +243,7 @@ class Reflection $storage->is_static = $method->isStatic(); $storage->abstract = $method->isAbstract(); + $storage->mutation_free = $storage->external_mutation_free = $method_name === '__construct'; $declaring_method_id = $declaring_class->name . '::' . strtolower((string)$method->getName()); diff --git a/tests/PureAnnotationTest.php b/tests/PureAnnotationTest.php index e5f8d8a7a..140593cd2 100644 --- a/tests/PureAnnotationTest.php +++ b/tests/PureAnnotationTest.php @@ -155,6 +155,17 @@ class PureAnnotationTest extends TestCase return \array_map(function(string $s) { return $s;}, $arr); }' ], + 'pureBuiltinCall' => [ + '