This extension provides following features:
Nette\ComponentModel\Container::getComponent()
knows type of the component because it reads the return type on createComponent*
(this works best in presenters and controls)Nette\DI\Container::getByType
and createInstance
return type based on first parameter (Foo::class
).Nette\Forms\Container::getValues
return type based on $asArray
parameter.Nette\ComponentModel\Component::lookup
return type based on $throw
parameter.Nette\Application\UI\Component::getPresenter
return type based on $throw
parameter.on*
propertiesUndefined variable
errorsNette\Utils\Strings::match()
and Nette\Utils\Strings::matchAll()
based on patternIt also contains these framework-specific rules (can be enabled separately):
AbortException
)To use this extension, require it in Composer:
composer require --dev phpstan/phpstan-nette
If you also install phpstan/extension-installer then you're all set!