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

Increase event name readability/writability #96

Closed
gianarb opened this issue Oct 19, 2015 · 6 comments · Fixed by #147
Closed

Increase event name readability/writability #96

gianarb opened this issue Oct 19, 2015 · 6 comments · Fixed by #147

Comments

@gianarb
Copy link
Contributor

gianarb commented Oct 19, 2015

I know that this proposal broke compatibility but I think to change

My proposal is:
To change classname.method (indexcontroller.index) with class.method.. In this way we can replace

$eventManager->attach("indexcontroller.index", ...)

with

$eventManager->attach(IndexController::class.".index", ...)

Maybe this approach is more readable/writable.. What do you think?

@EmanueleMinotto
Copy link
Contributor

I think a :: should be used as separator for systems like that, this separator is also used "natively" by PHP to invoke static method: http://php.net/manual/en/language.types.callable.php (Example 1, Type 4)

@gianarb
Copy link
Contributor Author

gianarb commented Oct 20, 2015

I use this syntax to print the namespace.. IndexController::class
IndexController::class.".index" == "App\Controller\IndexController.index"}

@EmanueleMinotto
Copy link
Contributor

@gianarb reuse it? :D

@gianarb
Copy link
Contributor Author

gianarb commented Oct 31, 2015

Guys.. Feedback to change this code?!
@pennyphp/community-review @wdalmut @EmanueleMinotto

IMO indexcontroller.index is very very very very ugly..

App\Controller\IndexController.index
App\Controller\IndexController.index_error
maybe it sounds better

@samsonasik
Copy link
Member

+1 for ::class usage

@samsonasik
Copy link
Member

also, classname.method make collision when there is same classname but different namespace

samsonasik added a commit to samsonasik/penny that referenced this issue Nov 29, 2015
gianarb pushed a commit that referenced this issue Nov 29, 2015
Fixes #96 , implements ClassName::class prefix for event name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants