Skip to content

Object and Filter Support #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 6, 2020
Merged

Object and Filter Support #5

merged 6 commits into from
Apr 6, 2020

Conversation

kooldev
Copy link

@kooldev kooldev commented Apr 5, 2020

This PR implements ReflectionAttribute::getAsObject() and the $name argument of getAttributes(). I changed the signature to getAttributes(?string $name = null, bool $inheritance = false) to provide both name and instanceof matching. It could make sense to change the bool argument into a flags argument to have a more extensible filter behavior.

This addresses "Required work" items:

  • Autoload classes after resolving
  • ReflectionAttribute::getAsObject implementation.
  • Implement $name filter for attribute or subclass of

I moved all the test cases into a subfolder called attributes, this makes it easier to run just these tests using make test TESTS=./Zend/tests/attributes/ and it is easier to locate them.

@beberlei beberlei merged commit 5d06c35 into beberlei:Attributes Apr 6, 2020
@kooldev kooldev deleted the Attributes branch April 11, 2020 10:42
beberlei pushed a commit that referenced this pull request Jun 19, 2021
Part of generated opcodes for $foo are:

  ...
  BB1:
  0002 INIT_FCALL 1 96 string("foo")
  0003 #5.V1 [rcn, object (instanceof A)] = FETCH_THIS
  0004 SEND_REF #5.V1 [rcn, object (instanceof A)] 1
  0005 DO_UCALL

Updates in functions zend_jit_fetch_this() and zend_jit_load_this() are
made to support FETCH_THIS opcode.

One new path is covered in function zend_jit_send_ref()  by SEND_REF
opcode.
Sign up for free to 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.

2 participants