Skip to content

Commit

Permalink
Rename OptionsHandler to OptionsHandlerInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
mbonneau committed May 21, 2020
1 parent d29903c commit b6f8e2d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Ratchet\Session;

interface OptionsHandler
interface OptionsHandlerInterface
{
public function get(string $name) : string;

Expand Down
2 changes: 1 addition & 1 deletion src/Ratchet/Session/PhpOptionsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use function ini_get;
use function ini_set;

final class PhpOptionsHandler implements OptionsHandler
final class PhpOptionsHandler implements OptionsHandlerInterface
{
public function get(string $name) : string
{
Expand Down
6 changes: 3 additions & 3 deletions src/Ratchet/Session/SessionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Ratchet\ConnectionInterface;
use Ratchet\Http\HttpServerInterface;
use Psr\Http\Message\RequestInterface;
use Ratchet\Session\OptionsHandler;
use Ratchet\Session\OptionsHandlerInterface;
use Ratchet\Session\PhpOptionsHandler;
use Ratchet\Session\Storage\VirtualSessionStorage;
use Ratchet\Session\Serialize\HandlerInterface;
Expand Down Expand Up @@ -39,14 +39,14 @@ class SessionProvider implements HttpServerInterface {
*/
protected $_serializer;

/** @var OptionsHandler */
/** @var OptionsHandlerInterface */
private $optionsHandler;

/**
* @param array<string, mixed> $options
* @throws \RuntimeException
*/
public function __construct(HttpServerInterface $app, \SessionHandlerInterface $handler, array $options = array(), HandlerInterface $serializer = null, ?OptionsHandler $optionsHandler = null) {
public function __construct(HttpServerInterface $app, \SessionHandlerInterface $handler, array $options = array(), HandlerInterface $serializer = null, ?OptionsHandlerInterface $optionsHandler = null) {
$this->_app = $app;
$this->_handler = $handler;
$this->_null = new NullSessionHandler;
Expand Down
4 changes: 2 additions & 2 deletions src/Ratchet/Session/Storage/Proxy/VirtualProxy.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Ratchet\Session\Storage\Proxy;

use Ratchet\Session\OptionsHandler;
use Ratchet\Session\OptionsHandlerInterface;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;

class VirtualProxy extends SessionHandlerProxy {
Expand All @@ -18,7 +18,7 @@ class VirtualProxy extends SessionHandlerProxy {
/**
* {@inheritdoc}
*/
public function __construct(\SessionHandlerInterface $handler, OptionsHandler $optionsHandler) {
public function __construct(\SessionHandlerInterface $handler, OptionsHandlerInterface $optionsHandler) {
parent::__construct($handler);

$this->saveHandlerName = 'user';
Expand Down
6 changes: 3 additions & 3 deletions src/Ratchet/Session/Storage/VirtualSessionStorage.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
namespace Ratchet\Session\Storage;
use Ratchet\Session\OptionsHandler;
use Ratchet\Session\OptionsHandlerInterface;
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
use Ratchet\Session\Storage\Proxy\VirtualProxy;
use Ratchet\Session\Serialize\HandlerInterface;
Expand All @@ -11,15 +11,15 @@ class VirtualSessionStorage extends NativeSessionStorage {
*/
protected $_serializer;

/** @var OptionsHandler */
/** @var OptionsHandlerInterface */
private $optionsHandler;

/**
* @param \SessionHandlerInterface $handler
* @param string $sessionId The ID of the session to retrieve
* @param \Ratchet\Session\Serialize\HandlerInterface $serializer
*/
public function __construct(\SessionHandlerInterface $handler, $sessionId, HandlerInterface $serializer, OptionsHandler $optionsHandler) {
public function __construct(\SessionHandlerInterface $handler, $sessionId, HandlerInterface $serializer, OptionsHandlerInterface $optionsHandler) {
$this->optionsHandler = $optionsHandler;
$this->setSaveHandler($handler);
$this->saveHandler->setId($sessionId);
Expand Down
4 changes: 2 additions & 2 deletions tests/Session/InMemoryOptionsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Ratchet\Tests\Session;

use Ratchet\Session\OptionsHandler;
use Ratchet\Session\OptionsHandlerInterface;

final class InMemoryOptionsHandler implements OptionsHandler
final class InMemoryOptionsHandler implements OptionsHandlerInterface
{
/** @var array<string, mixed> */
private $options;
Expand Down

3 comments on commit b6f8e2d

@simPod
Copy link
Contributor

@simPod simPod commented on b6f8e2d May 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I preferred to avoid using pleonasms but I see it's used the same in the whole lib.

@mbonneau
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - just to keep things uniform.

@cboden
Copy link
Member

@cboden cboden commented on b6f8e2d May 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now a days I prefer distinguishing interfaces/classes/traits by grammar instead of slapping the word on the end of the object. I do agree with Matt here, I'd rather keep it uniform with the rest of the library. Consistency is important.

Please sign in to comment.