Skip to content

Commit

Permalink
Fix PHPDoc variable type hint
Browse files Browse the repository at this point in the history
Fix the PHPDoc type of the `$session` variable so copy-pasting of this example code works better.
  • Loading branch information
drupol committed Apr 3, 2023
1 parent 79196b0 commit e1f5f85
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Packagist](https://img.shields.io/packagist/v/psr7-sessions/storageless.svg)](https://packagist.org/packages/psr7-sessions/storageless)
[![Packagist](https://img.shields.io/packagist/vpre/psr7-sessions/storageless.svg)](https://packagist.org/packages/psr7-sessions/storageless)

**PSR7Session** is a [PSR-7](http://www.php-fig.org/psr/psr-7/) and
**PSR7Session** is a [PSR-7](http://www.php-fig.org/psr/psr-7/) and
[PSR-15](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-15-request-handlers.md)
compatible [middleware](https://mwop.net/blog/2015-01-08-on-http-middleware-and-psr-7.html) that enables
session without I/O usage in PSR-7 based applications.
Expand All @@ -20,7 +20,7 @@ composer require psr7-sessions/storageless

### Usage

You can use the `PSR7Sessions\Storageless\Http\SessionMiddleware` in any
You can use the `PSR7Sessions\Storageless\Http\SessionMiddleware` in any
[PSR-15](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-15-request-handlers.md)
compatible middleware.

Expand All @@ -41,7 +41,7 @@ has access to the `Psr\Http\Message\ServerRequestInterface` attributes:

```php
$app->get('/get', function (ServerRequestInterface $request, ResponseInterface $response) : ResponseInterface {
/* @var \PSR7Sessions\Storageless\Session\Data $session */
/** @var \PSR7Sessions\Storageless\Session\SessionInterface $session */
$session = $request->getAttribute(SessionMiddleware::SESSION_ATTRIBUTE);
$session->set('counter', $session->get('counter', 0) + 1);

Expand Down Expand Up @@ -87,7 +87,7 @@ identifier to a visiting user-agent.
This is all fair and nice, except for:

* relying on the `$_SESSION` superglobal
* relying on the shutdown handlers in order to "commit" sessions to the
* relying on the shutdown handlers in order to "commit" sessions to the
storage
* having a huge limitation of number of active users (due to storage)
* having a lot of I/O due to storage
Expand Down Expand Up @@ -130,7 +130,7 @@ tokens.
### Advantages

* no storage required
* no sticky sessions required (any server having a copy of the private or
* no sticky sessions required (any server having a copy of the private or
public keys can generate sessions or consume them)
* can transmit cleartext information to the client, allowing it to share
some information with the server (a standard example is about sharing the
Expand Down

0 comments on commit e1f5f85

Please sign in to comment.