From 52ea24b735aa1f52a62b6fa3cda4b3d59e33dce9 Mon Sep 17 00:00:00 2001 From: HypeMC Date: Thu, 20 Jun 2024 23:46:51 +0200 Subject: [PATCH 1/2] Copy v6 --- .../Controller/AbstractController.stubphp | 27 ++++++++++++++++ .../Component/HttpFoundation/InputBag.stubphp | 32 +++++++++++++++++++ .../HttpFoundation/ParameterBag.stubphp | 30 +++++++++++++++++ .../Component/HttpFoundation/Request.stubphp | 21 ++++++++++++ .../Normalizer/DenormalizerInterface.stubphp | 15 +++++++++ 5 files changed, 125 insertions(+) create mode 100644 src/Stubs/7/Bundle/FrameworkBundle/Controller/AbstractController.stubphp create mode 100644 src/Stubs/7/Component/HttpFoundation/InputBag.stubphp create mode 100644 src/Stubs/7/Component/HttpFoundation/ParameterBag.stubphp create mode 100644 src/Stubs/7/Component/HttpFoundation/Request.stubphp create mode 100644 src/Stubs/7/Component/Serializer/Normalizer/DenormalizerInterface.stubphp diff --git a/src/Stubs/7/Bundle/FrameworkBundle/Controller/AbstractController.stubphp b/src/Stubs/7/Bundle/FrameworkBundle/Controller/AbstractController.stubphp new file mode 100644 index 00000000..8bf41530 --- /dev/null +++ b/src/Stubs/7/Bundle/FrameworkBundle/Controller/AbstractController.stubphp @@ -0,0 +1,27 @@ + + * + * @psalm-param class-string $type + * + * @psalm-return FormInterface + */ + protected function createForm(string $type, $data = null, array $options = []): FormInterface {} +} diff --git a/src/Stubs/7/Component/HttpFoundation/InputBag.stubphp b/src/Stubs/7/Component/HttpFoundation/InputBag.stubphp new file mode 100644 index 00000000..b52d267c --- /dev/null +++ b/src/Stubs/7/Component/HttpFoundation/InputBag.stubphp @@ -0,0 +1,32 @@ + + */ + public $query; + + /** + * @psalm-var InputBag + */ + public $cookies; +} diff --git a/src/Stubs/7/Component/Serializer/Normalizer/DenormalizerInterface.stubphp b/src/Stubs/7/Component/Serializer/Normalizer/DenormalizerInterface.stubphp new file mode 100644 index 00000000..47df42bb --- /dev/null +++ b/src/Stubs/7/Component/Serializer/Normalizer/DenormalizerInterface.stubphp @@ -0,0 +1,15 @@ + + * + * @psalm-param TType $type + * @psalm-return (TType is class-string ? TObject : mixed) + */ + public function denormalize(mixed $data, string $type, string $format = null, array $context = []); +} From 19cf80055016bf42916f083286bbf30bc65f322b Mon Sep 17 00:00:00 2001 From: HypeMC Date: Thu, 20 Jun 2024 23:47:20 +0200 Subject: [PATCH 2/2] Sync with v7 code --- .../FrameworkBundle/Controller/AbstractController.stubphp | 5 ++--- src/Stubs/7/Component/HttpFoundation/InputBag.stubphp | 4 ++-- src/Stubs/7/Component/HttpFoundation/ParameterBag.stubphp | 4 ++-- src/Stubs/7/Component/HttpFoundation/Request.stubphp | 6 +++--- .../Serializer/Normalizer/DenormalizerInterface.stubphp | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Stubs/7/Bundle/FrameworkBundle/Controller/AbstractController.stubphp b/src/Stubs/7/Bundle/FrameworkBundle/Controller/AbstractController.stubphp index 8bf41530..e4bd43b1 100644 --- a/src/Stubs/7/Bundle/FrameworkBundle/Controller/AbstractController.stubphp +++ b/src/Stubs/7/Bundle/FrameworkBundle/Controller/AbstractController.stubphp @@ -10,10 +10,9 @@ use Symfony\Component\Form\FormTypeInterface; abstract class AbstractController implements ServiceSubscriberInterface { /** - * @var ContainerInterface * @psalm-suppress PropertyNotSetInConstructor */ - protected $container; + protected ContainerInterface $container; /** * @template TData @@ -23,5 +22,5 @@ abstract class AbstractController implements ServiceSubscriberInterface * * @psalm-return FormInterface */ - protected function createForm(string $type, $data = null, array $options = []): FormInterface {} + protected function createForm(string $type, mixed $data = null, array $options = []): FormInterface {} } diff --git a/src/Stubs/7/Component/HttpFoundation/InputBag.stubphp b/src/Stubs/7/Component/HttpFoundation/InputBag.stubphp index b52d267c..d959d5fc 100644 --- a/src/Stubs/7/Component/HttpFoundation/InputBag.stubphp +++ b/src/Stubs/7/Component/HttpFoundation/InputBag.stubphp @@ -16,7 +16,7 @@ final class InputBag extends ParameterBag * @psalm-taint-source input * @psalm-mutation-free */ - public function get(string $key, $default = null) {} + public function get(string $key, mixed $default = null): string|int|float|bool|null {} /** * Returns the parameters. @@ -28,5 +28,5 @@ final class InputBag extends ParameterBag * @psalm-taint-source input * @psalm-mutation-free */ - public function all(string $key = null) {} + public function all(?string $key = null): array {} } diff --git a/src/Stubs/7/Component/HttpFoundation/ParameterBag.stubphp b/src/Stubs/7/Component/HttpFoundation/ParameterBag.stubphp index 48920ccd..869a34a6 100644 --- a/src/Stubs/7/Component/HttpFoundation/ParameterBag.stubphp +++ b/src/Stubs/7/Component/HttpFoundation/ParameterBag.stubphp @@ -14,7 +14,7 @@ class ParameterBag implements \IteratorAggregate, \Countable * @psalm-taint-source input * @psalm-mutation-free */ - public function get(string $key, $default = null) {} + public function get(string $key, mixed $default = null): mixed {} /** * Returns the parameters. @@ -26,5 +26,5 @@ class ParameterBag implements \IteratorAggregate, \Countable * @psalm-taint-source input * @psalm-mutation-free */ - public function all(string $key = null) {} + public function all(?string $key = null): array {} } diff --git a/src/Stubs/7/Component/HttpFoundation/Request.stubphp b/src/Stubs/7/Component/HttpFoundation/Request.stubphp index edda81ca..0ede79de 100644 --- a/src/Stubs/7/Component/HttpFoundation/Request.stubphp +++ b/src/Stubs/7/Component/HttpFoundation/Request.stubphp @@ -7,15 +7,15 @@ class Request /** * @psalm-var InputBag */ - public $request; + public InputBag $request; /** * @psalm-var InputBag */ - public $query; + public InputBag $query; /** * @psalm-var InputBag */ - public $cookies; + public InputBag $cookies; } diff --git a/src/Stubs/7/Component/Serializer/Normalizer/DenormalizerInterface.stubphp b/src/Stubs/7/Component/Serializer/Normalizer/DenormalizerInterface.stubphp index 47df42bb..86a10a59 100644 --- a/src/Stubs/7/Component/Serializer/Normalizer/DenormalizerInterface.stubphp +++ b/src/Stubs/7/Component/Serializer/Normalizer/DenormalizerInterface.stubphp @@ -11,5 +11,5 @@ interface DenormalizerInterface * @psalm-param TType $type * @psalm-return (TType is class-string ? TObject : mixed) */ - public function denormalize(mixed $data, string $type, string $format = null, array $context = []); + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed; }