mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix #2114 - make builtin constructors mutation free
This commit is contained in:
parent
fdbea45534
commit
ae46c9e132
@ -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());
|
||||
|
||||
|
@ -155,6 +155,17 @@ class PureAnnotationTest extends TestCase
|
||||
return \array_map(function(string $s) { return $s;}, $arr);
|
||||
}'
|
||||
],
|
||||
'pureBuiltinCall' => [
|
||||
'<?php
|
||||
final class Date
|
||||
{
|
||||
/** @psalm-pure */
|
||||
public static function timeZone(string $tzString) : DateTimeZone
|
||||
{
|
||||
return new \DateTimeZone($tzString);
|
||||
}
|
||||
}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user