承接 sevavietl/type-casting 相关项目开发

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

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

sevavietl/type-casting

Composer 安装命令:

composer require sevavietl/type-casting

包简介

README 文档

README

Build Status Coverage Status License: MIT PHPStan

Neither real covariance in method return type hints, nor explicit type casting are supported in PHP.

Sometimes it is useful to downcast object, so PhpStorm or PHPStan stop complaining about absent methods or mismatched types.

Usually @var tag used for this. But as with all phpdoc tags in regard of typing, this is simply telling your IDE or static analyzer tool to take your honest word that you know for sure the type of the stuff.

Whereas with actual type casting (like say in java, C# or even in PHP, but only for primitives) you can be sure that object (or primitive) is "castable" into specified type, or end up with exception.

So you can plug \TypeCasting\TypeCasting trait into your class (but only one per inheritance chain) and then use cast method that is a bit like Java.lang.Class.cast method (but of course this is oversimplified comparison).

downcasting

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固