From e0469351371e0db5e2bcc816a7a50e1249033356 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Wed, 30 Dec 2020 12:43:46 +0100 Subject: [PATCH] Strict: refactoring --- src/Dibi/Strict.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Dibi/Strict.php b/src/Dibi/Strict.php index eded91f7..f3386c5b 100644 --- a/src/Dibi/Strict.php +++ b/src/Dibi/Strict.php @@ -46,7 +46,7 @@ public function __call(string $name, array $args) public static function __callStatic(string $name, array $args) { $rc = new ReflectionClass(static::class); - $items = array_intersect($rc->getMethods(ReflectionMethod::IS_PUBLIC), $rc->getMethods(ReflectionMethod::IS_STATIC)); + $items = array_filter($rc->getMethods(\ReflectionMethod::IS_STATIC), function ($m) { return $m->isPublic(); }); $items = array_map(function ($item) { return $item->getName(); }, $items); $hint = ($t = Helpers::getSuggestion($items, $name)) ? ", did you mean $t()?" @@ -68,7 +68,7 @@ public function &__get(string $name) return $ret; } $rc = new ReflectionClass($this); - $items = array_diff($rc->getProperties(ReflectionProperty::IS_PUBLIC), $rc->getProperties(ReflectionProperty::IS_STATIC)); + $items = array_filter($rc->getProperties(ReflectionProperty::IS_PUBLIC), function ($p) { return !$p->isStatic(); }); $items = array_map(function ($item) { return $item->getName(); }, $items); $hint = ($t = Helpers::getSuggestion($items, $name)) ? ", did you mean $$t?" @@ -84,7 +84,7 @@ public function &__get(string $name) public function __set(string $name, $value) { $rc = new ReflectionClass($this); - $items = array_diff($rc->getProperties(ReflectionProperty::IS_PUBLIC), $rc->getProperties(ReflectionProperty::IS_STATIC)); + $items = array_filter($rc->getProperties(ReflectionProperty::IS_PUBLIC), function ($p) { return !$p->isStatic(); }); $items = array_map(function ($item) { return $item->getName(); }, $items); $hint = ($t = Helpers::getSuggestion($items, $name)) ? ", did you mean $$t?"