Skip to content
Merged
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ jobs:
- composer cs-check
after_script:
- travis_retry php vendor/bin/php-coveralls -v
- stage: test
php: 7.4snapshot
env: PREFER_LOWEST=""
before_script:
- *composerupdate
script:
- *phpunit
- stage: test
php: 7.2
env: PREFER_LOWEST=""
Expand Down
3 changes: 2 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="vendor/autoload.php"
bootstrap="tests/Bootstrap.php"
>
<testsuites>
<testsuite name="GraphQLite Test Suite">
<directory>./tests/</directory>
<exclude>./tests/dependencies/</exclude>
<exclude>./tests/Bootstrap.php</exclude>
</testsuite>
</testsuites>

Expand Down
2 changes: 1 addition & 1 deletion src/InputTypeUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private function validateReturnType(ReflectionMethod $refMethod): Fqsen
throw MissingTypeHintRuntimeException::nullableReturnType($refMethod);
}

$type = (string) $returnType;
$type = $returnType->getName();

$typeResolver = new TypeResolver();

Expand Down
2 changes: 1 addition & 1 deletion src/Mappers/Parameters/TypeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ private function resolveSelf(Type $type, ReflectionClass $reflectionClass): Type

private function reflectionTypeToPhpDocType(ReflectionType $type, ReflectionClass $reflectionClass): Type
{
$phpdocType = $this->phpDocumentorTypeResolver->resolve((string) $type);
$phpdocType = $this->phpDocumentorTypeResolver->resolve($type->getName());
Assert::notNull($phpdocType);

return $this->resolveSelf($phpdocType, $reflectionClass);
Expand Down
4 changes: 3 additions & 1 deletion src/MissingTypeHintRuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ public static function missingReturnType(ReflectionMethod $method): self

public static function invalidReturnType(ReflectionMethod $method): self
{
return new self(sprintf('The return type of factory "%s::%s" must be an object, "%s" passed instead.', $method->getDeclaringClass()->getName(), $method->getName(), $method->getReturnType()));
$returnType = $method->getReturnType();

return new self(sprintf('The return type of factory "%s::%s" must be an object, "%s" passed instead.', $method->getDeclaringClass()->getName(), $method->getName(), $returnType ? $returnType->getName() : 'mixed'));
}

public static function nullableReturnType(ReflectionMethod $method): self
Expand Down
9 changes: 9 additions & 0 deletions tests/Bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

use Doctrine\Common\Annotations\AnnotationRegistry;

$autoloader = require_once __DIR__ . '/../vendor/autoload.php';

AnnotationRegistry::registerLoader('class_exists');

return $autoloader;