Review Request 115299: Add support for trait uses to kdev-php

Heinz Wiesinger pprkut at liwjatan.at
Mon Feb 3 18:19:55 UTC 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/115299/
-----------------------------------------------------------

(Updated Feb. 3, 2014, 6:19 p.m.)


Review request for KDevelop.


Changes
-------

Split trait method import into a separate function
Better duchain locking when dealing with trait alias statements


Bugs: 305779
    http://bugs.kde.org/show_bug.cgi?id=305779


Repository: kdev-php


Description
-------

Add support for trait uses, as introduced in PHP 5.4.
This can be syntax as simple as

class A {
  use B;
}

or as complicated as

class A {
  use B,C,D {
    B::one insteadof C,D;
    C::two as foo;
    D::three as protected bar;
  }
}

allowing changing both function name and visibility. Additionally this syntax allows manual conflict resolution.

The error messages I used are as close as possible to the actual errors given by PHP. We check for
- invalid function modifiers (static, final)
- property name conflicts between traits and main class
- method name conflicts between multiple traits


Diffs (updated)
-----

  duchain/tests/expressionparser.h 0e59aab68c2d8a9c9b8cee84d237f921c29a5c9f 
  duchain/tests/expressionparser.cpp cb0045ca733cd3b382aeddf574520307a2144e80 
  duchain/tests/uses.h b97f15b8bfed391b236e92aee3a4efa9d589d451 
  duchain/tests/uses.cpp 8ae049c1a5a96db9ed03eeed24a01e86dbb88ac3 
  parser/php.g 9271989f5ea83dd5974ad5962b75b974edd0212a 
  parser/phplexer.cpp 3a0a57dac6e7ebbe3e2c7d59912dc289bc25f71f 
  completion/context.cpp e7d4335adc2157c3ffa2b4aad23613837f675d61 
  duchain/builders/declarationbuilder.h 826bbb5d87cc3408c326cdf34191405907a6e1bf 
  duchain/builders/declarationbuilder.cpp 0d45d86e1d992cf0d5aeea7264797c5d91e59f5f 
  duchain/builders/usebuilder.h af10294ea72d6b9ac156e7ca31745d17a5c4c1db 
  duchain/builders/usebuilder.cpp 32c2490efe19958d9d9b4ae93796fc6e2fdaf42c 
  duchain/navigation/declarationnavigationcontext.h 5ea31346522b2f24f1864b2876da6a3b9ddecba8 
  duchain/navigation/declarationnavigationcontext.cpp 08d01425a0a94b3a65774141476783f9ce3a304c 

Diff: https://git.reviewboard.kde.org/r/115299/diff/


Testing
-------

Unit tests, parsing local test files


Thanks,

Heinz Wiesinger

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20140203/67ab74a3/attachment.html>


More information about the KDevelop-devel mailing list