Composer Workspace global packages
This commit is contained in:
@@ -126,6 +126,19 @@ Optional keys can be denoted by a trailing `?`, e.g.:
|
||||
/** @return array{optional?: string, bar: int} */
|
||||
```
|
||||
|
||||
You can use "one-line" comments (similar to PHP), e.g:
|
||||
|
||||
```php
|
||||
/** @return array { // Array with comments.
|
||||
* // Comments can be placed on their own line.
|
||||
* foo: string, // An array key description.
|
||||
* bar: array {, // Another array key description.
|
||||
* 'foo//bar': string, // Array key with "//" in it's name.
|
||||
* },
|
||||
* }
|
||||
*/
|
||||
```
|
||||
|
||||
Tip: if you find yourself copying the same complex array shape over and over again to avoid `InvalidArgument` issues, try using [type aliases](utility_types.md#type-aliases), instead.
|
||||
|
||||
### Validating array shapes
|
||||
|
||||
@@ -46,7 +46,7 @@ Atomic types are the basic building block of all type information used in Psalm.
|
||||
* [`key-of<T>`](utility_types.md#key-oft)
|
||||
* [`value-of<T>`](utility_types.md#value-oft)
|
||||
* [`properties-of<T>`](utility_types.md#properties-oft)
|
||||
* [`class-string-map<T of Foo, T>`](utility_types.md#class-string-mapt-as-foo-t)
|
||||
* [`class-string-map<T of Foo, T>`](utility_types.md#class-string-mapt-of-foo-t)
|
||||
* [`T[K]`](utility_types.md#tk)
|
||||
* [Type aliases](utility_types.md#type-aliases)
|
||||
* [Variable templates](utility_types.md#variable-templates)
|
||||
|
||||
@@ -414,6 +414,14 @@ Whether or not to allow `require`/`include` calls in your PHP. Defaults to `true
|
||||
```
|
||||
Allows you to hard-code a serializer for Psalm to use when caching data. By default, Psalm uses `ext-igbinary` *if* the version is greater than or equal to 2.0.5, otherwise it defaults to PHP's built-in serializer.
|
||||
|
||||
#### compressor
|
||||
```xml
|
||||
<psalm
|
||||
compressor="['lz4'|'deflate'|'off']"
|
||||
>
|
||||
```
|
||||
Allows you to hard-code a compressor for Psalm's cache. By default, Psalm uses `ext-zlib` deflate, if it's enabled.
|
||||
|
||||
#### threads
|
||||
```xml
|
||||
<psalm
|
||||
@@ -574,10 +582,11 @@ or interfaces defined in a stub file, this stub should be configured with attrib
|
||||
```
|
||||
|
||||
#### <ignoreExceptions>
|
||||
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.
|
||||
Optional. A list of exceptions to not report for `checkForThrowsDocblock` or `checkForThrowsInGlobalScope`. The `class` tag will make Psalm ignore only instances of the specified class, while `classAndDescendants` will make Psalm also ignore subclasses. If an exception has `onlyGlobalScope` set to `true`, only `checkForThrowsInGlobalScope` is ignored for that exception, e.g.
|
||||
```xml
|
||||
<ignoreExceptions>
|
||||
<class name="fully\qualified\path\Exc" onlyGlobalScope="true" />
|
||||
<classAndDescendants name="fully\qualified\path\OtherExc" />
|
||||
</ignoreExceptions>
|
||||
```
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@ It currently supports diagnostics (i.e. finding errors and warnings), go-to-defi
|
||||
|
||||
It works well in a variety of editors (listed alphabetically):
|
||||
|
||||
## Emacs
|
||||
## Client configuration
|
||||
|
||||
### Emacs
|
||||
|
||||
I got it working with [eglot](https://github.com/joaotavora/eglot)
|
||||
|
||||
@@ -27,13 +29,13 @@ This is the config I used:
|
||||
)
|
||||
```
|
||||
|
||||
## PhpStorm
|
||||
### PhpStorm
|
||||
|
||||
### Native Support
|
||||
#### Native Support
|
||||
|
||||
As of PhpStorm 2020.3 support for psalm is supported and on by default, you can read more about that [here](https://www.jetbrains.com/help/phpstorm/using-psalm.html)
|
||||
|
||||
### With LSP
|
||||
#### With LSP
|
||||
|
||||
Alternatively, psalm works with `gtache/intellij-lsp` plugin ([Jetbrains-approved version](https://plugins.jetbrains.com/plugin/10209-lsp-support), [latest version](https://github.com/gtache/intellij-lsp/releases/tag/v1.6.0)).
|
||||
|
||||
@@ -51,7 +53,7 @@ In the "Server definitions" tab you should add a definition for Psalm:
|
||||
|
||||
In the "Timeouts" tab you can adjust the initialization timeout. This is important if you have a large project. You should set the "Init" value to the number of milliseconds you allow Psalm to scan your entire project and your project's dependencies. For opening a couple of projects that use large PHP frameworks, on a high-end business laptop, try `240000` milliseconds for Init.
|
||||
|
||||
## Sublime Text
|
||||
### Sublime Text
|
||||
|
||||
I use the excellent Sublime [LSP plugin](https://github.com/tomv564/LSP) with the following config(Package Settings > LSP > Settings):
|
||||
```json
|
||||
@@ -64,7 +66,7 @@ I use the excellent Sublime [LSP plugin](https://github.com/tomv564/LSP) with th
|
||||
}
|
||||
```
|
||||
|
||||
## Vim & Neovim
|
||||
### Vim & Neovim
|
||||
|
||||
**ALE**
|
||||
|
||||
@@ -105,6 +107,15 @@ Add settings to `coc-settings.json`:
|
||||
}
|
||||
```
|
||||
|
||||
## VS Code
|
||||
### VS Code
|
||||
|
||||
[Get the Psalm plugin here](https://marketplace.visualstudio.com/items?itemName=getpsalm.psalm-vscode-plugin) (Requires VS Code 1.26+):
|
||||
|
||||
## Running the server in a docker container
|
||||
|
||||
Make sure you use `--map-folder` option. Using it without argument will map the server's CWD to the host's project root folder. You can also specify a custom mapping. For example:
|
||||
```bash
|
||||
docker-compose exec php /usr/share/php/psalm/psalm-language-server \
|
||||
-r=/var/www/html \
|
||||
--map-folder=/var/www/html:$PWD
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user