Skip to content

Commit

Permalink
Merge pull request #8436 from TimWolla/attribute-target
Browse files Browse the repository at this point in the history
Configure a correct attribute target in stubs/CoreGenericClasses.phpstub
  • Loading branch information
AndrolGenhald authored Aug 24, 2022
2 parents 88d3382 + 3c2018a commit 2fdcd5a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
6 changes: 3 additions & 3 deletions stubs/CoreGenericClasses.phpstub
Original file line number Diff line number Diff line change
Expand Up @@ -496,19 +496,19 @@ final class WeakMap implements ArrayAccess, Countable, IteratorAggregate, Traver
}


#[Attribute]
#[Attribute(Attribute::TARGET_METHOD)]
final class ReturnTypeWillChange
{
public function __construct() {}
}

#[Attribute]
#[Attribute(Attribute::TARGET_PARAMETER)]
final class SensitiveParameter
{
public function __construct() {}
}

#[Attribute]
#[Attribute(Attribute::TARGET_CLASS)]
final class AllowDynamicProperties
{
public function __construct() {}
Expand Down
16 changes: 16 additions & 0 deletions tests/AttributeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,22 @@ public function anotherMethod(): string
false,
'8.1',
],
'sensitiveParameterOnMethod' => [
'<?php
namespace SensitiveParameter;
use SensitiveParameter;
class HelloWorld {
#[SensitiveParameter]
public function __construct(
string $password
) {}
}
',
'error_message' => 'Attribute SensitiveParameter cannot be used on a method',
],
];
}
}

0 comments on commit 2fdcd5a

Please sign in to comment.