PocketMine-MP uses several tools to enforce code quality standards. You can use these tools to check your code locally before you commit, which helps catch mistakes more quickly, and saves both your energy and maintainers’ for reviewing logic, instead of formatting, syntax and other boring stuff.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pmmp/PocketMine-MP/llms.txt
Use this file to discover all available pages before exploring further.
Quality Tools Overview
| Tool | Purpose | Installing | Running |
|---|---|---|---|
| PHPStan | Finds mistakes in code, e.g. wrong types, undefined functions | composer install | vendor/bin/phpstan |
| PHPUnit | Runs tests on code to verify behaviour | composer install | vendor/bin/phpunit tests/phpunit |
| PHP-CS-Fixer | Fixes (some) code style issues | Download phar | php php-cs-fixer.phar fix |
PHPStan - Static Analysis
PHPStan is a static analysis tool that finds mistakes in your code without running it. It can detect:- Type errors (e.g. passing a string where an int is expected)
- Calls to undefined functions or methods
- Access to undefined properties
- Dead code that will never execute
- And much more
Installing PHPStan
PHPStan is installed automatically when you run:Running PHPStan
To analyze your code with PHPStan:PHPUnit - Unit Testing
PHPUnit is a testing framework that runs automated tests to verify that your code behaves correctly. Tests help ensure that:- New features work as expected
- Bug fixes actually fix the problem
- Changes don’t break existing functionality
Installing PHPUnit
PHPUnit is installed automatically when you run:Running PHPUnit
To run the test suite:Writing Tests
When submitting a pull request, ideally include PHPUnit tests for your changes. If that’s not possible (e.g. for in-game functionality), provide details about playtesting such as screenshots and videos.PHP-CS-Fixer - Code Style
PHP-CS-Fixer automatically fixes code style issues to ensure your code follows PocketMine-MP’s coding standards.Installing PHP-CS-Fixer
Download the latest phar file from the PHP-CS-Fixer releases page.Running PHP-CS-Fixer
To fix code style issues in your code:PhpStorm Code Style
If you use PhpStorm, aProject code style is provided in the repository, which you can use to automatically format new code.
Running Quality Checks Before Committing
Before committing your changes, run all quality tools:GitHub Actions
When you push commits to GitHub, these tools run automatically via GitHub Actions:- PHPStan analyzes your code for errors
- PHPUnit runs the test suite
- Code style checks verify formatting