Commit Graph

32 Commits

Author SHA1 Message Date
Stefan Marr
4591498df7 Fixed Bug #60153 (Interface method prototypes not enforced when implementd via traits.)
# Moved the freeing of overriden functions to a point after the check.
# The new check comes after the normal inheritance check to give the first check
# the opportunity to abort with a more detailed error.
# Also fixed a small type in an unrelated test.
2011-11-01 15:25:24 +00:00
Stefan Marr
9b0d73af1d Added missing consistency check for abstract methods required by one trait and implemented by another. 2011-11-01 13:42:53 +00:00
Stefan Marr
b5f15ef561 Fixed Bug #60145 (Usage of trait's use statement inside interfaces not properly checked.) 2011-11-01 00:39:10 +00:00
Stefan Marr
2e5d5e5ac6 Fixed Bug #60173 (Wrong error message on reflective trait instantiation) 2011-10-31 22:59:00 +00:00
Stefan Marr
e14354af21 Fixed Bug #55554 (Legacy constructors not handled properly) [TRAITS] [DOC]
# The handling of legacy constructors defined by traits was corrected.
# They are now properly registered and used on instantiation.
# The situation for conflicting legacy and __construct constructors is
# mostly identical. If they are defined in the class, they override conflicts
# and do not collide. However, in case different styles are mixed, between
# class and trait definition, we assume a programmer's mistake and report
# a collision.
#
# BTW: +1 for all the fixed tests! `make test` is fun again.
2011-10-09 11:13:27 +00:00
Xinchen Hui
c58f254354 Improve the warning message of incompatible arguments. (#55719)
And fix tests related.
2011-09-23 15:08:11 +00:00
Stefan Marr
117e072941 Fixed bug #55524 Traits should not be able to extend a class
# also used the Z_STRVAL where it seemed appropriate
2011-08-29 15:53:46 +00:00
Stefan Marr
4a51ea4b81 Bug #55424 Fatal error when calling a method from a trait that is defined in parent class and required by using an abstract method in the trait.
# The method got unconditionally deleted from the class, since it was assumed that we override it, but we did not in case of abstract methods coming from a trait. Thus, dont delete when we try to merge in an abstract method.
2011-08-15 22:16:58 +00:00
Stefan Marr
0500cffb2e Fixed Bug #55355: Inheritance chain was not regarded when checking whether the abstract method of a trait is satisfied. 2011-08-15 11:16:18 +00:00
Stefan Marr
f2ed1242d6 Fixed Bug #55372 Incorrect handling of literals led to memory corruption.
# Dmitry you might want to review this patch, since I split up zend_add_literal
# and added a version for post-pass_two() usage.
2011-08-15 09:54:06 +00:00
Stefan Marr
65cbcb3be9 Fixed Bug #55214 use of __CLASS__ within trait returns trait name not class name [TRAITS] [DOC] 2011-07-31 18:18:56 +00:00
Stefan Marr
0158804a15 Added __TRAIT__ magic constant [TRAITS] [DOC]
# __TRAIT__ behaves like __CLASS__ more or less but is constraint to traits.
# Since traits are not types, there are not many valid use cases, and trying
# to use __TRAIT__ to make traits more like classes is discouraged.
2011-07-31 17:39:30 +00:00
Stefan Marr
858164624d Fixed test which was assuming that E_STRICT is not on by default. 2011-07-31 16:15:40 +00:00
Stefan Marr
9f66085649 Fixed bug in the handling of conflicting property initializers for traits.
# Bug was uncovered by discussion in http://news.php.net/php.internals/54129
# Forgot to check the actual value of the initializer comparison, only checked
# whether comparison was successful which is not enough.
2011-07-23 13:48:07 +00:00
Stefan Marr
52b81b8566 Added test case which was only added to trunk, bug seems to be fixed already. 2011-07-23 13:42:58 +00:00
Stefan Marr
8ba00176f1 Fixed a inconsitent condition for aliasing traits.
- missed a failing Traits test, but is now fixed, and the bug covered by a dedicated test
# Should always comment conditions that go over more than two lines :-/
2011-05-13 20:28:34 +00:00
Stefan Marr
7357867bac Added strict handling of properties in traits.
# This is the first attempt to implement the properties as discussed on the mailinglist.
# RFC is not updated to reflect this changes, yet.
2010-12-20 00:52:40 +00:00
Stefan Marr
1d2a63da5f Changed collision warning for Traits to fatal error.
#This change is made to have all possible cases of collisions consistently handled as fatal errors.
#The reason to have it fatal is that most likely something changed unexpectedly and needs urgent attention by the developer, since it will fail eventually anyway for instance because the expected method is missing in the class.
#Discussed in this thread: http://marc.info/?l=php-internals&m=129155790226876
2010-12-12 16:48:02 +00:00
Stefan Marr
4cc45507da Fixed problem reported by Patrick ALLAERT. Trait method was not applied properly when fully qualified. 2010-11-18 17:59:04 +00:00
Stefan Marr
6ad5c889a1 Added tests to for static support of traits.
# This was not tested and documented yet.
# Updated documentation in the RFC http://wiki.php.net/rfc/horizontalreuse
2010-11-17 23:05:20 +00:00
Stefan Marr
e6bd5368ad Fixed issue with statics in traits.
#Please review this change, I moved the routine which copies statics from the closure code to zend_variables.c
#Please also have a look to check whether the TSRMLS_DC is correct, and whether it fits with the rest in zend_variables, because there you are using some macro magic and I am not exactly sure what the reason is for that.
2010-06-08 15:56:36 +00:00
Johannes Schlüter
0262fdf3e9 - A method called like a trait is no constructor 2010-05-29 20:01:08 +00:00
Felipe Pena
a7c129af16 - Fix typo (take 3! thanks Chris and Tony) 2010-05-07 17:57:09 +00:00
Felipe Pena
91c46fd26e - Fix error message wording (Kalle) 2010-05-07 17:18:49 +00:00
Felipe Pena
c95b4ace40 - Fixed ZEND_VERIFY_ABSTRACT_CLASS order when using traits
# It's the last one now, thus the traits can be used to implement interfaces
2010-05-07 16:29:15 +00:00
Felipe Pena
74fe9dd89e - Fixed magic method and constructor copy for traits 2010-05-07 13:55:27 +00:00
Felipe Pena
5d701938a3 - Added check for constant creation on Traits
- Simplified trait flag check
- Test++ :)
2010-05-07 11:09:35 +00:00
Felipe Pena
7b7463bb8a - New tests 2010-05-06 19:21:11 +00:00
Felipe Pena
ba5edd5035 - New tests 2010-05-06 15:49:58 +00:00
Felipe Pena
6e8db0b35a - New tests 2010-05-04 19:06:13 +00:00
Stefan Marr
05a9649043 Changed the exclusion keyword from 'instead' to 'insteadof'. [TRAITS]
#That was suggested several times already, but am still not sure whether that really reads better.
#Especially since only the trait is mentioned, since the method name would be duplicated anyway.
2010-04-22 21:56:55 +00:00
Stefan Marr
b501570ab0 Added traits test cases. No engine changes for now. [TRAITS]
#Getting accustomed to the infrastructure.
#Any comments are welcome, especially with regard to syntax and keywords.
2010-04-15 21:39:20 +00:00