Download the PHP package simtel/phpstan-rules without Composer

On this page you can find all versions of the php package simtel/phpstan-rules. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phpstan-rules

PHPStan Extended Rules

PHP Version PHPStan

A collection of custom PHPStan rules that enforce coding standards and improve code quality in PHP projects. This extension provides additional static analysis rules focused on naming conventions, annotations, and PHPDoc consistency.

🎯 Features

This package includes three powerful rules that help maintain high code quality:

1. Command-Handler Relationship Rule

Rule: CommandClassShouldBeHelpCommandHandlerClass

Enforces that classes ending with "Command" must have a @see PHPDoc tag pointing to their corresponding CommandHandler class.

Example:

Exception: Classes with an __invoke method are exempt from this rule.

2. Event Listener Attribute Rule

Rule: EventListenerClassShouldBeIncludeAsListenerAttribute

Ensures that classes ending with "EventListener" are properly annotated with the #[AsEventListener] attribute.

Example:

3. Redundant PHPDoc Return Type Rule

Rule: NotShouldPhpdocReturnIfExistTypeHint

Prevents redundant or conflicting @return PHPDoc annotations when native return type hints are already declared.

Good:

Bad:

📦 Installation

System Requirements

Install via Composer

Install the package as a development dependency:

⚙️ Configuration

Option 1: Include All Rules (Recommended)

Add the bundled configuration to your phpstan.neon or phpstan.dist.neon:

Option 2: Manual Rule Registration

For granular control, register specific rules:

Complete Configuration Example

🔧 Development

Setting Up Development Environment

  1. Clone the repository:

  2. Install dependencies:

Development Commands

Running Tests

Code Style

Static Analysis

Project Structure

Creating New Rules

  1. Implement the Rule Interface:

  2. Create Test Cases:

  3. Add Fixture Files: Create test PHP files in tests/Fixture/ to validate rule behavior.

Testing Strategy

The project uses PHPUnit with PHPStan's RuleTestCase base class:

Contributing Guidelines

  1. Code Standards: Follow PSR-4 autoloading and use ECS for code style
  2. Testing: All rules must have comprehensive tests with both positive and negative cases
  3. Documentation: Update README.md and add inline documentation for new rules
  4. Performance: Ensure rules execute efficiently within PHPStan's analysis pipeline

🐛 Troubleshooting

Common Issues

"Rule Not Found" Errors

Cause: Incorrect namespace or class name in phpstan.neon.

Solution: Verify the fully qualified class names and check for typos.

Rules Not Being Applied

Cause: Configuration file not included or rules not registered.

Solution: Ensure vendor/simtel/phpstan-rules/rules.neon is included in your PHPStan configuration.

Performance Issues

Cause: Rules may be analyzing too many files or performing expensive operations.

Solution: Use excludePaths to limit analysis scope or optimize rule logic.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📞 Support

If you encounter any issues or have questions, please open an issue on GitHub.


All versions of phpstan-rules with dependencies

PHP Build Version
Package Version
Requires php Version >8.3
phpstan/phpstan Version ^2.0
phpstan/phpdoc-parser Version ^2.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package simtel/phpstan-rules contains the following files

Loading the files please wait ...