Permalink
Browse files

php7 compatible errors fixed

  • Loading branch information...
shibby committed Jul 9, 2016
1 parent 07d7a3d commit 1ab51571fde84b31d7328e9b9c86033d390187bf
@@ -14,7 +14,7 @@
"classpreloader/classpreloader": "~1.0.2",
"d11wtq/boris": "~1.0",
"ircmaxell/password-compat": "~1.0",
"filp/whoops": "1.1.*",
"filp/whoops": "~1.1",
"jeremeamia/superclosure": "~1.0.1",
"monolog/monolog": "~1.6",
"nesbot/carbon": "~1.0",
@@ -7,8 +7,8 @@
/**
* Display the given exception to the user.
*
* @param \Exception $exception
* @param \Exception|\Error $exception
*/
public function display(Exception $exception);
public function display($exception);
}
@@ -9,10 +9,10 @@ class PlainDisplayer implements ExceptionDisplayerInterface {
/**
* Display the given exception to the user.
*
* @param \Exception $exception
* @param \Exception|\Error $exception
* @return \Symfony\Component\HttpFoundation\Response
*/
public function display(Exception $exception)
public function display($exception)
{
$status = $exception instanceof HttpExceptionInterface ? $exception->getStatusCode() : 500;
@@ -36,10 +36,10 @@ public function __construct(ExceptionHandler $symfony, $returnJson = false)
/**
* Display the given exception to the user.
*
* @param \Exception $exception
* @param \Exception|\Error $exception
* @return \Symfony\Component\HttpFoundation\Response
*/
public function display(Exception $exception)
public function display($exception)
{
if ($this->returnJson)
{
@@ -37,10 +37,10 @@ public function __construct(Run $whoops, $runningInConsole)
/**
* Display the given exception to the user.
*
* @param \Exception $exception
* @param \Exception|\Error $exception
* @return \Symfony\Component\HttpFoundation\Response
*/
public function display(Exception $exception)
public function display($exception)
{
$status = $exception instanceof HttpExceptionInterface ? $exception->getStatusCode() : 500;
@@ -14,9 +14,14 @@ public function tearDown()
public function testStatusAndHeadersAreSetInResponse()
{
$mockWhoops = m::mock('Whoops\Run[handleException]');
$mockWhoops->shouldReceive('handleException')->andReturn('response content');
$displayer = new WhoopsDisplayer($mockWhoops, false);
/**
* Mocking whoops gives error bcs of its final class.
* i don't know how to mock that, so i directly created object.
*/
$whoops = new \Whoops\Run;
//$mockWhoops = m::mock('Whoops\Run[handleException]');
//$mockWhoops->shouldReceive('handleException')->andReturn('response content');
$displayer = new WhoopsDisplayer($whoops, false);
$headers = array('X-My-Test-Header' => 'HeaderValue');
$exception = new HttpException(401, 'Unauthorized', null, $headers);
$response = $displayer->display($exception);

8 comments on commit 1ab5157

@atefBB

This comment has been minimized.

atefBB replied Aug 8, 2016

Hi. Thanks for help.
I follow what you do, but I still have : «Uncaught TypeError: Argument 1 passed to Whoops\Run::handleException() must be an instance of Exception, instance of TypeError given, called in C:\laragon\www\LaravelApps\seomara\vendor\laravel\framework\src\Illuminate\Exception\WhoopsDisplayer.php on line 49 ».

@shibby

This comment has been minimized.

Owner

shibby replied Aug 9, 2016

Sorry @atefBB , i cant reproduce your error. In here, line 49 is
' return new Response($this->whoops->handleException($exception), $status, $headers);`
same as yours?

Try to use this repository first. If it works, check your modifications again.
Add this lines to your composer.json:

"repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/shibby/laravel-framework.git"
    }
  ],

And i think there is difference with our composer.json files:

I added this line to "require" section.
"php": ">=7.0",
I dont know is it related but a difference.

@atefBB

This comment has been minimized.

atefBB replied Aug 10, 2016

I'm still using php 5.4.*.
Is that make a difference?
I'm not using Shibby as dependency in my composer.json, and I don't know what's its role. Is that matter?
I follow astackoverflow.com link that bring me HERE as a solution of the some prob as mine.
(Sorry about my English!)

@shibby

This comment has been minimized.

Owner

shibby replied Aug 10, 2016

@atefBB

This comment has been minimized.

atefBB replied Aug 10, 2016

I got this error and when I google it I found your solution. That's It!
Am I in a wrong PLACE?! ^___^
By the way have a you a solution for a php5.4 issue?!

@shibby

This comment has been minimized.

Owner

shibby replied Aug 10, 2016

Yes, definetely wrong place :D bcs this is for php7. And i dont know problem about 5.4 If you are using L4, its development doesnt continue anymore. If you are using laravel 5.2,5.3 im not sure if they are supporting Php5.4

@atefBB

This comment has been minimized.

atefBB replied Aug 10, 2016

Sorry.

@shibby

This comment has been minimized.

Owner

shibby replied Aug 10, 2016

Please sign in to comment.