|
1 | 1 | # Contributing to TypePHP |
2 | 2 |
|
3 | | -Thank you for showing interest in contributing to this TypePHP library! Contributions are essential for building a robust type-safe ecosystem for the PHP community. |
| 3 | +Thank you for showing interest in contributing to TypePHP! Contributions are essential for building a robust, type-safe ecosystem for the PHP community. |
4 | 4 |
|
5 | | -This library is designed to be a reliable foundation for high-performance applications. To achieve this, it maintains rigorous standards for code quality and developer experience. |
| 5 | +This library is designed to be a reliable foundation for high-performance applications. To achieve this, it maintains rigorous standards for code quality, developer experience, and static analysis compatibility. |
| 6 | + |
| 7 | +--- |
6 | 8 |
|
7 | 9 | ## Development Workflow |
8 | 10 |
|
9 | | -To ensure consistency across the ecosystem, this repository requires the following workflow: |
| 11 | +To ensure consistency across the codebase, this repository requires the following workflow: |
10 | 12 |
|
11 | 13 | 1. **Fork and Branch**: Fork the repository and create a feature branch from `main`. |
12 | 14 | 2. **Dependencies**: Install development tools using `composer install`. |
13 | | -3. **Coding Standards**: This project follows strict PSR-12 standards. Use Laravel Pint to format code: `./vendor/bin/pint`. |
14 | | -4. **Static Analysis**: Code must be predictable and type-safe. It must pass PHPStan at the maximum level: `./vendor/bin/phpstan analyse`. |
15 | | -5. **Testing**: This project uses Pest. Ensure the test suite passes completely: `./vendor/bin/pest`. |
| 15 | +3. **Linting & Code Formatting Authority (Laravel Pint)**: This project follows strict PSR-12 standards. Laravel Pint is the **sole authoritative linter and formatter** for the entire codebase: |
| 16 | + ```bash |
| 17 | + ./vendor/bin/pint |
| 18 | + ``` |
| 19 | +4. **Static Analysis Authority (PHPStan)**: Code must pass **PHPStan at Level MAX** (`treatPhpDocTypesAsCertain: false`): |
| 20 | + ```bash |
| 21 | + ./vendor/bin/phpstan analyse |
| 22 | + ``` |
| 23 | +5. **Testing**: This project uses Pest. Ensure all tests pass completely: |
| 24 | + ```bash |
| 25 | + ./vendor/bin/pest |
| 26 | + ``` |
16 | 27 | 6. **Strict Typing**: Every PHP file must begin with `declare(strict_types=1);`. |
17 | 28 |
|
| 29 | +--- |
| 30 | + |
| 31 | +## Tooling Authority & Interoperability Policy |
| 32 | + |
| 33 | +* **Laravel Pint is the Authoritative Linter & Formatter**: All code styling and linting rules are defined strictly in `pint.json`. No external style linter overrides Pint. |
| 34 | +* **PHPStan is the Authoritative Static Analyzer**: PHPStan configured at Level MAX is the official gatekeeper for type safety and code quality in TypePHP. All contributions must pass PHPStan checks without errors. |
| 35 | +* **Tooling Interoperability (Psalm, Mago, Rector, PHP-CS-Fixer, etc.)**: Secondary analyzers and tools (such as Psalm, Mago, Rector, and PHP-CS-Fixer) are integrated into the test environment solely for **interoperability verification** and ensuring that TypePHP's runtime stream wrapper and AST transformations stand down properly and do not deadlock or conflict with external static analysis engines. |
| 36 | + |
| 37 | +--- |
18 | 38 |
|
19 | 39 | ## Pull Request Process |
20 | 40 |
|
21 | | -1. **Start with an Issue**: Before writing code, please open an issue to discuss the bug or the proposed feature. |
22 | | -2. **Tests are Required**: Every Pull Request must include automated tests that cover the new logic or prevent the bug from recurring. |
| 41 | +1. **Start with an Issue**: Before writing code, please open an issue to discuss the bug or proposed feature. |
| 42 | +2. **Tests are Required**: Every Pull Request must include automated Pest tests that cover the new logic and prevent regressions. |
| 43 | +3. **Keep Code Clean**: Run `./vendor/bin/pint`, `./vendor/bin/phpstan analyse`, and `./vendor/bin/pest` before submitting your PR. |
23 | 44 |
|
24 | 45 | --- |
25 | 46 |
|
26 | | -The Hibla ecosystem thanks you for your time and effort! |
| 47 | +The TypePHP ecosystem thanks you for your time and effort! |
0 commit comments