[Nette] Add ChangeFormArrayAccessToAnnotatedControlVariableRector

This commit is contained in:
TomasVotruba 2020-07-23 12:57:52 +02:00
parent 91302f50af
commit 407e0c4d33

View File

@ -0,0 +1,37 @@
<?php
namespace Rector\Nette\Tests\Rector\ArrayDimFetch\ChangeFormArrayAccessToAnnotatedControlVariableRector\Fixture;
use Nette\Application\UI\Form;
class SelectBoxPresenter
{
public function run()
{
$form = new Form();
$this->addText('email', 'Email');
$form['email']->value = 'hey@hi.hello';
}
}
?>
-----
<?php
namespace Rector\Nette\Tests\Rector\ArrayDimFetch\ChangeFormArrayAccessToAnnotatedControlVariableRector\Fixture;
use Nette\Application\UI\Form;
class SelectBoxPresenter
{
public function run()
{
$form = new Form();
$this->addText('email', 'Email');
/** @var \Nette\Forms\Controls\BaseControl $emailControl */
$emailControl = $form['email'];
$emailControl->value = 'hey@hi.hello';
}
}
?>