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

Removing useless trait Nette\StaticClass #40

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

mildabre
Copy link

Use trait Nette\StaticClass in RouterFactory is useless, the function is to prevent creating instance + throw exception when calling non-callable static function. This function is over management, every web developer can use static method on class the correct way without this trait.

Above that the method createRouter() itself MUST NOT be inevitably as static, we can create instance of RouterFactory, register as service @routerFactory and use standard non-static method to create Router:

#	router:
#		create: App\Router\RouterFactory::createRouter()  # static

	routerFactory:
		class: App\Router\RouterFactory

	router:
		create: @routerFactory::create()  #non-static

But feel free to have in the Nette web-project RouterFactory with static method as before, but please remove the unnecessary trait.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants