Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Injection definition required for non-concrete parameter $interface of type Http\Request #85

Closed
HassanAlthaf opened this issue Apr 2, 2015 · 9 comments

Comments

@HassanAlthaf
Copy link

Hey, I get that error when I had this code:

$injector->alias('Http\Response', 'Http\HttpResponse');
$injector->share('Http\HttpRequest');
$injector->define('Http\HttpRequest', [
':get' => $_GET,
':post' => $_POST,
':cookies' => $_COOKIE,
':files' => $_FILES,
':server' => $_SERVER,
]);

$injector->alias('Http\Request', 'Http\HttpRequest');
$injector->share('Http\HttpResponse');

However, when I use an old version of Auryn, it works perfectly fine! I bet this is a bug.

@J7mbo
Copy link
Contributor

J7mbo commented Apr 2, 2015

Could you provide the relevant constructor / method signatures of the objects you're attempting to create, and explain what you're trying to do?

@rdlowrey
Copy link
Owner

rdlowrey commented Apr 2, 2015

Yes, a simple reproduce script would go a long way to diagnosing any potential issue. It would be very helpful if you could provide one :)

@HassanAlthaf
Copy link
Author

I use it like this:
namespace App;

use Http\Request;
use Http\Response;

class Foo
{
private $request;
private $response;
public function __construct(Request $request, Response $response)
{
$this->response = $response;
$this->request = $request;
}

  public function do()
  {
     $username = $this->request->getParameter('username');
  }

}

@HassanAlthaf
Copy link
Author

That is how I use it, and it generates that error when the class is instantiated.

@HassanAlthaf
Copy link
Author

This problem is fixed when I use an old version of Auryn, so that is what I'm using right now.

@VeeeneX
Copy link

VeeeneX commented Apr 4, 2015

@HassanAlthaf And which version are you using right now?

@VeeeneX
Copy link

VeeeneX commented Apr 4, 2015

@HassanAlthaf Try this

use \Http\Request;
use \Http\Response;

@rdlowrey
Copy link
Owner

rdlowrey commented Apr 5, 2015

I can't diagnose anything from the code samples provided. Please add a code snippet demonstrating actual Auryn usage that gives an error where a different result is expected.

@rdlowrey
Copy link
Owner

Closing as there's been no activity and no reproduce code ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants