Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event handlers should be also possible to be callable not just closures #13322

Closed
pwilkowski opened this issue Mar 13, 2018 · 1 comment · Fixed by #15045
Closed

Event handlers should be also possible to be callable not just closures #13322

pwilkowski opened this issue Mar 13, 2018 · 1 comment · Fixed by #15045
Labels
new feature request Planned Feature or New Feature Request

Comments

@pwilkowski
Copy link

https://github.com/phalcon/cphalcon/blob/master/phalcon/events/manager.zep

Why Event handlers must be objects (ie. Closures)? It should be perfectly fine if event handlers would also be a callable as one of your comments says:

	/**
	 * Attach a listener to the events manager
	 *
	 * @param string eventType
	 * @param object|callable handler
	 * @param int priority
	 */
	public function attach(string! eventType, var handler, int! priority = 100)
	{
...
	}

Yet the first check in the function is:

		if typeof handler != "object" {
			throw new Exception("Event handler must be an Object");
		}

Details

  • Phalcon version: 3.2.4 (but it is present in master branch at this moment as well)
  • PHP Version: 7.0.0
  • Operating System: Windows
  • Installation type: From release page
  • Server: Nginx and Apache
@stale stale bot added the stale Stale issue - automatically closed label Jun 26, 2018
@stale stale bot closed this as completed Jun 27, 2018
@sergeyklay sergeyklay reopened this Jun 29, 2018
@stale stale bot removed the stale Stale issue - automatically closed label Jun 29, 2018
@stale stale bot added the stale Stale issue - automatically closed label Sep 27, 2018
@stale stale bot closed this as completed Sep 28, 2018
@phalcon phalcon deleted a comment from stale bot May 19, 2020
@phalcon phalcon deleted a comment from stale bot May 19, 2020
@niden niden reopened this May 19, 2020
@stale stale bot removed the stale Stale issue - automatically closed label May 19, 2020
@niden niden added 4.1.0 new feature request Planned Feature or New Feature Request labels May 19, 2020
@niden niden linked a pull request May 19, 2020 that will close this issue
5 tasks
@niden
Copy link
Member

niden commented May 19, 2020

Resolved in #15045

@niden niden closed this as completed May 19, 2020
@niden niden moved this to Released in Phalcon v5 Aug 25, 2022
@niden niden added this to Phalcon v5 Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature request Planned Feature or New Feature Request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants