summaryrefslogtreecommitdiff
path: root/zend
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-06-15 17:07:36 +0200
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-06-15 17:07:36 +0200
commit4b984fe0810a7f46fc01639f12feccdaacf6cc86 (patch)
treecfe0fcf389f853de53c3d13c1b37be464b55f6d4 /zend
parent76f8a944540a84b6a5c98135bd9f9e6e996fe37d (diff)
added extra check for abstract keyword when adding abstract methods for interfaces
Diffstat (limited to 'zend')
-rw-r--r--zend/classimpl.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/zend/classimpl.h b/zend/classimpl.h
index 5d0ab60..18802e3 100644
--- a/zend/classimpl.h
+++ b/zend/classimpl.h
@@ -414,7 +414,15 @@ public:
* @param flags Optional flags (like public or protected)
* @param args Description of the supported arguments
*/
- void method(const char *name, int flags=0, const Arguments &args = {}) { _methods.push_back(std::make_shared<Method>(name, (flags & (MethodModifiers | Static)) | Abstract , args)); }
+ void method(const char *name, int flags=0, const Arguments &args = {})
+ {
+ // the "MethodModifiers" holds all the valid modifiers for a method: Final + Public + Protected + Private.
+ // The "Static" and "Abstract" properties are also valid modifiers in this context (in fact, you would
+ // expect that we could even force adding "Abstract" here, because we're adding an abstract method -- but
+ // in a PHP interface the "Abstract" modifier is not allowed - even though it is of course abstract.
+ // So we only _allow_ abstract here, and expect the caller to _set_ it.
+ _methods.push_back(std::make_shared<Method>(name, (flags & (MethodModifiers | Static | Abstract)), args));
+ }
/**
* Add a property to the class