Skip to content

Commit

Permalink
Object return types, require PHP 7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Dec 24, 2019
1 parent f63d932 commit b4073ce
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 16 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
language: php

php:
- 7.1
- 7.2
- 7.3
- 7.4

matrix:
include:
- php: 7.1.0
- php: 7.2.0
env: dependencies=lowest

before_script:
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
],
"license": "MIT",
"require": {
"php": ">=7.1",
"brick/di": "~0.2.0",
"php": ">=7.2",
"brick/di": "~0.3.0",
"brick/event": "~0.1.0",
"brick/html": "~0.1.0",
"brick/http": "~0.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Event/ControllerInvocatedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function getRouteMatch() : RouteMatch
*
* @return object|null
*/
public function getControllerInstance()
public function getControllerInstance() : ?object
{
return $this->instance;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Event/ControllerReadyEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function getRouteMatch() : RouteMatch
*
* @return object|null
*/
public function getControllerInstance()
public function getControllerInstance() : ?object
{
return $this->instance;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Event/NonResponseResultEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function getRouteMatch() : RouteMatch
*
* @return object|null
*/
public function getControllerInstance()
public function getControllerInstance() : ?object
{
return $this->instance;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Event/ResponseReceivedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function getRouteMatch() : RouteMatch
*
* @return object|null
*/
public function getControllerInstance()
public function getControllerInstance() : ?object
{
return $this->instance;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ObjectPacker/DateTimePacker.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function pack($object) : ?PackedObject
/**
* {@inheritdoc}
*/
public function unpack(PackedObject $packedObject)
public function unpack(PackedObject $packedObject) : ?object
{
$class = $packedObject->getClass();
$data = $packedObject->getData();
Expand Down
2 changes: 1 addition & 1 deletion src/ObjectPacker/DoctrinePacker.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function pack($object) : ?PackedObject
/**
* {@inheritdoc}
*/
public function unpack(PackedObject $packedObject)
public function unpack(PackedObject $packedObject) : ?object
{
$class = $packedObject->getClass();

Expand Down
2 changes: 1 addition & 1 deletion src/ObjectPacker/GeometryPacker.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function pack($object) : ?PackedObject
/**
* {@inheritdoc}
*/
public function unpack(PackedObject $packedObject)
public function unpack(PackedObject $packedObject) : ?object
{
$class = $packedObject->getClass();
$data = $packedObject->getData();
Expand Down
2 changes: 1 addition & 1 deletion src/ObjectPacker/NullPacker.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function pack($object) : ?PackedObject
/**
* {@inheritdoc}
*/
public function unpack(PackedObject $packedObject)
public function unpack(PackedObject $packedObject) : ?object
{
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ObjectPacker/ObjectPacker.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ public function pack($object) : ?PackedObject;
* @throws ObjectNotConvertibleException If the class name is supported, but the representation is not valid.
* @throws ObjectNotFoundException If the class name is supported, but the object cannot be found.
*/
public function unpack(PackedObject $packedObject);
public function unpack(PackedObject $packedObject) : ?object;
}
2 changes: 1 addition & 1 deletion src/ObjectPacker/PackerChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function pack($object) : ?PackedObject
/**
* {@inheritdoc}
*/
public function unpack(PackedObject $packedObject)
public function unpack(PackedObject $packedObject) : ?object
{
foreach ($this->objectPackers as $objectPacker) {
$object = $objectPacker->unpack($packedObject);
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/AbstractAnnotationPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __construct(Reader $annotationReader)
*
* @return object|null The annotation, or null if not found.
*/
protected function getControllerAnnotation(\ReflectionFunctionAbstract $controller, string $annotationClass)
protected function getControllerAnnotation(\ReflectionFunctionAbstract $controller, string $annotationClass) : ?object
{
if ($controller instanceof \ReflectionMethod) {
$annotations = $this->annotationReader->getMethodAnnotations($controller);
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/ObjectUnpackPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private function getParameterValue(\ReflectionParameter $parameter, $value)
*
* @throws HttpException If the object cannot be instantiated.
*/
private function getObject(string $className, $value)
private function getObject(string $className, $value) : object
{
$packedObject = new PackedObject($className, $value);

Expand Down

0 comments on commit b4073ce

Please sign in to comment.