diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ac9368e5..95039a3a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -68,11 +68,14 @@ We use [phpDocumentor](https://www.phpdoc.org/) to generate API documentation. **Please make sure your new or modified code is covered by proper PHPDoc comments.** Good documentation ensures that contributors and users can easily read and understand how the methods and classes work. +**When to regenerate documentation:** +Whenever you add or modify PHPDoc comments in your code, you must regenerate the documentation and commit the changes. The documentation files in the `docs/` directory are part of the repository and must be kept in sync with the code. If you don't regenerate and commit the docs, the CI check will fail. + To generate documentation locally, make sure phpDocumentor is installed, then run: ``` $ wget https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.8.1/phpDocumentor.phar -$ php phpDocumentor.phar run -d src -t docs +$ composer docs ``` ## Contributor license agreement diff --git a/composer.json b/composer.json index 1e4f8f07..b272b56d 100644 --- a/composer.json +++ b/composer.json @@ -52,6 +52,7 @@ "md": "phpmd --ignore-violations-on-exit src/constants,src/laravel,src/parser,examples/EchoBot/src,examples/EchoBot/public,examples/KitchenSink/src,examples/KitchenSink/public text phpmd.xml", "stan": "phpstan analyse", "copyright": "tools/check_copyright.sh", + "docs": "php phpDocumentor.phar run -d src -t docs", "check": [ "@test", "@cs",