Skip to content

Commit

Permalink
Build fixes because of arginfo changes in PHP 7.1.17 and PHP 7.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich committed May 8, 2018
1 parent 68ebc69 commit 95131c8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion stub/DateTime.stub
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DateTime implements DateTimeInterface

const W3C = 'Y-m-d\\TH:i:sP';

public function __construct($time = 'now', $object = null)
public function __construct($time = 'now', $timezone = null)
{
}

Expand Down
2 changes: 1 addition & 1 deletion stub/DateTimeImmutable.stub
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class DateTimeImmutable implements DateTimeInterface
{

public function __construct($time = 'now', $object = null)
public function __construct($time = 'now', $timezone = null)
{
}

Expand Down
16 changes: 16 additions & 0 deletions test/unit/SourceLocator/Type/PhpInternalSourceLocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
namespace Roave\BetterReflectionTest\SourceLocator\Type;

use Closure;
use DateTime;
use DateTimeImmutable;
use DOMNamedNodeMap;
use IntlChar;
use IntlGregorianCalendar;
Expand Down Expand Up @@ -387,6 +389,20 @@ private function assertSameParameterAttributes(
self::markTestSkipped('New type hints were introduced in PHP 7.2 for ' . $parameterName);
}

if (
(PHP_VERSION_ID < 70117 || (PHP_VERSION_ID >= 70200 && PHP_VERSION_ID < 70205))
&& in_array(
$parameterName,
[
'DateTime#__construct.timezone',
'DateTimeImmutable#__construct.timezone',
],
true
)
) {
self::markTestSkipped('Argument name was changed in PHP 7.1.17 and 7.2.5 for ' . $parameterName);
}

self::assertSame($original->getName(), $stubbed->getName(), $parameterName);
self::assertSame($original->isArray(), $stubbed->isArray(), $parameterName);
if (! ($original->getDeclaringClass()->getName() === Closure::class && $originalMethod->getName() === 'fromCallable')) {
Expand Down

0 comments on commit 95131c8

Please sign in to comment.