Skip to content

Call to an undefined method Nette\DI\Definitions\Definition::setFactory(). #263

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

Closed
janbarasek opened this issue Sep 29, 2021 · 3 comments
Closed

Comments

@janbarasek
Copy link
Contributor

janbarasek commented Sep 29, 2021

Version: 3.0.10

Bug Description

The new version 3.0.10 introduces a fatal bug in all my opensource packages. The following error is reported in PhpStan:

Snímek obrazovky 2021-09-29 v 22 15 45

Used code snippet:

final class AdminBarExtension extends CompilerExtension
{
	public function beforeCompile(): void
	{
		$builder = $this->getContainerBuilder();
		$builder->addDefinition($this->prefix('basicPanel'))
			->setFactory(BasicPanel::class) // error is here
			->setAutowired(BasicPanel::class);
	}

May I ask why?

Steps To Reproduce

https://github.com/baraja-core/admin-bar/runs/3746137042?check_suite_focus=true


Snímek obrazovky 2021-09-29 v 22 17 02

@mabar
Copy link
Contributor

mabar commented Sep 29, 2021

Introduced by this commit 927cf12#diff-b9daf4dddf386ed0ba9c34d1760c4e76f4591b537f1837637c40d4dba0b4ab72L58-R60

Generics probably should not be used because it's not clear what should happen when T is not defined. Even case with T defined is not clear - nothing says it will return T and not ServiceDefinition

@jaroslavlibal
Copy link

@dg Would it be possible to tag the partial revert please? So that we can remove the fixation of version 3.0.9 in composer. Thanks a lot!

@dg
Copy link
Member

dg commented Oct 4, 2021

It is not such a major bug, so I will wait to release the new version.

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

No branches or pull requests

4 participants