Closed rootpd closed 1 year ago
It could be BaseControl, Form\Container or any other IComponent, if (let's say) 90% of your fields are BaseControl, you can create your own stub, where you override this: https://github.com/phpstan/phpstan-nette/blob/1.1.x/stubs/Forms/Container.stub#L11
@lulco Thanks a lot, this is exactly what I needed! :)
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Hi,
(first of all great work with the tool; kudos)
I'm trying to meet level 2 requirements on our Nette project. In presenter we're working with Nette Form components.
The issue I'm facing is, that PHPstan doesn't recognize my form elements as
BaseControl
even when I think it already should.I read https://github.com/phpstan/phpstan-nette/issues/27#issuecomment-412445961 and I got an impression, that @ondrejmirtes wanted form elements to always be a
BaseControl
. I can also see https://github.com/phpstan/phpstan-nette/blob/1.1.x/src/Type/Nette/FormsBaseControlDynamicReturnTypeExtension.php which seems like the thing that should handle it.Am I just wrong here and the assumption is incorrect?
This is what I execute:
This is the simplified
GeneratorPresenter
:Am I wrong thinking, that if PHPstan knows that the
$form
is of typeForm
, and thesorting
is a form element, that it is not justIComponent
, but aBaseControl
?Thanks a lot for the clarification.