-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add FieldDescriptionOptions psalm type
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,8 @@ | |
* | ||
* @author Thomas Rabaix <[email protected]> | ||
* | ||
* @psalm-import-type FieldDescriptionOptions from FieldDescriptionInterface | ||
* | ||
* @method void setFieldMapping(array $fieldMapping) | ||
* @method void setAssociationMapping(array $associationMapping) | ||
* @method void setParentAssociationMappings(array $parentAssociationMappings) | ||
|
@@ -141,6 +143,9 @@ abstract class BaseFieldDescription implements FieldDescriptionInterface | |
|
||
/** | ||
* NEXT_MAJOR: Remove the null default value for $name and restrict param type to `string`. | ||
* | ||
* @psalm-param FieldDescriptionOptions $options | ||
* @phpstan-param array<string, mixed> $options | ||
*/ | ||
public function __construct( | ||
?string $name = null, | ||
|
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 |
---|---|---|
|
@@ -14,10 +14,46 @@ | |
namespace Sonata\AdminBundle\Admin; | ||
|
||
use Sonata\AdminBundle\Exception\NoValueException; | ||
use Symfony\Component\Form\DataTransformerInterface; | ||
use Symfony\Component\PropertyAccess\PropertyPathInterface; | ||
|
||
/** | ||
* @author Thomas Rabaix <[email protected]> | ||
* | ||
* @psalm-type FieldDescriptionOptions = array{ | ||
* accessor?: string|callable|PropertyPathInterface, | ||
* actions?: array, | ||
* admin_code?: string, | ||
* associated_property?: string, | ||
* block_name?: string, | ||
* catalogue?: string, | ||
* data_transformer?: DataTransformerInterface, | ||
* edit?: string, | ||
* editable?: bool, | ||
* field_name?: string, | ||
* field_options?: array, | ||
* field_type?: string, | ||
* header_class?: string, | ||
* identifier?: bool, | ||
* inline?: string, | ||
* label?: bool|string|null, | ||
* link_parameters?: array, | ||
* multiple?: bool, | ||
* placeholder?: string, | ||
* required?: bool, | ||
* role?: string|string[], | ||
* route?: array, | ||
* safe?: bool, | ||
* sort_field_mapping?: array, | ||
* sort_parent_association_mappings?: array, | ||
* sortable?: bool, | ||
* template?: string, | ||
* timezone?: string|\DateTimeZone, | ||
* translation_domain?: string, | ||
* type?: string, | ||
* virtual_field?: bool | ||
* } | ||
* | ||
* @method string|null getTargetModel() | ||
* @method bool hasAdmin() | ||
* @method bool hasParent() | ||
|
@@ -105,13 +141,19 @@ public function setOption($name, $value); | |
* - template. | ||
* | ||
* Then the value are copied across to the related property value | ||
* | ||
* @psalm-param FieldDescriptionOptions $options | ||
* @phpstan-param array<string, mixed> $options | ||
*/ | ||
public function setOptions(array $options); | ||
|
||
/** | ||
* Returns options. | ||
* | ||
* @return array<string, mixed> options | ||
* | ||
* @psalm-return FieldDescriptionOptions | ||
* @phpstan-return array<string, mixed> | ||
*/ | ||
public function getOptions(); | ||
|
||
|
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