bitexpert/phpstan-sylius 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

bitexpert/phpstan-sylius

Composer 安装命令:

composer require bitexpert/phpstan-sylius

包简介

Sylius extensions and rules for PHPStan

README 文档

README

Build Status installs on Packagist Mastodon Follow

This package provides some additional features for PHPStan to detect configuration issues in Sylius projects.

Requirements

PHP: PHP 8.2 or higher

Sylius: Sylius 2.0 or higher

PHPStan: PHPStan 2.0 or higher

Installation

The preferred way of installing bitexpert/phpstan-sylius is through Composer. You can add bitexpert/phpstan-sylius as a dev dependency, as follows:

composer.phar require --dev bitexpert/phpstan-sylius

PHPStan configuration

If you have not already a PHPStan configuration file phpstan.neon in your project, create a new empty file next to your composer.json file.

See here what options PHPStan allows you to configure.

Feature overview

This PHPStan extension works for both Sylius plugins and Sylius application projects.

The following rules have been implemented:

  • Rule to check if resource classes defined either via AbstractGrid::getResourceClass() or the #AsGrid attribute exist
  • Rule to check that configured grid fields belong to the configured resource class
  • Rule to check that configured filter fields belong to the configured resource class
    • custom filter types are supported
  • Rule to check that grid class configured via the Index attribute exists
  • Rule to check that form type configured via the AsResource attribute exists

Current assumptions:

  • Grids are configured by extending the Sylius\Bundle\GridBundle\Grid\AbstractGrid class

Custom filter types

To include your custom filter type in the checks, implement the bitExpert\PHPStan\Sylius\Collector\Grid\Filter\FilterNode interface and add a service to your phpstan.neon file and tag it with the phpstan.sylius.grid.filter tag.

Contribute

Please feel free to fork and extend existing or add new features and send a pull request with your changes! To establish a consistent code quality, please provide unit tests for all your changes and adapt the documentation.

Want To Contribute?

If you feel that you have something to share, then we’d love to have you. Check out the contributing guide to find out how, as well as what we expect from you.

License

PHPStan Sylius Extension is released under the MIT License.

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 4
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固