Skip to content

Commit

Permalink
Added to documentation and tests that api can be used instead of `p…
Browse files Browse the repository at this point in the history
…salm-api`
  • Loading branch information
ygottschalk committed Mar 20, 2023
1 parent a4895c3 commit 85a1c83
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/annotating_code/supported_annotations.md
Expand Up @@ -642,7 +642,7 @@ function (): Generator {
```
This annotation supports only generic types, meaning that e.g. `@psalm-yield string` would be ignored.

### `@psalm-api`
### `@api`, `@psalm-api`

Used to tell Psalm that a class or method is used, even if no references to it can be
found. Unused issues will be suppressed.
Expand Down
17 changes: 17 additions & 0 deletions tests/UnusedCodeTest.php
Expand Up @@ -1277,6 +1277,23 @@ public function b(): void {}
new A;
PHP,
],
'api with unused class' => [
'code' => <<<'PHP'
<?php
/** @api */
class A {}
PHP,
],
'api on unused public method' => [
'code' => <<<'PHP'
<?php
class A {
/** @api */
public function b(): void {}
}
new A;
PHP,
],
];
}

Expand Down

0 comments on commit 85a1c83

Please sign in to comment.