nullable = $nullable; return parent::__invoke($data, $nullable); } private function nullCheck($data) : bool { if ($this->nullable && $data == null) { return true; } return false; } public function instance($data, $fqcn): bool { return $this->nullCheck($data) || parent::__instance($data, $fqcn); } public function property($data, $property, $value): bool { return $this->nullCheck($data) || ((property_exists($data, $property) || property_exists($data, '__get')) && $data->$property == $value); } public function method($data, $method, $value): bool { return $this->nullCheck($data) || ((method_exists($data, $method) || method_exists($data, '__call')) && $data->$method() == $value); } }