承接 tomasvotruba/ctor 相关项目开发

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

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

tomasvotruba/ctor

最新稳定版本:2.2.1

Composer 安装命令:

composer require tomasvotruba/ctor

包简介

Prefer constructor over always called setters

README 文档

README

Downloads

If you can use constructor instead of setters, use it. These PHPStan rules will help you to find such cases.


What It Does?

This tool collects instances of new object() followed by a series of method calls on the same object:

$human = new Human();
$human->setName('Tomas');
$human->setAge(35);

...and suggests turning them into constructor arguments:

$human = new Human('Tomas', 35);

Why?

Such chained setters often indicate implicit required dependencies. By moving them to the constructor, you make the object state explicit, safer, and easier to reason about — and even easier to test.


Installation

composer require tomasvotruba/ctor --dev

Usage

Make use phpstan/extension-installer to load the extension automatically.

Run PHPStan and it will automatically run the rules.


Happy coding!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固