mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
parent
381a23bd4e
commit
007ffaecd8
@ -476,6 +476,7 @@ class Functions
|
||||
'date_default_timezone_set', 'assert_options', 'setlocale',
|
||||
'set_exception_handler', 'set_time_limit', 'putenv', 'spl_autoload_register',
|
||||
'spl_autoload_unregister', 'microtime', 'array_rand', 'set_include_path',
|
||||
'array_pop',
|
||||
|
||||
// logging
|
||||
'openlog', 'syslog', 'error_log', 'define_syslog_variables',
|
||||
|
@ -902,6 +902,30 @@ class PureAnnotationTest extends TestCase
|
||||
',
|
||||
'error_message' => 'ImpureFunctionCall',
|
||||
],
|
||||
'array_popIsNotMutationFree' => [
|
||||
'code' => <<<'PHP'
|
||||
<?php
|
||||
class Stack
|
||||
{
|
||||
/** @var array<string> */
|
||||
private array $stack = [];
|
||||
|
||||
public function push(string $item): void
|
||||
{
|
||||
$this->stack[] = $item;
|
||||
}
|
||||
|
||||
/** @psalm-mutation-free */
|
||||
public function next(): string|null
|
||||
{
|
||||
return array_pop($this->stack);
|
||||
}
|
||||
}
|
||||
PHP,
|
||||
'error_message' => 'ImpureFunctionCall',
|
||||
'ignored_issues' => [],
|
||||
'php_version' => '8.0',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user