Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0134a2b
commit 7f53887
Showing
7 changed files
with
143 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Bdf\Form\StaticAnalysis; | ||
|
||
use Bdf\Form\Aggregate\ArrayElement; | ||
use Bdf\Form\Aggregate\ArrayElementBuilder; | ||
use Bdf\Form\Aggregate\FormBuilderInterface; | ||
use Bdf\Form\Custom\CustomForm; | ||
|
||
class ArrayElementConfigure extends CustomForm | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function configure(FormBuilderInterface $builder): void | ||
{ | ||
$builder->array('values')->element(ArrayElement::class, function (ArrayElementBuilder $builder) {}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace Bdf\Form\StaticAnalysis; | ||
|
||
use Bdf\Form\Aggregate\FormBuilderInterface; | ||
use Bdf\Form\Custom\CustomForm; | ||
|
||
/** | ||
* @extends CustomForm<MyGeneratedEntity> | ||
*/ | ||
class MyCustomForm extends CustomForm | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function configure(FormBuilderInterface $builder): void | ||
{ | ||
$builder->generates(MyGeneratedEntity::class); | ||
|
||
$builder->string('foo')->length(['min' => 1])->getter()->setter(); | ||
$builder->string('bar')->required()->getter()->setter(); | ||
} | ||
|
||
public static function test() | ||
{ | ||
$form = new MyCustomForm(); | ||
$form->submit(['foo' => 'a', 'bar' => 'b']); | ||
self::check($form->value()); | ||
} | ||
|
||
public static function check(?MyGeneratedEntity $entity): void | ||
{ | ||
|
||
} | ||
} | ||
|
||
class MyGeneratedEntity | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
public $foo; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public $bar; | ||
} |