承接 skukunin/phpstan-rules 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

skukunin/phpstan-rules

最新稳定版本:v1.0.0

Composer 安装命令:

composer require skukunin/phpstan-rules

包简介

Custom PHPStan rules for static analysis

README 文档

README

This library provides a collection of custom PHPStan rules to help you enforce best practices in your PHP projects. It includes rules that will catch common anti-patterns and misuses, such as using deprecated methods, misusing container methods, and error silencing practices.

How to Use

  1. Installation: Install this library via Composer:
composer require skukunin/phpstan-rules --dev
  1. Configuration: Register the custom rules in your PHPStan configuration file (e.g., phpstan.neon or extension.neon).

You can add all the rules in your PHPStan configuration file:

includes:
    - phpstan-baseline.neon
    - vendor/skukunin/phpstan-rules/extension.neon
parameters:
    level: 6
...

or add only needed rules:

rules:
    - SKukunin\PHPStanRules\Rules\NoControllerGetParameterRule
  1. Running PHPStan: Run PHPStan on your project to report any detected issues:
vendor/bin/phpstan analyse src tests

Use Cases

  • Symfony Projects: This library is designed with Symfony projects in mind. It provides rules to enforce best practices such as avoiding the use of getParameter in controllers, encouraging better dependency injection practices.
  • Legacy Codebases: Gradually refactor and improve legacy code by integrating these rules to catch common pitfalls.
  • CI/CD Integration: Ensure code quality across your projects by integrating these custom PHPStan rules into your automated build pipelines.

Existing Rules

  • NoContainerGetRule: Prevents misuse of container get methods.
  • NoControllerGetParameterRule: Flags the usage of getParameter within controllers.
  • NoErrorSilencingRule: Disallows use of PHP's error suppression operator (@).

Contributing

Contributions are welcome! If you encounter issues or have ideas for enhancements, please open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License.

统计信息

  • 总下载量: 38
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固