1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

[TASK] Update documentation (#5163)

* [TASK] Fix code highlighting in documentation

* [TASK] Document stubs.file.preloadClasses configuration
This commit is contained in:
Oliver Hader 2021-02-07 04:04:44 +01:00 committed by GitHub
parent 343d020408
commit 56b7cb2423
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

View File

@ -399,7 +399,21 @@ Optional. Do you use mock classes in your tests? If you want Psalm to ignore the
Optional. Do you have objects with properties that cannot be determined statically? If you want Psalm to treat all properties on a given classlike as mixed, include a fully-qualified path to the class with `<class name="Your\Namespace\ClassName" />`. By default, `stdClass` and `SimpleXMLElement` are configured to be universal object crates.
#### &lt;stubs&gt;
Optional. If your codebase uses classes and functions that are not visible to Psalm via reflection (e.g. if there are internal packages that your codebase relies on that are not available on the machine running Psalm), you can use stub files. Used by PhpStorm (a popular IDE) and others, stubs provide a description of classes and functions without the implementations. You can find a list of stubs for common classes [here](https://github.com/JetBrains/phpstorm-stubs). List out each file with `<file name="path/to/file.php" />`.
Optional. If your codebase uses classes and functions that are not visible to Psalm via reflection
(e.g. if there are internal packages that your codebase relies on that are not available on the machine running Psalm),
you can use stub files. Used by PhpStorm (a popular IDE) and others, stubs provide a description of classes and
functions without the implementations.
You can find a list of stubs for common classes [here](https://github.com/JetBrains/phpstorm-stubs).
List out each file with `<file name="path/to/file.php" />`. In case classes to be tested use parent classes
or interfaces defined in a stub file, this stub should be configured with attribute `preloadClasses="true"`.
```xml
<stubs>
<file name="path/to/file.php" />
<file name="path/to/abstract-class.php" preloadClasses="true" />
</stubs>
```
#### &lt;ignoreExceptions&gt;
Optional. A list of exceptions to not report for `checkForThrowsDocblock` or `checkForThrowsInGlobalScope`. If an exception has `onlyGlobalScope` set to `true`, only `checkForThrowsInGlobalScope` is ignored for that exception, e.g.

View File

@ -33,6 +33,7 @@ is considered secure. Only in case function argument `$escape` is true, the corr
`@psalm-taint-escape` is applied for taint type `html` .
```php
<?php
/**
* @param string $str
* @param bool $escape

View File

@ -9,6 +9,7 @@ You can use the annotation `@psalm-taint-source <taint-type>` to indicate a func
In the below example the `input` taint type is specified as a standin for input taints as defined in [Psalm\Type\TaintKindGroup](https://github.com/vimeo/psalm/blob/master/src/Psalm/Type/TaintKindGroup.php).
```php
<?php
/**
* @psalm-taint-source input
*/