Improved type detection for object properties.
ClosedPublic

Authored by pprkut on Aug 16 2018, 12:28 PM.

Details

Summary

This should solve long standing bugs that make kdev-php difficult
to use with common PHP frameworks.

  • Properly resolve namespaced identifiers for type information in the phpdoc block
  • Default type for class properties without assigned value is now NULL instead of 'mixed' (if no other type is specified in the phpdoc block)
  • The NULL type is replaced on first assignment to the property.

BUG: 241750
BUG: 295866
FIXED-IN: 5.3.0

Diff Detail

Repository
R52 KDevelop: PHP Support
Branch
classes
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 1910
Build 1928: arc lint + arc unit
pprkut created this revision.Aug 16 2018, 12:28 PM
Restricted Application added a project: KDevelop. · View Herald TranscriptAug 16 2018, 12:28 PM
Restricted Application added a subscriber: kdevelop-devel. · View Herald Transcript
pprkut requested review of this revision.Aug 16 2018, 12:28 PM
pprkut updated this revision to Diff 39855.Aug 16 2018, 1:14 PM

Added more unit tests for bugs fixed by this :)

pprkut edited the summary of this revision. (Show Details)Aug 16 2018, 1:15 PM
brauch accepted this revision.Aug 17 2018, 9:41 AM
brauch added a subscriber: brauch.

Maybe you make the the visitAssignment code a bit more readable by breaking it up into 2-3 functions?

If you tend to the inline notes, this does not look too wrong ...

duchain/builders/declarationbuilder.cpp
1197

move this down below the next condition, it doesn't need it

1215

I don't think you are allowed to unlock the lock here, you are still using the items below ... but in the builder code, stuff like this usually works because you have the parse lock in addition, so no idea.

1226

replace by: DUChainWriteLocker wlock;

1228

remove this, it's unlocked automatically here anyways

1248

as above

1270

remove

This revision is now accepted and ready to land.Aug 17 2018, 9:41 AM

Splitting some code out into a separate function is a bit more tricky than I thought. I have prototype code for it, but it just doesn't quite work right (unit tests don't pass :( ).
I'll merge it for now the way it is and have a look at the refactored version after.

This revision was automatically updated to reflect the committed changes.