Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.2 attributes moved to 8.2 stub #9445

Merged
merged 2 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 0 additions & 11 deletions stubs/CoreGenericClasses.phpstub
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
}
12 changes: 12 additions & 0 deletions stubs/Php82.phpstub
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
}
}
8 changes: 8 additions & 0 deletions tests/AttributeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ public function getIterator()
class Foo
{}
',
'assertions' => [],
'ignored_issues' => [],
'php_version' => '8.2',
],
'sensitiveParameter' => [
'code' => '<?php
Expand All @@ -277,6 +280,9 @@ public function __construct(
) {}
}
',
'assertions' => [],
'ignored_issues' => [],
'php_version' => '8.2',
],
'createObjectAsAttributeArg' => [
'code' => '<?php
Expand Down Expand Up @@ -801,6 +807,8 @@ public function __construct(
}
',
'error_message' => 'Attribute SensitiveParameter cannot be used on a method',
'ignored_issues' => [],
'php_version' => '8.2',
],
];
}
Expand Down
3 changes: 1 addition & 2 deletions tests/TraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Psalm\Tests;

use Psalm\Issue\ConstantDeclarationInTrait;
use Psalm\Tests\Traits\InvalidCodeAnalysisTestTrait;
use Psalm\Tests\Traits\ValidCodeAnalysisTestTrait;

Expand Down Expand Up @@ -1233,7 +1232,7 @@ class X {
<?php
trait A { const B = 0; }
PHP,
'error_message' => ConstantDeclarationInTrait::getIssueType(),
'error_message' => 'ConstantDeclarationInTrait',
'ignored_issues' => [],
'php_version' => '8.1',
],
Expand Down