support for $this as an array when implementing ArrayAccess
ClosedPublic

Authored by shashwatdixit on Feb 24 2017, 9:17 PM.

Diff Detail

Repository
R52 KDevelop: PHP Support
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
shashwatdixit created this revision.Feb 24 2017, 9:17 PM
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptFeb 24 2017, 9:17 PM
zhigalin accepted this revision.Feb 28 2017, 8:46 AM
This revision is now accepted and ready to land.Feb 28 2017, 8:46 AM
kfunk added a comment.Feb 28 2017, 8:47 AM

Could we please have a unit test for this?

See: duchain/tests/

added unit tests for valid and invalid use of this as array

previous one has some unnecessary debug lines

Rest LGTM

duchain/tests/duchain.cpp
2961

implements

2970–2972

no need

2994–2996

no need

duchain/tests/duchaintestbase.cpp
72 ↗(On Diff #11970)

unrelated; remove

shashwatdixit marked 3 inline comments as done.Feb 28 2017, 10:06 PM
content.append("interface Iterator { function rewind(); function current(); function key(); function next(); function valid(); } ");
content.append("interface ArrayAccess { function offsetExists($offset); function offsetGet($offset); function offsetSet($offset, $value); function offsetUnset($offset); }");

test fails without it It cannot find interface ArrayAccess. Similarly if i remove Iterator interface above it fails every test which implements Iterator . @zhigalin need help here thanks

zhigalin added inline comments.Feb 28 2017, 10:19 PM
duchain/tests/duchain.cpp
2960

Just prepend arrayaccess here

2989

Just prepend arrayaccess here

2990

class A implements ArrayAccess

duchain/tests/duchaintestbase.cpp
72 ↗(On Diff #11970)

Not a good idea to copy paste here stuff from php standard library

shashwatdixit marked 5 inline comments as done.

@zhigalin thanks

added wrong patch , I think I need sleep its 4:17 AM in my clock

Thanks for your work, going to commit it

kfunk accepted this revision.Mar 1 2017, 7:45 AM

Looks good I think.

zhigalin added inline comments.Mar 1 2017, 10:11 AM
duchain/builders/declarationbuilder.cpp
972

You should sleep more I think

973

style issue: braces are needed even for one-line statements

shashwatdixit marked 2 inline comments as done.
This revision was automatically updated to reflect the committed changes.