Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove nullable type on InputBag::get() after InputBag::has() call #250

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

Merged
ondrejmirtes merged 1 commit into phpstan:master from franmomu:input_has
Feb 3, 2022

Conversation

Copy link
Contributor

@franmomu franmomu commented Feb 2, 2022
edited
Loading

I've used https://github.com/phpstan/phpstan-symfony/blob/df5ce326a8935bf400eb59f7080e568c20ef6246/src/Type/Symfony/RequestTypeSpecifyingExtension.php as example.

Update: maybe we could change it to a HasGetTypeSpecifyingExtension and pass the className so it can be reused for other classes as well.

Copy link
Collaborator

lookyman commented Feb 2, 2022

👍

@ondrejmirtes ondrejmirtes merged commit 173610b into phpstan:master Feb 3, 2022
Copy link
Member

Thank you!

franmomu reacted with hooray emoji

@franmomu franmomu deleted the input_has branch February 3, 2022 15:24
Copy link
Contributor

VincentLanglet commented May 30, 2023
edited
Loading

Hi @franmomu, I'm not sure this DynamicReturnExtension is correct,

The has method is using the array_key_exists check
https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/HttpFoundation/ParameterBag.php#L99

Which means that we can have

$bag->set('foo', null);
$bag->has('foo'); // true
$bag->get('foo'); // null

If so, I'm affraid we'll have to remove this DynamicReturnExtension :(
WDYT ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /