Skip to content

Commit

Permalink
Move ReflectionType::__toString() cases to getName()
Browse files Browse the repository at this point in the history
While this has become obvious in php74, because now a warning is
emitted, that function has been deprecated since php71 (without
warning), so it's perfectly ok/safe to apply for it in phpunit7 (that
officially supports php71-php73).

Plus, of course, this enables some projects, that cannot follow
phpunit support schema 100% all the time, to continue working
with phpunit7 and php74.

Our case, Moodle 3.8, to be released in November 2019, days before
the end of php71 support, will need to support php71 and also php74.
Having an unique phpunit helps a lot, and it seems achievable.

Then, in Moodle 3.9, to be released in May 2020, we'll upgrade
to phpunit8 because that will match 100% out php72 - php74.

So basically, in our May releases, we always match 100% phpunit's
php supported versions, but in our November releases, we usually
require an older phpunit to work with a newer php (that is not bad).
  • Loading branch information
stronk7 authored and sebastianbergmann committed Jul 27, 2019
1 parent 2834789 commit e11397f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Framework/MockObject/MockMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static function fromReflection(ReflectionMethod $method, bool $callOrigin
}

if ($method->hasReturnType()) {
$returnType = (string) $method->getReturnType();
$returnType = $method->getReturnType()->getName();
} else {
$returnType = '';
}
Expand Down Expand Up @@ -301,8 +301,8 @@ private static function getMethodParameters(ReflectionMethod $method, bool $forC
$nullable = '?';
}

if ($parameter->hasType() && (string) $parameter->getType() !== 'self') {
$typeDeclaration = $parameter->getType() . ' ';
if ($parameter->hasType() && $parameter->getType()->getName() !== 'self') {
$typeDeclaration = $parameter->getType()->getName() . ' ';
} else {
try {
$class = $parameter->getClass();
Expand Down

0 comments on commit e11397f

Please sign in to comment.