Merge branch '3.4' into 4.4
* 3.4: [PhpUnitBridge] fix PHP 5.3 compat [PhpUnitBridge] Mark parent class also covered in CoverageListener prevent notice for invalid octal numbers on PHP 7.4
This commit is contained in:
commit
2732dda83c
@ -69,10 +69,19 @@ class CoverageListenerTrait
|
|||||||
$r = new \ReflectionProperty(Test::class, 'annotationCache');
|
$r = new \ReflectionProperty(Test::class, 'annotationCache');
|
||||||
$r->setAccessible(true);
|
$r->setAccessible(true);
|
||||||
|
|
||||||
|
$covers = $sutFqcn;
|
||||||
|
if (!\is_array($sutFqcn)) {
|
||||||
|
$covers = [$sutFqcn];
|
||||||
|
while ($parent = get_parent_class($sutFqcn)) {
|
||||||
|
$covers[] = $parent;
|
||||||
|
$sutFqcn = $parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$cache = $r->getValue();
|
$cache = $r->getValue();
|
||||||
$cache = array_replace_recursive($cache, [
|
$cache = array_replace_recursive($cache, [
|
||||||
\get_class($test) => [
|
\get_class($test) => [
|
||||||
'covers' => \is_array($sutFqcn) ? $sutFqcn : [$sutFqcn],
|
'covers' => $covers,
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
$r->setValue(Test::class, $cache);
|
$r->setValue(Test::class, $cache);
|
||||||
|
@ -636,15 +636,21 @@ class Inline
|
|||||||
|
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case ctype_digit($scalar):
|
case ctype_digit($scalar):
|
||||||
$raw = $scalar;
|
if ('0' === $scalar[0]) {
|
||||||
|
return octdec(preg_replace('/[^0-7]/', '', $scalar));
|
||||||
|
}
|
||||||
|
|
||||||
$cast = (int) $scalar;
|
$cast = (int) $scalar;
|
||||||
|
|
||||||
return '0' == $scalar[0] ? octdec($scalar) : (((string) $raw == (string) $cast) ? $cast : $raw);
|
return ($scalar === (string) $cast) ? $cast : $scalar;
|
||||||
case '-' === $scalar[0] && ctype_digit(substr($scalar, 1)):
|
case '-' === $scalar[0] && ctype_digit(substr($scalar, 1)):
|
||||||
$raw = $scalar;
|
if ('0' === $scalar[1]) {
|
||||||
|
return -octdec(preg_replace('/[^0-7]/', '', substr($scalar, 1)));
|
||||||
|
}
|
||||||
|
|
||||||
$cast = (int) $scalar;
|
$cast = (int) $scalar;
|
||||||
|
|
||||||
return '0' == $scalar[1] ? -octdec(substr($scalar, 1)) : (($raw === (string) $cast) ? $cast : $raw);
|
return ($scalar === (string) $cast) ? $cast : $scalar;
|
||||||
case is_numeric($scalar):
|
case is_numeric($scalar):
|
||||||
case Parser::preg_match(self::getHexRegex(), $scalar):
|
case Parser::preg_match(self::getHexRegex(), $scalar):
|
||||||
$scalar = str_replace('_', '', $scalar);
|
$scalar = str_replace('_', '', $scalar);
|
||||||
|
@ -781,6 +781,16 @@ class InlineTest extends TestCase
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testParsePositiveOctalNumberContainingInvalidDigits()
|
||||||
|
{
|
||||||
|
self::assertSame(342391, Inline::parse('0123456789'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testParseNegativeOctalNumberContainingInvalidDigits()
|
||||||
|
{
|
||||||
|
self::assertSame(-342391, Inline::parse('-0123456789'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider unquotedExclamationMarkThrowsProvider
|
* @dataProvider unquotedExclamationMarkThrowsProvider
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user