定制 alexsvorada/phpstan-espocrm 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

alexsvorada/phpstan-espocrm

最新稳定版本:v1.0.2

Composer 安装命令:

composer require alexsvorada/phpstan-espocrm

包简介

PHPStan rules for EspoCRM development

README 文档

README

PHPStan extension providing custom rules for EspoCRM development to enforce coding standards and best practices.

Table of Contents

Requirements

Installation

1. Install via Composer

composer require --dev alexsvorada/phpstan-espocrm

2. Add to your phpstan.neon

includes:
    - vendor/alexsvorada/phpstan-espocrm/extension.neon

Rules

This extension provides the following PHPStan rules for EspoCRM:

Entity Rules

  • DefineEntityTypeConstantRule: Ensures entities define the ENTITY_TYPE constant
  • DefineTemplateTypeConstantRule: Ensures entities define template type constants when needed
  • NoEntityManagerInEntityRule: Prevents direct EntityManager usage in entity classes

Service Rules

  • CallParentConstructorRule: Ensures parent constructor is called in service classes
  • ServiceMustExtendRecordRule: Ensures services extend the appropriate Record class

Hook Rules

  • NoSameEntitySaveRule: Prevents saving the same entity within hooks to avoid infinite loops
  • SaveRestrictedEntityFieldsRule: Prevents saving restricted entity fields in hooks
  • RequireOrderPropertyRule: Ensures hooks define the required $order property

Controller Rules

  • OnlyOverrideParentMethodsRule: Ensures controllers only override parent methods, not create arbitrary ones

Usage

After installation, run PHPStan as usual:

vendor/bin/phpstan analyse

The rules will automatically be applied to your EspoCRM codebase, helping maintain code quality and prevent common issues.

Development

This extension follows EspoCRM coding standards and provides rules to enforce best practices in EspoCRM module development.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-27