samlitowitz/phpstan-opinionated-nomenclature
Composer 安装命令:
composer require samlitowitz/phpstan-opinionated-nomenclature
包简介
Opinionated PHPStan rules for naming things
README 文档
README
Opinionated PHPStan rules for naming things.
Table of Contents
Installation
Install the extension via Composer.
composer require --dev samlitowitz/phpstan-opinionated-nomenclature
This extension requires PHPStan to use.
PHPStan Extension Installer
Use the PHPStan Extension Installer to automatically install PHPStan extensions.
Manual Installation
Add vendor/samlitowitz/phpstan-opinionated-nomenclature/extension.neon to the includes section of
your phpstan.neon or phpstan.neon.dist file, i.e.
includes: - vendor/samlitowitz/phpstan-opinionated-nomenclature/extension.neon
Rules
Namespace
-
Namespace names MUST NOT be equal to or end in
DTOof any case (case-insensitive)<?php namespace DTO; // bad namespace Client\Dto; // bad
-
Namespace names MUST NOT be equal to
Helperof any case (case-insensitive)<?php namespace Helper; // bad namespace Client\helper; // bad
-
Namespace names MUST NOT be equal to
Utilof any case (case-insensitive)<?php namespace Util; // bad namespace Client\util; // bad
Class Like (Class, Interface, Trait)
-
Class like names MUST NOT be equal to or end in
DTOof any case (case-insensitive)<?php class DTO {} // bad class ClientDTO {} // bad
-
Class like names MUST NOT be equal to
Helperof any case (case-insensitive)<?php class Helper {} // bad
-
Class like names MUST NOT be equal to
Utilof any case (case-insensitive)<?php class Util {} // bad
-
Class like names MUST NOT be equal to or start with any case (case-insensitive) of the namespace name it resides in
<?php namespace Client; class ClientRequest {} // bad namespace Client\Request; class Request {} // bad
-
Class like names MUST NOT end with their type name of any case (case-insensitive)
<?php class ClientClass {} // bad interface FileInterface {} // bad trait TransactionTrait {} // bad
Class
-
No non-final classes without children
<?php class NonFinalNoChildren {} // bad
Interface
-
Interface names MUST NOT be prefixed with
I<?php interface IWriter {} // bad
samlitowitz/phpstan-opinionated-nomenclature 适用场景与选型建议
samlitowitz/phpstan-opinionated-nomenclature 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 56 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 11 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 samlitowitz/phpstan-opinionated-nomenclature 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 samlitowitz/phpstan-opinionated-nomenclature 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 56
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 14
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2024-11-25