From ecb671ddf0a8fcc66e51a7f62c0ec57d7cd113c4 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Mon, 12 Jan 2026 23:14:27 -0500 Subject: [PATCH 1/5] Remove emoji from project name Signed-off-by: Kevin Ullyott --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5add5c0..65210d3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@
-# MeliorStan 🛡️ +# MeliorStan **Advanced PHPStan Rules for Superior Code Quality** From 1e7113476102c17c776ca4bb0c0254e3bd6214e8 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Mon, 12 Jan 2026 23:17:12 -0500 Subject: [PATCH 2/5] Remove broken links and cleanup footer notes Signed-off-by: Kevin Ullyott --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 65210d3..6d51bb1 100644 --- a/README.md +++ b/README.md @@ -192,8 +192,6 @@ This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) - [**PHPStan**](https://phpstan.org/) - The foundation of modern PHP static analysis - [**PHPMD**](https://phpmd.org/) - Original inspiration for code quality rules -- [**PHP-Parser**](https://github.com/nikic/PHP-Parser) - AST parsing capabilities -- **PHP Community** - For continuous improvement of PHP tooling --- @@ -201,6 +199,6 @@ This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) **Made with ❤️ for the PHP community** -[📖 Documentation](docs/) • [🐛 Report Issues](https://github.com/orrison/meliorstan/issues) • [💡 Request Features](https://github.com/orrison/meliorstan/discussions) +[📖 Documentation](docs/) • [🐛 Report Issues](https://github.com/orrison/meliorstan/issues)
From 282b86fb52150436ef1a2af5ba94929bbca99b1c Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Mon, 12 Jan 2026 23:27:46 -0500 Subject: [PATCH 3/5] Add a proper contributing.md Signed-off-by: Kevin Ullyott --- CONTRIBUTING.md | 131 ++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 21 +------- 2 files changed, 133 insertions(+), 19 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..d7cd7a2 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,131 @@ +# Contributing to MeliorStan + +Thank you for your interest in contributing to MeliorStan! This document provides guidelines and instructions for contributing to the project. + +## 📋 Table of Contents + +- [Development Setup](#development-setup) +- [Project Architecture](#project-architecture) +- [Adding New Rules](#adding-new-rules) +- [Testing](#testing) +- [Code Style](#code-style) +- [Documentation](#documentation) +- [Pull Request Process](#pull-request-process) + +## Development Setup + +### Prerequisites + +- PHP 8.3 or higher +- Composer + +### Installation + +```bash +git clone https://github.com/Orrison/MeliorStan.git +cd MeliorStan +composer install +``` + +### Available Commands + +| Command | Description | +|---------|-------------| +| `composer test` | Run all tests with paratest | +| `composer format` | Auto-fix code style with PHP-CS-Fixer | +| `composer analyze` | Run PHPStan analysis | + +## Project Architecture + +Each rule typically follows a consistent component structure as follows: + +``` +src/Rules/{RuleName}/ +├── {RuleName}Rule.php # Main rule implementing Rule +├── Config.php # Configuration class (if rule has options) + +tests/Rules/{RuleName}/ +├── config/ +│ ├── default.neon # Default configuration test +│ └── {option}.neon # Per-option configuration tests +├── Fixture/ +│ └── ExampleClass.php # Test fixtures +├── DefaultTest.php # Default configuration test +└── {Option}Test.php # Per-option tests +``` + +### Key Files + +| File | Purpose | +|------|---------| +| `config/extension.neon` | Central dependency injection & parameter schema definition | +| `tests/Rules/*/config/*.neon` | Per-test configuration files that override defaults | +| `tests/Rules/*/Fixture/*.php` | Test fixtures with various code patterns | + +## Adding New Rules + +1. Follow the established architecture pattern +2. Include comprehensive tests +3. Update documentation +4. Ensure all checks pass: `composer format && composer analyze && composer test` + +## Testing + +### Running Tests + +```bash +# Run all tests +composer test + +# Run specific rule tests +./vendor/bin/phpunit tests/Rules/{RuleName}/ + +# Run a single test file +./vendor/bin/phpunit tests/Rules/{RuleName}/DefaultTest.php +``` + +### Test Conventions + +- Each rule has multiple test classes covering all configuration combinations +- Tests use exact line numbers from fixture files +- **Always use error message constants** in test assertions, never hardcoded strings + +```php +// ✓ Correct - using constants +$this->analyse([__DIR__ . '/Fixture/Example.php'], [ + [MyRule::ERROR_MESSAGE, 14], + [sprintf(MyRule::ERROR_MESSAGE_TEMPLATE, 'value', 3), 20], +]); + +// ✗ Wrong - hardcoded strings +$this->analyse([__DIR__ . '/Fixture/Example.php'], [ + ['Some hardcoded error message.', 14], +]); +``` + +### Critical: Line Number Management + +**Always run `composer format` BEFORE finalizing test line numbers!** + +1. Write initial tests with approximate line numbers +2. Run `composer format` to apply code style fixes +3. Run the specific test to see actual vs expected line numbers +4. Update test assertions with correct line numbers +5. Re-run tests to verify they pass + +## Code Style + +### Formatting + +```bash +composer format # Auto-fix code style +composer analyze # Run PHPStan analysis +``` + +## Questions? + +If you have questions or need help, please [open an issue](https://github.com/orrison/meliorstan/issues). + +--- + +Thank you for contributing to MeliorStan! 🎉 diff --git a/README.md b/README.md index 6d51bb1..16a7165 100644 --- a/README.md +++ b/README.md @@ -163,26 +163,9 @@ Originally inspired by [**PHPMD - PHP Mess Detector**](https://phpmd.org/), this > **Note**: While inspired by PHPMD, these rules are not exact replicas. They offer additional customization options and are adapted for PHPStan's architecture and modern PHP practices. -[//]: # (## 🤝 Contributing) +## 🤝 Contributing -[//]: # () -[//]: # (We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.) - -### Development Setup - -```bash -git clone https://github.com/Orrison/MeliorStan.git -cd MeliorStan -composer install -composer test -``` - -### Adding New Rules - -1. Follow the established architecture pattern -2. Include comprehensive tests -3. Update documentation -4. Ensure all checks pass: `composer format && composer analyze && composer test` +We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details. ## 📄 License From f88bd78216080502a65d0f409762c12bb2c05931 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Mon, 12 Jan 2026 23:28:51 -0500 Subject: [PATCH 4/5] Update note Signed-off-by: Kevin Ullyott --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 16a7165..d68240f 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,7 @@ parameters: Originally inspired by [**PHPMD - PHP Mess Detector**](https://phpmd.org/), this project provides modern PHPStan equivalents with enhanced configurability and PHP 8+ features. -> **Note**: While inspired by PHPMD, these rules are not exact replicas. They offer additional customization options and are adapted for PHPStan's architecture and modern PHP practices. +> **Note**: While inspired by PHPMD, these rules are not exact replicas. They may offer additional or renamed customization options and are adapted for PHPStan's architecture and modern PHP practices. ## 🤝 Contributing From bd3d1118837169cf286a006e08e3df52e1058ff9 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Mon, 12 Jan 2026 23:33:01 -0500 Subject: [PATCH 5/5] Remove bad sections from contributing.md Signed-off-by: Kevin Ullyott --- CONTRIBUTING.md | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d7cd7a2..a29adcc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,9 +8,6 @@ Thank you for your interest in contributing to MeliorStan! This document provide - [Project Architecture](#project-architecture) - [Adding New Rules](#adding-new-rules) - [Testing](#testing) -- [Code Style](#code-style) -- [Documentation](#documentation) -- [Pull Request Process](#pull-request-process) ## Development Setup @@ -103,25 +100,6 @@ $this->analyse([__DIR__ . '/Fixture/Example.php'], [ ]); ``` -### Critical: Line Number Management - -**Always run `composer format` BEFORE finalizing test line numbers!** - -1. Write initial tests with approximate line numbers -2. Run `composer format` to apply code style fixes -3. Run the specific test to see actual vs expected line numbers -4. Update test assertions with correct line numbers -5. Re-run tests to verify they pass - -## Code Style - -### Formatting - -```bash -composer format # Auto-fix code style -composer analyze # Run PHPStan analysis -``` - ## Questions? If you have questions or need help, please [open an issue](https://github.com/orrison/meliorstan/issues).