Skip to content

Commit

Permalink
Upgrade dependencies
Browse files Browse the repository at this point in the history
 - Drop PHP5 support, require 7.1 as minimal
 - Add compatibility with Symfony4
 - Add PHP 7.2 support
  • Loading branch information
fesor committed Jan 28, 2018
1 parent 5ece43c commit d9874ef
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
language: php

php:
- 5.6
- 7.0
- hhvm
- 7.1
- 7.2

before_script:
- composer install --no-interaction
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
},
"minimum-stability": "stable",
"require": {
"php": ">=5.6.0",
"symfony/http-foundation": "^3.0",
"symfony/validator": "^3.0"
"php": ">=7.1.0",
"symfony/http-foundation": "^3.3|^4.0",
"symfony/validator": "^3.3|^4.0"
},
"require-dev": {
"phpunit/phpunit": "^5.3",
"symfony/framework-bundle": "^3.0"
"symfony/framework-bundle": "^3.3|^4.0",
"symfony/var-dumper": "^4.0"
}
}
3 changes: 2 additions & 1 deletion examples/App/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ framework:

services:
app_controller:
class: 'Fesor\RequestObject\Examples\App\AppController'
class: 'Fesor\RequestObject\Examples\App\AppController'
public: true
6 changes: 4 additions & 2 deletions src/Bundle/DependeyInjection/RequestObjectExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
use Fesor\RequestObject\HttpPayloadResolver;
use Fesor\RequestObject\PayloadResolver;
use Fesor\RequestObject\RequestObjectBinder;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Reference;

Expand All @@ -27,9 +27,11 @@ private function registerPayloadResolver(ContainerBuilder $container)
$definition->setAbstract(true);
$container->setDefinition('request_object.payload_resolver', $definition);

$implDefinition = new DefinitionDecorator('request_object.payload_resolver');
$implDefinition = new ChildDefinition('request_object.payload_resolver');
$implDefinition->setClass(HttpPayloadResolver::class);
$container->setDefinition('request_object.payload_resolver.http', $implDefinition);

$container->setAlias(PayloadResolver::class, 'request_object.payload_resolver.http');
}

private function registerRequestBinder(ContainerBuilder $container)
Expand Down
2 changes: 1 addition & 1 deletion src/RequestObjectBinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function bind(Request $request, callable $action)
$requestObject->setPayload($payload);
if (array_key_exists('errors', $matchedArguments)) {
$request->attributes->set($matchedArguments['errors']->name, $errors);
} elseif (0 !== count($errors)) {
} elseif ($errors && 0 !== $errors->count()) {
return $this->providerErrorResponse($requestObject, $errors);
}
}
Expand Down

0 comments on commit d9874ef

Please sign in to comment.