Skip to content

Commit

Permalink
Merge pull request #27 from 99designs/stop-hinting-3rd-party-interface
Browse files Browse the repository at this point in the history
Use RequestInterface instead of MessageInterface
  • Loading branch information
navitronic committed Oct 17, 2016
2 parents 8183e22 + 46ceca5 commit 1d64ff6
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 19 deletions.
2 changes: 0 additions & 2 deletions src/Algorithm.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ abstract class Algorithm
{
/**
* @param string $name
*
* @return HmacAlgorithm
*
* @throws Exception
*/
public static function create($name)
Expand Down
6 changes: 3 additions & 3 deletions src/Signature.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace HttpSignatures;

use Psr\Http\Message\MessageInterface;
use Psr\Http\Message\RequestInterface;

class Signature
{
Expand All @@ -16,12 +16,12 @@ class Signature
private $signingString;

/**
* @param MessageInterface $message
* @param RequestInterface $message
* @param Key $key
* @param AlgorithmInterface $algorithm
* @param HeaderList $headerList
*/
public function __construct(MessageInterface $message, Key $key, AlgorithmInterface $algorithm, HeaderList $headerList)
public function __construct($message, Key $key, AlgorithmInterface $algorithm, HeaderList $headerList)
{
$this->key = $key;
$this->algorithm = $algorithm;
Expand Down
12 changes: 6 additions & 6 deletions src/Signer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace HttpSignatures;

use Psr\Http\Message\MessageInterface;
use Psr\Http\Message\RequestInterface;

class Signer
{
Expand All @@ -28,10 +28,10 @@ public function __construct($key, $algorithm, $headerList)
}

/**
* @param MessageInterface $message
* @return MessageInterface
* @param RequestInterface $message
* @return RequestInterface
*/
public function sign(MessageInterface $message)
public function sign($message)
{
$signatureParameters = $this->signatureParameters($message);
$message = $message->withAddedHeader("Signature", $signatureParameters->string());
Expand All @@ -40,7 +40,7 @@ public function sign(MessageInterface $message)
}

/**
* @param MessageInterface $message
* @param RequestInterface $message
* @return SignatureParameters
*/
private function signatureParameters($message)
Expand All @@ -54,7 +54,7 @@ private function signatureParameters($message)
}

/**
* @param MessageInterface $message
* @param RequestInterface $message
* @return Signature
*/
private function signature($message)
Expand Down
2 changes: 1 addition & 1 deletion src/SigningString.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SigningString
* @param HeaderList $headerList
* @param RequestInterface $message
*/
public function __construct(HeaderList $headerList, RequestInterface $message)
public function __construct(HeaderList $headerList, $message)
{
$this->headerList = $headerList;
$this->message = $message;
Expand Down
8 changes: 4 additions & 4 deletions src/Verification.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace HttpSignatures;

use Psr\Http\Message\MessageInterface;
use Psr\Http\Message\RequestInterface;

class Verification
{
/** @var MessageInterface */
/** @var RequestInterface */
private $message;

/** @var KeyStoreInterface */
Expand All @@ -16,10 +16,10 @@ class Verification
private $_parameters;

/**
* @param MessageInterface $message
* @param RequestInterface $message
* @param KeyStoreInterface $keyStore
*/
public function __construct(MessageInterface $message, $keyStore)
public function __construct($message, KeyStoreInterface $keyStore)
{
$this->message = $message;
$this->keyStore = $keyStore;
Expand Down
6 changes: 3 additions & 3 deletions src/Verifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace HttpSignatures;

use Psr\Http\Message\MessageInterface;
use Psr\Http\Message\RequestInterface;

class Verifier
{
Expand All @@ -18,10 +18,10 @@ public function __construct(KeyStoreInterface $keyStore)
}

/**
* @param MessageInterface $message
* @param RequestInterface $message
* @return bool
*/
public function isValid(MessageInterface $message)
public function isValid($message)
{
$verification = new Verification($message, $this->keyStore);

Expand Down

0 comments on commit 1d64ff6

Please sign in to comment.