mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
don't rely on 'args' in trace, not available in 7.4
This commit is contained in:
@@ -102,16 +102,16 @@ final class InvalidTag implements Tag
|
|||||||
};
|
};
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
$trace = $exception->getTrace();
|
||||||
|
if (isset($trace[0]['args'])) {
|
||||||
$trace = array_map(
|
$trace = array_map(
|
||||||
static function (array $call) use ($flatten) : array {
|
static function (array $call) use ($flatten) : array {
|
||||||
$call['args'] = $call['args'] ?? [];
|
|
||||||
|
|
||||||
array_walk_recursive($call['args'], $flatten);
|
array_walk_recursive($call['args'], $flatten);
|
||||||
|
|
||||||
return $call;
|
return $call;
|
||||||
},
|
},
|
||||||
$exception->getTrace()
|
$trace
|
||||||
);
|
);
|
||||||
|
}
|
||||||
$traceProperty->setValue($exception, $trace);
|
$traceProperty->setValue($exception, $trace);
|
||||||
$exception = $exception->getPrevious();
|
$exception = $exception->getPrevious();
|
||||||
} while ($exception !== null);
|
} while ($exception !== null);
|
||||||
|
|||||||
@@ -56,8 +56,11 @@ final class InvalidTagTest extends TestCase
|
|||||||
self::assertSame('name', $tag->getName());
|
self::assertSame('name', $tag->getName());
|
||||||
self::assertSame('@name Body', $tag->render());
|
self::assertSame('@name Body', $tag->render());
|
||||||
self::assertSame($parentException, $tag->getException());
|
self::assertSame($parentException, $tag->getException());
|
||||||
self::assertStringStartsWith('(Closure at', $tag->getException()->getPrevious()->getTrace()[0]['args'][0]);
|
$trace = $tag->getException()->getPrevious()->getTrace();
|
||||||
self::assertStringContainsString(__FILE__, $tag->getException()->getPrevious()->getTrace()[0]['args'][0]);
|
if (isset($trace[0]['args'])) { // Not set by default on 7.4
|
||||||
|
self::assertStringStartsWith('(Closure at', $trace[0]['args'][0]);
|
||||||
|
self::assertStringContainsString(__FILE__, $trace[0]['args'][0]);
|
||||||
|
}
|
||||||
self::assertEquals($parentException, unserialize(serialize($parentException)));
|
self::assertEquals($parentException, unserialize(serialize($parentException)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,10 +84,13 @@ final class InvalidTagTest extends TestCase
|
|||||||
self::assertSame('name', $tag->getName());
|
self::assertSame('name', $tag->getName());
|
||||||
self::assertSame('@name Body', $tag->render());
|
self::assertSame('@name Body', $tag->render());
|
||||||
self::assertSame($parentException, $tag->getException());
|
self::assertSame($parentException, $tag->getException());
|
||||||
|
$trace = $tag->getException()->getPrevious()->getTrace();
|
||||||
|
if (isset($trace[0]['args'])) { // Not set by default on 7.4
|
||||||
self::assertStringStartsWith(
|
self::assertStringStartsWith(
|
||||||
'resource(stream)',
|
'resource(stream)',
|
||||||
$tag->getException()->getPrevious()->getTrace()[0]['args'][0]
|
$trace[0]['args'][0]
|
||||||
);
|
);
|
||||||
|
}
|
||||||
self::assertEquals($parentException, unserialize(serialize($parentException)));
|
self::assertEquals($parentException, unserialize(serialize($parentException)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user