Skip to content

Hooks reflection - #4110

Merged
Girgias merged 21 commits into
php:masterfrom
Crell:hooks-reflection
Feb 21, 2025
Merged

Hooks reflection#4110
Girgias merged 21 commits into
php:masterfrom
Crell:hooks-reflection

Conversation

@Crell

@CrellCrell commented Nov 20, 2024

Copy link
Copy Markdown
Contributor

New PR, includes #4039, which generates the stubs.

Resolves#4039.

I'm not certain if the enum is in the right place, but I wasn't sure where else to put it. Open to suggestions.

@GirgiasGirgias left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, seems like the output from gen_stub is wrong, that's good to know :|

But thanks for working on it!

Comment threadreference/reflection/reflectionproperty/gethook.xml Outdated
Comment threadreference/reflection/reflectionproperty/gethook.xml
Comment threadreference/reflection/reflectionproperty/gethook.xml Outdated
Comment threadreference/reflection/reflectionproperty/gethook.xml Outdated
Comment threadreference/reflection/reflectionproperty/gethooks.xml
Comment threadreference/reflection/reflectionproperty/getrawvalue.xml Outdated
Comment threadreference/reflection/reflectionproperty/getsettabletype.xml
Comment threadreference/reflection/reflectionproperty/hashook.xml Outdated
Comment threadreference/reflection/reflectionproperty/hashooks.xml
@Crell
Crell marked this pull request as ready for review December 1, 2024 05:25
Comment on lines +55 to +56
$rProp->getHook(PropertyHookType::Get); // Returns an instance of \ReflectionMethod.
$rProp->getHook(PropertyHookType::Set); // Returns null.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer a var_dump() (possible using ::class) with a screen tag instead of a comment, as those are more annoying for translations.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. In that case, do we even need the screen tag anymore? Just have it show output and leave it to the new wasm runner.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I have php/web-php#1180 to reuse the output.

I don't see the point in forcing everyone to run WASM, and require JS, just to see the expected output.

Comment threadreference/reflection/reflectionproperty/gethooks.xml Outdated
Comment threadreference/reflection/reflectionproperty/gethooks.xml Outdated
Comment threadreference/reflection/reflectionproperty/getrawvalue.xml
Comment threadreference/reflection/reflectionproperty/getsettabletype.xml Outdated
Comment threadreference/reflection/reflectionproperty/isfinal.xml Outdated
Comment threadreference/reflection/reflectionproperty/isprivateset.xml Outdated
Comment threadreference/reflection/reflectionproperty/isprotectedset.xml
Comment threadreference/reflection/reflectionproperty/isvirtual.xml Outdated
Comment threadreference/reflection/reflectionproperty/isvirtual.xml Outdated
@Girgias

Copy link
Copy Markdown
Member

I didn't realize, but @Crell you didn't address some of the review comments.

@Crell

Copy link
Copy Markdown
ContributorAuthor

Switched all the examples to generate output. I did not include the output, because it's a hassle to do and we now have the Wasm runner that will produce it for us on-demand.

@Crell

Copy link
Copy Markdown
ContributorAuthor

@Girgias Which comments haven't been addressed?

@GirgiasGirgias left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Output of examples is missing.

@Crell

Copy link
Copy Markdown
ContributorAuthor

I disagree that manually pre-generating the output is worthwhile now that we have the Wasm runner. If someone else would like to modify the PR to include that, go ahead, but I have limited time with a baby now, so won't be doing so.

Comment threadreference/filesystem/functions/touch.xml Outdated
@philip

Copy link
Copy Markdown
Member

+1 to committing this.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PHP 8.4: ReflectionProperty methods related to property hooks are not documented

3 participants

@Crell@Girgias@philip