facebook / facebook/hhvm

Inconsistency with PHP regarding closures and reflection

オープン
#3,874 コメント 1 件 リアクション 0 件 担当者 1 名 @paulbiss が担当を希望しています GitHub で見る
php5 incompatibility
主要言語
C++
スター
18.7k
フォーク
3.1k
平均マージ
1時間 47分
マージ済み PR(30日)
2

説明

`new ReflectionFunction($closure)` seems to work as expected. However, in one case I am doing `$reflectionFunction->getParameters()` and then doing `$reflectionParameter->getDefiningFunction()`, which returns a ReflectionMethod instance in PHP (why not ReflectionFunction? no idea) that behaves differently from the original ReflectionFunction.
- `isClosure()` returns false
- `getClosureScopeClass()` returns null
- `getDeclaringClass()` returns something like "Closure$Namespace\Class::method;0000000".

http://3v4l.org/VgIeT

Some of this behaviour seems really quirky in PHP already and I can't imagine it's a high priority fix, but I thought I'd let you know.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。