Skip to content

Events.php on method $callable parameter accepts only callable #1835

Description

@d4mn

name: Bug report
about: Help us improve the framework by reporting bugs!


Describe the bug
All these methods:

  • Events::on('create', 'myFunction'); // procedural function
  • Events::on('create', ['myClass', 'myMethod']); // Class::method
  • Events::on('create', [$myInstance, 'myMethod']); // Method on an existing instance
    Throws an error because argument $callable in function public static function on($event_name, callable $callback, $priority = EVENT_PRIORITY_NORMAL) must be of type callable string and array throws an error

CodeIgniter 4 version
Codeigniter 4 beta 1

Affected module(s)
Events.php

Expected behavior, and steps to reproduce if appropriate
method should not be strict checked in functions attribute

Context

  • OS: Debian
  • Web server nginx 1.15
  • PHP version v7.3.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions