Skip to content
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

Cookie\Factory::make and cookie() helper parameters missing #21542

Closed
KKSzymanowski opened this issue Oct 5, 2017 · 6 comments
Closed

Cookie\Factory::make and cookie() helper parameters missing #21542

KKSzymanowski opened this issue Oct 5, 2017 · 6 comments

Comments

@KKSzymanowski
Copy link
Contributor

KKSzymanowski commented Oct 5, 2017

  • Laravel Version: 5.5.13

Description:

Illuminate\Cookie\CookieJar::make() accepts the following list of parameters:

$name, 
$value, 
$minutes = 0, 
$path = null, 
$domain = null, 
$secure = false, 
$httpOnly = true, 
$raw = false, 
$sameSite = null

Illuminate\Contracts\Cookie\Factory::make() and cookie() helper however accept only these ones:

$name, 
$value, 
$minutes = 0, 
$path = null, 
$domain = null, 
$secure = false, 
$httpOnly = true

Is it intentional?

@Dylan-DPC-zz
Copy link

This is not a bug. A class implementing the contract can have extra methods in the signature if it wants to. Kindly close the issue

@KKSzymanowski
Copy link
Contributor Author

I didn't say it's a bug, I opened this more like a question to the maintainers.
The Illuminate\Cookie\CookieJar class is the only concrete class implementing Illuminate\Contracts\Cookie\Factory interface, why not then make the signatures identical? Last two parameters are optional, so it won't break backward compatibility.

Lack of these two arguments made it a little bit confusing to me, especially that the $raw argument is not documented. Adding them might save someone some time.

@Dylan-DPC-zz
Copy link

Well the contract just says that it needs these many params to be there in the function. Also it is not aware whether 1 class is implementing or more than that. They could be people who have written their own implementations. Also this repo is for bug tracking. So if you want, you can put forth a proposal in laravel/internals repo

@Dylan-DPC-zz
Copy link

Dylan-DPC-zz commented Oct 5, 2017

I checked both the functions again. And yeah the helper should match the class. I will push another PR for 5.6 so that interface matches. or you can do that if you wish

@KKSzymanowski
Copy link
Contributor Author

Please do, if you can. I don't have my computer with me.

@Dylan-DPC-zz
Copy link

Sure but contract change will be for 5.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants