Skip to content

Commit

Permalink
Add a stub file for Attributes defined by PHP
Browse files Browse the repository at this point in the history
  • Loading branch information
robchett committed Jun 17, 2023
1 parent eb64a47 commit 5fc48bb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/Psalm/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2236,6 +2236,8 @@ public function visitStubFiles(Codebase $codebase, ?Progress $progress = null):
];

if ($codebase->analysis_php_version_id >= 8_00_00) {
$stringable_path = $dir_lvl_2 . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'CoreGenericAttributes.phpstub';
$this->internal_stubs[] = $stringable_path;
$stringable_path = $dir_lvl_2 . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'Php80.phpstub';
$this->internal_stubs[] = $stringable_path;
}
Expand Down
13 changes: 13 additions & 0 deletions stubs/CoreGenericAttributes.phpstub
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

#[Attribute(Attribute::TARGET_CLASS)]
final class AllowDynamicProperties
{
public function __construct() {}
}

#[Attribute(Attribute::TARGET_PARAMETER)]
final class SensitiveParameter
{
public function __construct() {}
}
12 changes: 0 additions & 12 deletions stubs/Php82.phpstub
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,6 @@ namespace {
public function getIterator(): Iterator {}
}

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

#[Attribute(Attribute::TARGET_CLASS)]
final class AllowDynamicProperties
{
public function __construct() {}
}

/**
* @psalm-pure
* @param positive-int $length
Expand Down

0 comments on commit 5fc48bb

Please sign in to comment.