Skip to content

Consistency of __PROPERTY__ magic constant meaning in hook signature #17222

Closed
@ondrejmirtes

Description

@ondrejmirtes

Description

If I look at what __METHOD__ does, it has meaning in:

  • method attributes
  • default parameter values
  • parameter attributes
  • in method body

Here's a quick proof: https://3v4l.org/EqGLn

When I compare that with __PROPERTY__, it only has meaning in:

  • parameter attributes
  • in hook body

Of course, hook parameter cannot have a default value. But it'd be nice for consistency if it also had meaning in:

  • hook attributes

Which it currently has not. Additionally, it might be up to discussion, if it should have meaning in:

  • default property value
  • property attributes

Here's a quick script to verify: https://3v4l.org/4BMJt#v8.4.2

/cc @iluuu1994 @Crell

PHP Version

PHP 8.4

Operating System

N/A

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions