Skip to content

Commit

Permalink
Restore attributes in ClassConstantStorage
Browse files Browse the repository at this point in the history
This partially fixes BC break introduced in vimeo#7129
  • Loading branch information
weirdan committed Dec 26, 2021
1 parent 18c790e commit 08413d7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php
Expand Up @@ -1296,6 +1296,19 @@ private function visitClassConstDeclaration(
}

$constant_storage->description = $description;

foreach ($stmt->attrGroups as $attr_group) {
foreach ($attr_group->attrs as $attr) {
$constant_storage->attributes[] = AttributeResolver::resolve(
$this->codebase,
$this->file_scanner,
$this->file_storage,
$this->aliases,
$attr,
$this->storage->name ?? null
);
}
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/Psalm/Storage/ClassConstantStorage.php
Expand Up @@ -39,6 +39,12 @@ class ClassConstantStorage
*/
public $deprecated = false;

/**
* @var list<AttributeStorage>
* @psalm-suppress PossiblyUnusedProperty
*/
public $attributes = [];

/**
* @var ?string
*/
Expand Down

0 comments on commit 08413d7

Please sign in to comment.