1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Merge pull request #9445 from weirdan/8.2-attributes

PHP 8.2 attributes moved to 8.2 stub
This commit is contained in:
Bruce Weirdan 2023-03-03 05:27:01 -04:00 committed by GitHub
commit 3af9ccde91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 13 deletions

View File

@ -531,14 +531,3 @@ final class ReturnTypeWillChange
public function __construct() {}
}
#[Attribute(Attribute::TARGET_PARAMETER)]
final class SensitiveParameter
{
public function __construct() {}
}
#[Attribute(Attribute::TARGET_CLASS)]
final class AllowDynamicProperties
{
public function __construct() {}
}

View File

@ -33,4 +33,16 @@ namespace {
/** @psalm-return (Start is string ? Iterator<int, DateTime> : Iterator<int, Start>) */
public function getIterator(): Iterator {}
}
#[Attribute(Attribute::TARGET_PARAMETER)]
final class SensitiveParameter
{
public function __construct() {}
}
#[Attribute(Attribute::TARGET_CLASS)]
final class AllowDynamicProperties
{
public function __construct() {}
}
}

View File

@ -263,6 +263,9 @@ class AttributeTest extends TestCase
class Foo
{}
',
'assertions' => [],
'ignored_issues' => [],
'php_version' => '8.2',
],
'sensitiveParameter' => [
'code' => '<?php
@ -277,6 +280,9 @@ class AttributeTest extends TestCase
) {}
}
',
'assertions' => [],
'ignored_issues' => [],
'php_version' => '8.2',
],
'createObjectAsAttributeArg' => [
'code' => '<?php
@ -801,6 +807,8 @@ class AttributeTest extends TestCase
}
',
'error_message' => 'Attribute SensitiveParameter cannot be used on a method',
'ignored_issues' => [],
'php_version' => '8.2',
],
];
}

View File

@ -2,7 +2,6 @@
namespace Psalm\Tests;
use Psalm\Issue\ConstantDeclarationInTrait;
use Psalm\Tests\Traits\InvalidCodeAnalysisTestTrait;
use Psalm\Tests\Traits\ValidCodeAnalysisTestTrait;
@ -1233,7 +1232,7 @@ class TraitTest extends TestCase
<?php
trait A { const B = 0; }
PHP,
'error_message' => ConstantDeclarationInTrait::getIssueType(),
'error_message' => 'ConstantDeclarationInTrait',
'ignored_issues' => [],
'php_version' => '8.1',
],