Bug->Doc #73195 [Opn]: ReflectionClass::getMethod() filter arguments doesn't accept combinations

From: Date: Wed, 28 Sep 2016 10:05:11 +0000
Subject: Bug->Doc #73195 [Opn]: ReflectionClass::getMethod() filter arguments doesn't accept combinations
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-13947@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73195&edit=1 ID: 73195 User updated by: grgtvs at gmail dot com Reported by: grgtvs at gmail dot com Summary: ReflectionClass::getMethod() filter arguments doesn't accept combinations Status: Open -Type: Bug +Type: Documentation Problem Package: Reflection related Operating System: GNU/Linux PHP Version: Irrelevant Block user comment: N Private report: N New Comment: This seems just to be an undocumented issue not a bug Previous Comments: ------------------------------------------------------------------------ [2016-09-28 09:35:01] grgtvs at gmail dot com Description: ------------ It seems that when using filters argument with combinations of the constants ReflectionMethod::IS_STATIC, ReflectionMethod::IS_PUBLIC, ReflectionMethod::IS_PROTECTED, ReflectionMethod::IS_PRIVATE, ReflectionMethod::IS_ABSTRACT, ReflectionMethod::IS_FINAL - e.g $reflectionClassObj->getMethod(~ReflectionMethod::IS_PUBLIC) or $reflectionClassObj->getMethod(ReflectionMethod::IS_PUBLIC & ~ReflectionMethod::IS_STATIC) etc. the method tends to return every method as it would do without defining any filters. I've tried this on PHP 5.5.9 as well as at 7.0.8 and the result is the same. Test script: --------------- class MyClass { final public function iamFinalPublic() { } public function iamPublic() { } } function testReflection() { $refl = new ReflectionClass(MyClass::class); $methods = $refl->getMethods(~ReflectionMethod::IS_PUBLIC); return count($methods); } echo testReflection(); Expected result: ---------------- 0 Actual result: -------------- 2 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73195&edit=1

« previous php.doc.bugs (#13947) next »