-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add stubs for Symfony 7 #352
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/Stubs/7/Bundle/FrameworkBundle/Controller/AbstractController.stubphp
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,26 @@ | ||
<?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; | ||
|
||
abstract class AbstractController implements ServiceSubscriberInterface | ||
{ | ||
/** | ||
* @psalm-suppress PropertyNotSetInConstructor | ||
*/ | ||
protected ContainerInterface $container; | ||
|
||
/** | ||
* @template TData | ||
* @template TFormType of FormTypeInterface<TData> | ||
* | ||
* @psalm-param class-string<TFormType> $type | ||
* | ||
* @psalm-return FormInterface<TData> | ||
*/ | ||
protected function createForm(string $type, mixed $data = null, array $options = []): FormInterface {} | ||
} |
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,32 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\HttpFoundation; | ||
|
||
/** | ||
* @template T of string|int|float|bool | ||
*/ | ||
final class InputBag extends ParameterBag | ||
{ | ||
/** | ||
* Returns a string input value by name. | ||
* | ||
* @template D of T|null | ||
* @psalm-param D $default | ||
* @psalm-return D|T | ||
* @psalm-taint-source input | ||
* @psalm-mutation-free | ||
*/ | ||
public function get(string $key, mixed $default = null): string|int|float|bool|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 | ||
* @psalm-mutation-free | ||
*/ | ||
public function all(?string $key = null): array {} | ||
} |
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,30 @@ | ||
<?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 | ||
* @psalm-mutation-free | ||
*/ | ||
public function get(string $key, mixed $default = null): mixed {} | ||
|
||
/** | ||
* 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 | ||
* @psalm-mutation-free | ||
*/ | ||
public function all(?string $key = null): array {} | ||
} |
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 | ||
|
||
namespace Symfony\Component\HttpFoundation; | ||
|
||
class Request | ||
{ | ||
/** | ||
* @psalm-var InputBag | ||
*/ | ||
public InputBag $request; | ||
|
||
/** | ||
* @psalm-var InputBag<string> | ||
*/ | ||
public InputBag $query; | ||
|
||
/** | ||
* @psalm-var InputBag<string> | ||
*/ | ||
public InputBag $cookies; | ||
} |
15 changes: 15 additions & 0 deletions
15
src/Stubs/7/Component/Serializer/Normalizer/DenormalizerInterface.stubphp
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,15 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\Serializer\Normalizer; | ||
|
||
interface DenormalizerInterface | ||
{ | ||
/** | ||
* @template TObject of object | ||
* @template TType of string|class-string<TObject> | ||
* | ||
* @psalm-param TType $type | ||
* @psalm-return (TType is class-string<TObject> ? TObject : mixed) | ||
*/ | ||
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it should be ok to return
null
as well, WDYT?