-
Notifications
You must be signed in to change notification settings - Fork 36
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
Missing dynamic return type for Nette\Http\Session::getSection() #77
Comments
+1 |
Hi, could you provide PHP code examples of these 2 states? (I don't use Nette on this level) |
Here is the definition of method: https://github.com/nette/http/blob/04224e7fd25c70390419b463f4e2b26042ea5e2a/src/Http/Session.php#L314 In following examples Example using default class for session section: $section = $sessionHandler->getSection('mySection'); Variable Example using diferent class for session section: class MySection extends \Nette\Http\SessionSection {}
$section = $sessionHandler->getSection('mySection', MySection::class); Variable |
see https://github.com/phpstan/phpstan-nette/blob/1.1.x/stubs/ComponentModel/Container.stub I think this is similar case and you can handle it with stub. I think something like this: /**
* @template T of \Nette\Http\SessionSection
* @phpstan-param class-string<T> $class
* @phpstan-return T
*/
public function getSection(string $section, string $class = SessionSection::class): \Nette\Http\SessionSection |
Method
Nette\Http\Session::getSection()
has optional second parameter which can change class of returned object.This extension does not support it and always returns
Nette\Http\SessionSection
class.The text was updated successfully, but these errors were encountered: