---
title: "[RFC] [Discussion] Add ReflectionAttribute::getCurrent()"
url: https://daily.dev/posts/rfc-discussion-add-reflectionattribute-getcurrent--oqrxohfqw
source_url: https://externals.io/message/131129
type: article
source: "externals.io"
published: 2026-06-03T23:31:07.182Z
updated: 2026-06-03T23:31:40.471Z
tags: ["php"]
reading_time: 40
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# [RFC] [Discussion] Add ReflectionAttribute::getCurrent()

**[externals.io](https://daily.dev/sources/externals)** · 40 min read · 0 upvotes · 0 comments

## Summary

A PHP internals RFC discussion proposes adding ReflectionAttribute::getCurrent(), a static method callable from within an attribute constructor that returns the ReflectionAttribute instance corresponding to the current attribute usage. The core challenge is that inside an attribute constructor there is no direct access to the ReflectionAttribute instance without backtrace hacking. The RFC author Daniel Scherzer explains why alternative approaches — such as engine-level parameter injection or dynamic methods — would break backwards compatibility or create confusion for library authors. After feedback from Derick Rethans and others, the RFC was updated to split the feature into two methods: a static getCurrent() returning the ReflectionAttribute, and a normal dynamic getReflectionTarget() returning the reflection target, intended to be chained as ReflectionAttribute::getCurrent()->getReflectionTarget().

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://externals.io/message/131129>

## Similar posts on daily.dev

- [\[RFC\] \[Discussion\] Add ReflectionAttribute::getCurrent\(\)](https://daily.dev/posts/rfc-discussion-add-reflectionattribute-getcurrent--2o3q9psus) · externals.io · 0 upvotes · 0 comments
- [\[RFC\] \[Discussion\] Add ReflectionAttribute::getCurrent\(\)](https://daily.dev/posts/rfc-discussion-add-reflectionattribute-getcurrent--atpduvunh) · externals.io · 0 upvotes · 0 comments
- [\[RFC\] \[Discussion\] Add ReflectionAttribute::getCurrent\(\)](https://daily.dev/posts/rfc-discussion-add-reflectionattribute-getcurrent--2r3cchmot) · externals.io · 0 upvotes · 0 comments
- [\[RFC\] \[Discussion\] Add ReflectionAttribute::getCurrent\(\)](https://daily.dev/posts/rfc-discussion-add-reflectionattribute-getcurrent--txdq1xybr) · externals.io · 0 upvotes · 0 comments
- [\[VOTE\] RFC: Add ReflectionAttribute::getCurrent\(\)](https://daily.dev/posts/vote-rfc-add-reflectionattribute-getcurrent--vlkajdgr2) · externals.io · 0 upvotes · 0 comments

---

Tags: [#php](https://daily.dev/tags/php)

[View this post on daily.dev](https://daily.dev/posts/rfc-discussion-add-reflectionattribute-getcurrent--oqrxohfqw)
