Skip to content

Commit c04dfef

Browse files
authored
Merge pull request #147 from moufmouf/php7.4-testing
Adding Travis tests on PHP 7.4
2 parents a5d2497 + 388e901 commit c04dfef

File tree

7 files changed

+28
-9
lines changed

7 files changed

+28
-9
lines changed

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ jobs:
1616
- composer phpstan
1717
after_script:
1818
- ./vendor/bin/coveralls -v
19+
- stage: test
20+
php: 7.4snapshot
21+
env: PREFER_LOWEST=""
22+
before_script:
23+
- *composerupdate
24+
script:
25+
- *phpunit
1926
- stage: test
2027
php: 7.2
2128
env: PREFER_LOWEST=""

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"symfony/lock": "^3 || ^4"
2525
},
2626
"require-dev": {
27-
"phpunit/phpunit": "^6.1",
27+
"phpunit/phpunit": "^7.5.16",
2828
"satooshi/php-coveralls": "^1.0",
2929
"symfony/cache": "^4.1.4",
3030
"mouf/picotainer": "^1.1",

phpunit.xml.dist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
convertWarningsToExceptions="true"
99
processIsolation="false"
1010
stopOnFailure="false"
11-
syntaxCheck="false"
12-
bootstrap="vendor/autoload.php"
11+
bootstrap="tests/Bootstrap.php"
1312
>
1413
<testsuites>
1514
<testsuite name="GraphQLite Test Suite">
1615
<directory>./tests/</directory>
1716
<exclude>./tests/dependencies/</exclude>
17+
<exclude>./tests/Bootstrap.php</exclude>
1818
</testsuite>
1919
</testsuites>
2020

@@ -24,7 +24,7 @@
2424
</whitelist>
2525
</filter>
2626
<logging>
27-
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
27+
<log type="coverage-html" target="build/coverage"/>
2828
<log type="coverage-clover" target="build/logs/clover.xml"/>
2929
</logging>
3030
</phpunit>

src/FieldsBuilder.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,9 @@ private function mapReturnType(ReflectionMethod $refMethod, DocBlock $docBlockOb
308308
$returnType = $refMethod->getReturnType();
309309
if ($returnType !== null) {
310310
$typeResolver = new \phpDocumentor\Reflection\TypeResolver();
311-
$phpdocType = $typeResolver->resolve((string) $returnType);
311+
$phpdocType = $typeResolver->resolve(
312+
$returnType->getName()
313+
);
312314
$phpdocType = $this->resolveSelf($phpdocType, $refMethod->getDeclaringClass());
313315
} else {
314316
$phpdocType = new Mixed_();
@@ -490,10 +492,11 @@ private function mapParameters(array $refParameters, DocBlock $docBlock): array
490492
$parameterType = $parameter->getType();
491493
$allowsNull = $parameterType === null ? true : $parameterType->allowsNull();
492494

493-
$type = (string) $parameterType;
494-
if ($type === '') {
495+
if ($parameterType === null) {
495496
throw MissingTypeHintException::missingTypeHint($parameter);
496497
}
498+
499+
$type = $parameterType->getName();
497500
$phpdocType = $typeResolver->resolve($type);
498501
$phpdocType = $this->resolveSelf($phpdocType, $parameter->getDeclaringClass());
499502

src/InputTypeUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private function validateReturnType(ReflectionMethod $refMethod): Fqsen
5555
throw MissingTypeHintException::nullableReturnType($refMethod);
5656
}
5757

58-
$type = (string) $returnType;
58+
$type = $returnType->getName();
5959

6060
$typeResolver = new \phpDocumentor\Reflection\TypeResolver();
6161

src/MissingTypeHintException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static function missingReturnType(ReflectionMethod $method): self
1818

1919
public static function invalidReturnType(ReflectionMethod $method): self
2020
{
21-
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()));
21+
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() ? $method->getReturnType()->getName() : 'mixed'));
2222
}
2323

2424
public static function nullableReturnType(ReflectionMethod $method): self

tests/Bootstrap.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
use Doctrine\Common\Annotations\AnnotationRegistry;
4+
5+
$autoloader = require_once __DIR__ . '/../vendor/autoload.php';
6+
7+
AnnotationRegistry::registerLoader('class_exists');
8+
9+
return $autoloader;

0 commit comments

Comments
 (0)