Skip to content

Commit

Permalink
Added form for testing static analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
matt committed Feb 25, 2024
1 parent a0b4a21 commit dd4d4f7
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<UnusedClass>
<errorLevel type="suppress">
<directory name="test/Locator/Asset"/>
<directory name="test/StaticAnalysis"/>
</errorLevel>
</UnusedClass>
</issueHandlers>
Expand Down
27 changes: 27 additions & 0 deletions test/StaticAnalysis/Album.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

namespace KynxTest\Laminas\FormShape\StaticAnalysis;

use Laminas\Form\Element\Hidden;
use Laminas\Form\Element\Number;
use Laminas\Form\Element\Select;
use Laminas\Form\Element\Text;
use Laminas\Form\Fieldset;

final class Album extends Fieldset
{
/**
* @param int|null|string $name
*/
public function __construct($name = null, array $options = [])
{
parent::__construct($name, $options);

$this->add(new Hidden('id'));
$this->add(new Text('title'));
$this->add(new Select('genre', ['value_options' => [1 => 'Punk', 2 => 'Shlock']]));
$this->add(new Number('chart_position', ['min' => 1, 'max' => 100]));
}
}
27 changes: 27 additions & 0 deletions test/StaticAnalysis/Artist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

namespace KynxTest\Laminas\FormShape\StaticAnalysis;

use Laminas\Form\Element\Collection;
use Laminas\Form\Element\Hidden;
use Laminas\Form\Element\Text;
use Laminas\Form\Form;

final class Artist extends Form
{
/**
* @param int|null|string $name
*/
public function __construct($name = null, array $options = [])
{
parent::__construct($name, $options);

$this->add(new Hidden('id'));
$this->add(new Text('name'));
$collection = new Collection('albums');
$collection->setTargetElement(new Album());
$this->add($collection);
}
}

0 comments on commit dd4d4f7

Please sign in to comment.