mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Fix capitalisation
This commit is contained in:
parent
8a0776c8e5
commit
8c2f1d7683
@ -34,7 +34,7 @@ Configuration file may be split into several files using [XInclude](https://www.
|
||||
```
|
||||
|
||||
|
||||
## Optional `<psalm />` attributes
|
||||
## Optional <psalm /> attributes
|
||||
|
||||
### Coding style
|
||||
|
||||
@ -253,7 +253,7 @@ When `true`, Psalm will attempt to find all unused code (including unused variab
|
||||
loadXdebugStub="[bool]"
|
||||
>
|
||||
```
|
||||
If not present, Psalm will only load the Xdebug stub if psalm has unloaded the extension.
|
||||
If not present, Psalm will only load the Xdebug stub if Psalm has unloaded the extension.
|
||||
When `true`, Psalm will load the Xdebug extension stub (as the extension is unloaded when Psalm runs).
|
||||
Setting to `false` prevents the stub from loading.
|
||||
|
||||
@ -271,7 +271,7 @@ When `true`, Psalm will complain when referencing an explicit string offset on a
|
||||
phpVersion="[string]"
|
||||
>
|
||||
```
|
||||
Set the php version psalm should assume when checking and/or fixing the project. If this attribute is not set, psalm uses the declaration in `composer.json` if one is present. It will check against the earliest version of PHP that satisfies the declared `php` dependency
|
||||
Set the php version Psalm should assume when checking and/or fixing the project. If this attribute is not set, Psalm uses the declaration in `composer.json` if one is present. It will check against the earliest version of PHP that satisfies the declared `php` dependency
|
||||
|
||||
This can be overridden on the command-line using the `--php-version=` flag which takes the highest precedence over both the `phpVersion` setting and the version derived from `composer.json`.
|
||||
|
||||
@ -284,7 +284,7 @@ This can be overridden on the command-line using the `--php-version=` flag which
|
||||
|
||||
When `true`, Psalm will skip checking classes, variables and functions after it comes across an `include` or `require` it cannot resolve. This allows code to reference functions and classes unknown to Psalm.
|
||||
|
||||
For backwards compatibility, this defaults to `true`, but if you do not rely on dynamically generated includes to cause classes otherwise unknown to psalm to come into existence, it's recommended you set this to `false` in order to reliably detect errors that would be fatal to PHP at runtime.
|
||||
For backwards compatibility, this defaults to `true`, but if you do not rely on dynamically generated includes to cause classes otherwise unknown to Psalm to come into existence, it's recommended you set this to `false` in order to reliably detect errors that would be fatal to PHP at runtime.
|
||||
|
||||
### Running Psalm
|
||||
|
||||
|
@ -185,9 +185,9 @@ new TNamedObject('Foo\Bar\SomeClass')
|
||||
Types within Psalm are always wrapped in a union as a convenience feature. Almost anywhere you may expect a type, you can get a union as well (property types, return types, argument types, etc). So wrapping a single atomic type (like TInt) in a union container allows to uniformly handle that type elsewhere, without repetitive checks like this:
|
||||
|
||||
``` php
|
||||
if ($type instanceof Union)
|
||||
foreach ($types->getTypes() as $atomic)
|
||||
handleAtomic($atomic);
|
||||
if ($type instanceof Union)
|
||||
foreach ($types->getTypes() as $atomic)
|
||||
handleAtomic($atomic);
|
||||
else handleAtomic($type);
|
||||
|
||||
// with union container it becomes
|
||||
@ -208,7 +208,7 @@ More complex types can be constructed as follows. The following represents an as
|
||||
'key_3' => new Union([new TBool()])])]);
|
||||
```
|
||||
|
||||
The Type object includes some static helper methods, which automatically wrap the type in a Union. Thus this can be written more tersely:
|
||||
The Type object includes some static helper methods, which automatically wrap the type in a Union. Thus this can be written more tersely:
|
||||
|
||||
``` php
|
||||
new Union([
|
||||
@ -228,6 +228,6 @@ Another way of creating these instances is to use the class `Psalm\Type` which i
|
||||
\Psalm\Type::parseString('int|null');
|
||||
```
|
||||
|
||||
You can find how psalm would represent a given type as objects, by specifying the type as an input to this function, and calling `var_dump` on the result.
|
||||
You can find how Psalm would represent a given type as objects, by specifying the type as an input to this function, and calling `var_dump` on the result.
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user