1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Make it easier to find how to promote Trace

I have used this once before then forgot how to do it, which is a shame
because this is super handy.
This commit is contained in:
Grégoire Paris 2023-04-26 21:38:44 +02:00
parent c059388274
commit 09dd8c370f
No known key found for this signature in database
GPG Key ID: 24D48B8012B116BF
2 changed files with 15 additions and 3 deletions

View File

@ -446,7 +446,18 @@ $username = $_GET['username']; // prints something like "test.php:4 $username: m
```
*Note*: it throws [special low-level issue](../running_psalm/issues/Trace.md), so you have to set errorLevel to 1, override it in config or invoke Psalm with `--show-info=true`.
*Note*: it throws [special low-level issue](../running_psalm/issues/Trace.md).
To see it, you can set the global `errorLevel` to 1, or invoke Psalm with
`--show-info=true`, but both these solutions will probably result in a lot of
output. Another solution is to selectively bump the error level of the issue,
so that you only get one more error:
```xml
<!-- psalm.xml -->
<issueHandlers>
<Trace errorLevel="error"/>
</issueHandlers>
```
### `@psalm-check-type`
@ -596,7 +607,7 @@ class Foo
}
```
When Psalm encounters variable property, it treats all properties in given class as potentially referenced.
With `@psalm-ignore-variable-property` annotation, this reference is ignored.
With `@psalm-ignore-variable-property` annotation, this reference is ignored.
While `PossiblyUnusedProperty` would be emitted in both cases, using `@psalm-ignore-variable-property`
would allow [Psalter](../manipulating_code/fixing.md) to delete `Foo::$bar`.

View File

@ -1,6 +1,7 @@
# Trace
Not really an issue. Just reports type of the variable.
Not really an issue. Just reports the type of a variable when using
[`@psalm-trace`](../annotating_code/supported_annotations.md#psalm-trace).
```php
<?php