Skip to content

Commit

Permalink
Moved Middle to PHP 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Jelmer Schreuder committed Apr 3, 2017
1 parent 61ac27c commit 8f7dd28
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
build:
environment:
php:
version: 7.0.7
version: 7.1
tests:
override:
-
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The implementations can be atomic in nature: just performing one task. Composing
complex capabilities by choosing which simple middlewares you decorate or add
to the stack. Also every component is NIH; PSR-1, PSR-2, PSR-3, PSR-4, PSR-7
and forward compatible with PSR-15 & PSR-17 through HTTP-Interop; aimed at PHP
7.0 or higher (probably 7.1+ once that's released).
7.1.

Check out the `Middle skeleton <https://github.com/jschreuder/Middle-skeleton>`_
application to get an example setup running quickly.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"http-interop/http-factory": "^0.2"
},
"require-dev": {
"php": ">=7.0",
"php": ">=7.1",
"phpspec/phpspec": "^3.0",
"henrikbjorn/phpspec-code-coverage": "^3.0",
"twig/twig": "^1.24",
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/RequestValidatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ interface RequestValidatorInterface
* @return void
* @throws ValidationFailedException
*/
public function validateRequest(ServerRequestInterface $request);
public function validateRequest(ServerRequestInterface $request): void;
}
1 change: 1 addition & 0 deletions src/Delegate.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;

// @todo prevent calling ->process() twice
final class Delegate implements DelegateInterface
{
/** @var \SplStack */
Expand Down
3 changes: 1 addition & 2 deletions src/Router/RouterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ public function parseRequest(ServerRequestInterface $request): RouteMatchInterfa
/** Returns UrlGenerator for reverse routing */
public function getGenerator(): UrlGeneratorInterface;

/** @return void */
public function registerRoutes(RoutingProviderInterface $routingProvider);
public function registerRoutes(RoutingProviderInterface $routingProvider): void;

/** Generic method for adding routes with arbitrary or multiple methods */
public function match(
Expand Down
2 changes: 1 addition & 1 deletion src/Router/SymfonyRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function getGenerator(): UrlGeneratorInterface
}

/** @return void */
public function registerRoutes(RoutingProviderInterface $routingProvider)
public function registerRoutes(RoutingProviderInterface $routingProvider): void
{
$routingProvider->registerRoutes($this);
}
Expand Down
7 changes: 3 additions & 4 deletions src/Session/JwtSessionProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ public function processResponse(ServerRequestInterface $request, ResponseInterfa
);
}

/** @return ?Token */
public function parseToken(ServerRequestInterface $request)
public function parseToken(ServerRequestInterface $request): ?Token
{
$cookies = $request->getCookieParams();
$cookieName = $this->defaultCookie->getName();
Expand All @@ -128,7 +127,7 @@ public function parseToken(ServerRequestInterface $request)
public function appendToken(
SessionInterface $session,
ResponseInterface $response,
Token $token = null
?Token $token
): ResponseInterface
{
$sessionContainerChanged = $session->hasChanged();
Expand Down Expand Up @@ -182,7 +181,7 @@ private function getTokenCookie(SessionInterface $session): SetCookie
->withExpires($timestamp + $this->expirationTime);
}

public function extractSessionContainer(Token $token = null): SessionInterface
public function extractSessionContainer(?Token $token): SessionInterface
{
try {
if (is_null($token) || !$token->verify($this->signer, $this->verificationKey)) {
Expand Down
8 changes: 4 additions & 4 deletions src/Session/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function get(string $key)
return $this->sessionData[$key] ?? null;
}

public function set(string $key, $value)
public function set(string $key, $value): void
{
$this->changed = true;
$this->sessionData[$key] = $value;
Expand All @@ -63,7 +63,7 @@ public function getFlash(string $key)
return $this->sessionData[self::FLASH_DATA_KEY_PREFIX . $key] ?? null;
}

public function setFlash(string $key, $value)
public function setFlash(string $key, $value): void
{
$this->changed = true;
$this->markFlashKey($key);
Expand All @@ -76,13 +76,13 @@ private function markFlashKey(string $key)
$this->sessionData[self::FLASH_DATA_META_KEY][$key] = 1;
}

public function destroy()
public function destroy(): void
{
$this->changed = true;
$this->sessionData = [];
}

public function rotateId()
public function rotateId(): void
{
$this->changed = true;
// These sessions don't have an ID to change, but this should force overwrite
Expand Down
12 changes: 4 additions & 8 deletions src/Session/SessionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,18 @@ public function has(string $key): bool;
/** @return mixed */
public function get(string $key);

/** @return void */
public function set(string $key, $value);
public function set(string $key, $value): void;

public function hasFlash(string $key): bool;

/** @return mixed */
public function getFlash(string $key);

/** @return void */
public function setFlash(string $key, $value);
public function setFlash(string $key, $value): void;

/** @return void */
public function destroy();
public function destroy(): void;

/** @return void */
public function rotateId();
public function rotateId(): void;

public function isEmpty(): bool;

Expand Down
8 changes: 4 additions & 4 deletions src/Session/ZendSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function get(string $key)
}

/** @return void */
public function set(string $key, $value)
public function set(string $key, $value): void
{
$this->changed = true;
$this->container[$key] = $value;
Expand All @@ -51,7 +51,7 @@ public function getFlash(string $key)
}

/** @return void */
public function setFlash(string $key, $value)
public function setFlash(string $key, $value): void
{
$key = self::FLASH_DATA_KEY_PREFIX . $key;
$this->changed = true;
Expand All @@ -60,13 +60,13 @@ public function setFlash(string $key, $value)
}

/** @return void */
public function destroy()
public function destroy(): void
{
$this->sessionManager->destroy();
}

/** @return void */
public function rotateId()
public function rotateId(): void
{
$this->changed = true;
$this->sessionManager->regenerateId();
Expand Down
2 changes: 1 addition & 1 deletion src/Session/ZendSessionProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class ZendSessionProcessor implements SessionProcessorInterface
/** @var ?ConfigInterface */
private $zendSessionConfig;

public function __construct(ConfigInterface $zendSessionConfig = null)
public function __construct(?ConfigInterface $zendSessionConfig = null)
{
$this->zendSessionConfig = $zendSessionConfig;
}
Expand Down
4 changes: 2 additions & 2 deletions src/View/RedirectView.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function getHeaders(): array
return $this->headers;
}

public function setHeader(string $key, string $value)
public function setHeader(string $key, string $value): void
{
$this->headers[$key] = $value;
}
Expand All @@ -50,7 +50,7 @@ public function getParameters(): array
return [];
}

public function setParameter(string $key, $value)
public function setParameter(string $key, $value): void
{
throw new \RuntimeException('No parameters allowed on RedirectView');
}
Expand Down
4 changes: 2 additions & 2 deletions src/View/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getHeaders(): array
}

/** @return void */
public function setHeader(string $key, string $value)
public function setHeader(string $key, string $value): void
{
$this->headers[$key] = $value;
}
Expand All @@ -66,7 +66,7 @@ public function getParameters(): array
}

/** @return void */
public function setParameter(string $key, $value)
public function setParameter(string $key, $value): void
{
$this->parameters[$key] = $value;
}
Expand Down
6 changes: 2 additions & 4 deletions src/View/ViewInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ public function getContentType(): string;

public function getHeaders(): array;

/** @return void */
public function setHeader(string $key, string $value);
public function setHeader(string $key, string $value): void;

public function getTemplate(): string;

public function getParameters(): array;

/** @return void */
public function setParameter(string $key, $value);
public function setParameter(string $key, $value): void;
}

0 comments on commit 8f7dd28

Please sign in to comment.