Skip to content

Commit

Permalink
HttpExtension: service http.context is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed May 9, 2016
1 parent 9bb7dcf commit 6286f91
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Bridges/HttpDI/HttpExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public function loadConfiguration()
->setClass(Nette\Http\Response::class);

$builder->addDefinition($this->prefix('context'))
->setClass(Nette\Http\Context::class);
->setClass(Nette\Http\Context::class)
->addSetup('::trigger_error', array('Service http.context is deprecated.', E_USER_DEPRECATED));

if ($this->name === 'http') {
$builder->addAlias('nette.httpRequestFactory', $this->prefix('requestFactory'));
Expand Down
2 changes: 1 addition & 1 deletion tests/Http.DI/HttpExtension.services.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $container = new Container1;
Assert::type(Nette\Http\RequestFactory::class, $container->getService('http.requestFactory'));
Assert::type(Nette\Http\Request::class, $container->getService('http.request'));
Assert::type(Nette\Http\Response::class, $container->getService('http.response'));
Assert::type(Nette\Http\Context::class, $container->getService('http.context'));
Assert::type(Nette\Http\Context::class, @$container->getService('http.context')); // @ service is deprecated

// aliases
Assert::same($container->getService('http.requestFactory'), $container->getService('nette.httpRequestFactory'));
Expand Down

0 comments on commit 6286f91

Please sign in to comment.