mirror of
https://github.com/yiisoft/yii2.git
synced 2025-10-28 12:34:34 +08:00
Add PHPStan sections in docs (#20504)
This commit is contained in:
@ -73,6 +73,19 @@ git remote add upstream https://github.com/yiisoft/yii2.git
|
||||
|
||||
Вы можете запустить модульные тесты JavaScript с помощью команды `npm test` в корневой директории приложения.
|
||||
|
||||
### Статический анализ
|
||||
|
||||
Мы используем [PHPStan](https://phpstan.org) для статического анализа. Он может быть запущен следующими командами:
|
||||
`php vendor/bin/phpstan` или `vendor\bin\phpstan.bat` в случае запуска на ОС Windows.
|
||||
|
||||
По умолчанию PHPStan будет использовать конфигурацию из `phpstan.dist.neon`. Вы можете создать файл
|
||||
`phpstan.neon` с вашей собственной конфигурацией, и PHPStan будет использовать его.
|
||||
|
||||
#### Примечание
|
||||
|
||||
В аннотациях PHPDoc мы используем стандартные типы PHP. Пожалуйста, используйте аннотации PHPStan/Psalm,
|
||||
если хотите добавить условные типы, формы массивов и т.д. Это связано с тем, что не все IDE в настоящее время поддерживают типы PHPStan/Psalm, и это также нарушит автоматическую генерацию документации.
|
||||
|
||||
### Расширения
|
||||
|
||||
Для работы над расширениями вы можете склонировать репозиторий расширения. Мы сделали команду, которая поможет вам
|
||||
|
||||
@ -73,6 +73,18 @@ You may limit the tests to a group of tests you are working on e.g. to run only
|
||||
|
||||
You can execute JavaScript unit tests by running `npm test` in the repo root directory.
|
||||
|
||||
### Static analysis
|
||||
|
||||
We use [PHPStan](https://phpstan.org) for static analysis. It can be launched using the following commands:
|
||||
`php vendor/bin/phpstan` or `vendor\bin\phpstan.bat` in case of execution from the Windows OS.
|
||||
|
||||
By default, PHPStan will use the configuration from `phpstan.dist.neon`. You can create
|
||||
a `phpstan.neon` file with your own configuration, and PHPStan will use it.
|
||||
|
||||
#### Note
|
||||
|
||||
In PHPDoc annotations, we use standard PHP types. Please use PHPStan/Psalm annotations if you want to add conditional types, array shapes, etc. This is because not all IDEs currently support PHPStan/Psalm types, and it will also break automatic documentation generation.
|
||||
|
||||
### Extensions
|
||||
|
||||
To work on extensions you have to clone the extension repository. We have created a command that can do this for you:
|
||||
|
||||
Reference in New Issue
Block a user