Skip to content

Commit 320a14e

Browse files
committed
minor #47412 [Form] Add generics to DataTransformerInterface (VincentLanglet)
This PR was squashed before being merged into the 6.2 branch. Discussion ---------- [Form] Add generics to DataTransformerInterface | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | not really | Deprecations? | no | Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Now that some generics are added to the Symfony codebase, I think we could add more. For people using phpstan/psalm this will be helpful: - It avoid duplicating the generics in both psalm-plugin/phpstan-plugin - It avoid duplicating code between symfony and plugins - When phpstan/psalm report an error it's less confusing to look for the generic in the symfony file rather the plugin one. You can look at the current generic definition for psalm https://github.com/psalm/psalm-plugin-symfony/blob/master/src/Stubs/common/Component/Form/DataTransformerInterface.stubphp for phpstan https://github.com/phpstan/phpstan-symfony/blob/1.2.x/stubs/Symfony/Component/Form/DataTransformerInterface.stub Commits ------- dff26d39bf [Form] Add generics to DataTransformerInterface
2 parents 6a3eede + ea549fd commit 320a14e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Form/DataTransformer/CollectionToArrayTransformer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
/**
2020
* @author Bernhard Schussek <[email protected]>
21+
*
22+
* @implements DataTransformerInterface<Collection, array>
2123
*/
2224
class CollectionToArrayTransformer implements DataTransformerInterface
2325
{

0 commit comments

Comments
 (0)