mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Merge pull request #10734 from weirdan/override-attribute-in-pure-context
Allow `Override` attribute to be used in pure contexts
This commit is contained in:
commit
2b642804b7
@ -1,17 +1,20 @@
|
||||
<?php
|
||||
|
||||
/** @psalm-immutable */
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
final class AllowDynamicProperties
|
||||
{
|
||||
public function __construct() {}
|
||||
}
|
||||
|
||||
/** @psalm-immutable */
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
final class Override
|
||||
{
|
||||
public function __construct() {}
|
||||
}
|
||||
|
||||
/** @psalm-immutable */
|
||||
#[Attribute(Attribute::TARGET_PARAMETER)]
|
||||
final class SensitiveParameter
|
||||
{
|
||||
|
@ -68,6 +68,23 @@ class OverrideTest extends TestCase
|
||||
'ignored_issues' => [],
|
||||
'php_version' => '8.3',
|
||||
],
|
||||
'canBeUsedOnPureMethods' => [
|
||||
'code' => <<<'PHP'
|
||||
<?php
|
||||
class A {
|
||||
/** @psalm-pure */
|
||||
public function f(): void {}
|
||||
}
|
||||
class B extends A {
|
||||
/** @psalm-pure */
|
||||
#[Override]
|
||||
public function f(): void {}
|
||||
}
|
||||
PHP,
|
||||
'assertions' => [],
|
||||
'ignored_issues' => [],
|
||||
'php_version' => '8.3',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user