-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added attribute for marking forms and fieldsets as having customised …
…type
- Loading branch information
matt
committed
Feb 24, 2024
1 parent
6e377d9
commit 048c90a
Showing
8 changed files
with
161 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kynx\Laminas\FormShape\Attribute; | ||
|
||
use Attribute; | ||
|
||
/** | ||
* Marks a form or fieldset as having a custom type | ||
* | ||
* The class will be loaded and any child fieldsets will be processed, but changes will not be written to disk. Provide | ||
* the `@psalm-type` so it can be imported by other forms and fieldsets. | ||
*/ | ||
#[Attribute(Attribute::TARGET_CLASS)] | ||
final readonly class PsalmTypeCustomised | ||
{ | ||
public function __construct(public string $psalmType) | ||
{ | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace KynxTest\Laminas\FormShape\Form\Asset; | ||
|
||
use Kynx\Laminas\FormShape\Attribute\PsalmTypeCustomised; | ||
use Laminas\Form\Fieldset; | ||
|
||
#[PsalmTypeCustomised('TCustomType')] | ||
final class CustomFieldset extends Fieldset | ||
{ | ||
} |
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,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace KynxTest\Laminas\FormShape\Form\Asset; | ||
|
||
use Kynx\Laminas\FormShape\Attribute\PsalmTypeCustomised; | ||
use Laminas\Form\Form; | ||
|
||
#[PsalmTypeCustomised('TFormType')] | ||
final class CustomForm extends Form | ||
{ | ||
} |
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,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace KynxTest\Laminas\FormShape\Form\Asset; | ||
|
||
use Kynx\Laminas\FormShape\Attribute\PsalmTypeIgnore; | ||
use Laminas\Form\Fieldset; | ||
|
||
#[PsalmTypeIgnore] | ||
final class IgnoredFieldset extends Fieldset | ||
{ | ||
} |
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