Skip to content

Commit

Permalink
Add stub for symfony 6 (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet authored Jan 2, 2022
1 parent d6be2fb commit 483391f
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Symfony\Bundle\FrameworkBundle\Controller;

use Symfony\Contracts\Service\ServiceSubscriberInterface;
use Psr\Container\ContainerInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormTypeInterface;

class AbstractController implements ServiceSubscriberInterface
{
/**
* @var ContainerInterface
* @psalm-suppress PropertyNotSetInConstructor
*/
protected $container;

/**
* @template TData
* @template TFormType of FormTypeInterface<TData>
*
* @psalm-param class-string<TFormType> $type
*
* @psalm-return FormInterface<TData>
*/
public function createForm(string $type, $data = null, array $options = []): FormInterface {}
}
27 changes: 27 additions & 0 deletions src/Stubs/6/Component/HttpFoundation/InputBag.stubphp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Symfony\Component\HttpFoundation;

final class InputBag extends ParameterBag
{
/**
* Returns a string input value by name.
*
* @template D of string|int|float|bool|null
* @psalm-param D $default
* @psalm-return string|int|float|bool|D
* @psalm-taint-source input
*/
public function get(string $key, $default = null) {}

/**
* Returns the parameters.
*
* @param string|null $key The name of the parameter to return or null to get them all
*
* @return array An array of parameters
*
* @psalm-taint-source input
*/
public function all(string $key = null) {}
}
28 changes: 28 additions & 0 deletions src/Stubs/6/Component/HttpFoundation/ParameterBag.stubphp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Symfony\Component\HttpFoundation;

class ParameterBag implements \IteratorAggregate, \Countable
{
/**
* Returns a parameter by name.
*
* @param string $key The key
* @param mixed $default The default value if the parameter key does not exist
*
* @return mixed
* @psalm-taint-source input
*/
public function get(string $key, $default = null) {}

/**
* Returns the parameters.
*
* @param string|null $key The name of the parameter to return or null to get them all
*
* @return array An array of parameters
*
* @psalm-taint-source input
*/
public function all(string $key = null) {}
}
11 changes: 11 additions & 0 deletions src/Stubs/6/Component/HttpFoundation/Request.stubphp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Symfony\Component\HttpFoundation;

class Request
{
/**
* @psalm-var InputBag
*/
public $request;
}

0 comments on commit 483391f

Please sign in to comment.