Access to an undefined property App\Forms\SomeForm::$presenter is not shown
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
Research direction
Start with the reproducer in the issue and inspect stubs/Application/UI/Component.stub, which is identified as the possible solution. Verify the undefined-property diagnostic for SomeForm::$presenter, then update the stub so the expected error is reported and rerun the reproduction to confirm the result.
Written by the indexing model from the issue text.
Description
Versions:
phpstan/phpstan-nette: 2.0.12
nette/application: 3.3.0
Bug Description
Error is not shown.
Steps To Reproduce
<?php declare(strict_types = 1);
namespace App\Forms;
use Nette\Application\UI\Control;
use Nette\Application\UI\Form;
final class SomeForm extends Control
{
public function render(): void
{
$this->getTemplate()->setFile(__DIR__ . '/someForm.latte')
->render();
}
protected function createComponentSomeForm(): Form
{
$form = new Form();
$form->addSubmit('edit', 'OK');
$form->onSuccess[] = function (Form $form, array $values): void {
$this->presenter->redirect('this')
};
return $form;
}
}
Expected error:
------ --------------------------------------------------------------------------------------------------------
Line app/Forms/SomeForm.php
------ --------------------------------------------------------------------------------------------------------
24 Access to an undefined property App\\Forms\SomeForm::$presenter.
🪪 property.notFound
💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
------ --------------------------------------------------------------------------------------------------------
Possible Solution
update stub file in stubs/Application/UI/Component.stub
<?php
namespace Nette\Application\UI;
/**
* @property-deprecated Presenter $presenter
* @property-read bool $linkCurrent
* @phpstan-implements \ArrayAccess<string, \Nette\ComponentModel\IComponent>
*/
abstract class Component implements \ArrayAccess
{
}
- Dominant language
- PHP
- Stars
- 118
- Forks
- 44
- Avg merge
- 17d 5h
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from phpstan/phpstan-nette
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
phpstan/phpstan-nette#147 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
phpstan/phpstan-nette#141 · 6 comments ·
-
Dependency Dashboard Open
Difficulty 4/5 3-5 days Newbie friendliness 20/100
phpstan/phpstan-nette#94 ·
-
Form events errors Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
phpstan/phpstan-nette#82 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
phpstan/phpstan-nette#77 · 4 comments ·
All issues in phpstan/phpstan-nette
Similar issues
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/fulltextsearch#1011 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/static-site-importer#1767 ·