Skip to content

Commit c4e920f

Browse files
authored
Add PHPStan sections in docs (#20504)
1 parent 2fc017b commit c4e920f

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

docs/internals-ru/git-workflow.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,19 @@ git remote add upstream https://github.com/yiisoft/yii2.git
7373

7474
Вы можете запустить модульные тесты JavaScript с помощью команды `npm test` в корневой директории приложения.
7575

76+
### Статический анализ
77+
78+
Мы используем [PHPStan](https://phpstan.org) для статического анализа. Он может быть запущен следующими командами:
79+
`php vendor/bin/phpstan` или `vendor\bin\phpstan.bat` в случае запуска на ОС Windows.
80+
81+
По умолчанию PHPStan будет использовать конфигурацию из `phpstan.dist.neon`. Вы можете создать файл
82+
`phpstan.neon` с вашей собственной конфигурацией, и PHPStan будет использовать его.
83+
84+
#### Примечание
85+
86+
В аннотациях PHPDoc мы используем стандартные типы PHP. Пожалуйста, используйте аннотации PHPStan/Psalm,
87+
если хотите добавить условные типы, формы массивов и т.д. Это связано с тем, что не все IDE в настоящее время поддерживают типы PHPStan/Psalm, и это также нарушит автоматическую генерацию документации.
88+
7689
### Расширения
7790

7891
Для работы над расширениями вы можете склонировать репозиторий расширения. Мы сделали команду, которая поможет вам

docs/internals/git-workflow.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,18 @@ You may limit the tests to a group of tests you are working on e.g. to run only
7373

7474
You can execute JavaScript unit tests by running `npm test` in the repo root directory.
7575

76+
### Static analysis
77+
78+
We use [PHPStan](https://phpstan.org) for static analysis. It can be launched using the following commands:
79+
`php vendor/bin/phpstan` or `vendor\bin\phpstan.bat` in case of execution from the Windows OS.
80+
81+
By default, PHPStan will use the configuration from `phpstan.dist.neon`. You can create
82+
a `phpstan.neon` file with your own configuration, and PHPStan will use it.
83+
84+
#### Note
85+
86+
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.
87+
7688
### Extensions
7789

7890
To work on extensions you have to clone the extension repository. We have created a command that can do this for you:

0 commit comments

Comments
 (0)