String Array Cast

未关闭
#14,384 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
php
领域
compilers

调研方向

该 issue 未指明文件、测试或入口点。首先追踪 PHP 如何解析 casts 以及处理数组,然后将提议的语法与所展示的 array_map 行为进行比较。当该功能的语法、语义和兼容性都已定义并由测试覆盖时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

Category: Engine Feature Status: Requires RFC
Description

Hi there!

I would like to propose the feature that would allow to cast an array of objects into an array of strings:

/** @var Uuid[] $templateIds */
$templateIdStrings = (string[])$templateIds;

Basically this is a syntax sugar to a more verbose form identical to this:

/** @var Uuid[] $templateIds */
$templateIdStrings = array_map(static fn (Uuid $value): string => (string)$value, $templateIds);

Please, let me know what you think about it.

主要语言
C
星标
40.4k
派生
8.2k
平均合并
2 天 15 小时
30 天内合并 PR
103

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

php/php-src 的其他 Issue

查看 php/php-src 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。