Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/Makefile export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpstan-baseline.neon export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml.dist export-ignore
/tests export-ignore
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"doctrine/coding-standard": "^9.0",
"infection/infection": "^0.26.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "0.12.96",
"phpstan/phpstan-phpunit": "0.12.22",
"phpstan/phpstan-strict-rules": "0.12.11",
"phpstan/phpstan": "^1.3",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.1",
"phpunit/phpunit": "^9.2",
"psalm/plugin-phpunit": "^0.16.1",
"roave/infection-static-analysis-plugin": "^1.7",
Expand Down
4 changes: 2 additions & 2 deletions infection.json.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
},
"text": "infection-log.txt"
},
"minMsi": 93,
"minCoveredMsi": 95
"minMsi": 84,
"minCoveredMsi": 87
}
12 changes: 12 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
parameters:
ignoreErrors:
-
message: "#^Cannot access offset 'defaultValue' on mixed\\.$#"
count: 1
path: src/Builder/FieldBuilder.php

-
message: "#^Cannot access offset string on mixed\\.$#"
count: 1
path: src/Builder/FieldBuilder.php

3 changes: 3 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ parameters:
ignoreErrors:
# Adds unnecessary maintanence overhead
- "~Class DateTime(Immutable)? is unsafe to use. Its methods can return FALSE instead of throwing an exception. Please add 'use Safe\\\\DateTime(Immutable)?;' at the beginning of the file to use the variant provided by the 'thecodingmachine/safe' library~"

includes:
- phpstan-baseline.neon
6 changes: 5 additions & 1 deletion src/Exception/InvalidArgument.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Exception;
use GraphQL\Error\ClientAware;
use GraphQL\Utils\Utils;
use SimPod\GraphQLUtils\Builder\TypeBuilder;
use Throwable;

Expand All @@ -26,7 +27,10 @@ public static function invalidNameFormat(string $invalidName): self
/** @param mixed $invalidValue */
public static function valueNotIso8601Compliant($invalidValue): self
{
return new self(sprintf('DateTime type expects input value to be ISO 8601 compliant. Given invalid value "%s"', (string) $invalidValue));
return new self(sprintf(
'DateTime type expects input value to be ISO 8601 compliant. Given invalid value "%s"',
Utils::printSafeJson($invalidValue)
));
}

public function isClientSafe(): bool
Expand Down
2 changes: 1 addition & 1 deletion src/Type/DateTimeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class DateTimeType extends CustomScalarType

/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint
* @var string
* @var string|null
*/
public $description = self::DESCRIPTION;

Expand Down
1 change: 1 addition & 0 deletions tests/Builder/EnumBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function testCreate(): void

$values = $object['values'];

self::assertIsArray($values);
self::assertCount(2, $values);

self::assertArrayHasKey('EnumName', $values);
Expand Down
1 change: 1 addition & 0 deletions tests/Builder/FieldBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ static function (): string {
self::assertIsCallable($field['resolve']);
self::assertSame('Resolver result', $field['resolve']());

self::assertIsArray($field['args']);
self::assertCount(1, $field['args']);
$args = $field['args'];
self::assertArrayHasKey('arg1', $args);
Expand Down
1 change: 1 addition & 0 deletions tests/Builder/InterfaceBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ static function (bool $value): Type {
self::assertIsArray($interface['fields']);
self::assertCount(1, $interface['fields']);
self::assertArrayHasKey('resolveType', $interface);
self::assertIsCallable($interface['resolveType']);
self::assertSame(Type::string(), $interface['resolveType'](true));
self::assertSame(Type::int(), $interface['resolveType'](false));
}
Expand Down
6 changes: 5 additions & 1 deletion tests/Builder/UnionBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ public function testCreate(): void
[$typeA, $typeB]
)
->setResolveType(
static function (bool $value) use ($typeA, $typeB): ObjectType {
/** @param mixed $value */
static function ($value) use ($typeA, $typeB): ObjectType {
self::assertIsBool($value);

return $value ? $typeA : $typeB;
}
)
Expand All @@ -41,6 +44,7 @@ static function (bool $value) use ($typeA, $typeB): ObjectType {
self::assertCount(2, $union['types']);

self::assertArrayHasKey('resolveType', $union);
self::assertIsCallable($union['resolveType']);
self::assertSame($typeA, $union['resolveType'](true));
self::assertSame($typeB, $union['resolveType'](false));
}
Expand Down