Skip to content

Commit

Permalink
Merge 43c13ea into 762a149
Browse files Browse the repository at this point in the history
  • Loading branch information
simPod committed Mar 27, 2021
2 parents 762a149 + 43c13ea commit 95da877
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Expand Up @@ -605,11 +605,6 @@ parameters:
count: 1
path: tests/Executor/DirectivesTest.php

-
message: "#^Anonymous function should have native return typehint \"class@anonymous/tests/Executor/ExecutorTest\\.php\\:1329\"\\.$#"
count: 1
path: tests/Executor/ExecutorTest.php

-
message: "#^Only booleans are allowed in a negated boolean, GraphQL\\\\Type\\\\Definition\\\\InterfaceType given\\.$#"
count: 1
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/AST.php
Expand Up @@ -259,7 +259,7 @@ public static function astFromValue($value, InputType $type)
}
if (is_float($serialized)) {
// int cast with == used for performance reasons
// phpcs:ignore
// phpcs:ignore SlevomatCodingStandard.Operators.DisallowEqualOperators.DisallowedEqualOperator
if ((int) $serialized == $serialized) {
return new IntValueNode(['value' => (string) $serialized]);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Executor/ExecutorTest.php
Expand Up @@ -1325,7 +1325,7 @@ public function offsetUnset($offset)
],
'objectVirtual' => [
'type' => $ObjectVirtual,
'resolve' => static function () {
'resolve' => static function () : object {
return new class {
public function __isset($name) : bool
{
Expand Down
25 changes: 13 additions & 12 deletions tests/PHPUnit/Constraint/ArraySubset.php
Expand Up @@ -29,13 +29,9 @@
*/
final class ArraySubset extends Constraint
{
/**
* @var iterable|mixed[]
*/
/** @var iterable|mixed[] */
private $subset;
/**
* @var bool
*/
/** @var bool */
private $strict;

/**
Expand All @@ -46,9 +42,11 @@ public function __construct(iterable $subset, bool $strict = false)
$this->strict = $strict;
$this->subset = $subset;

if (method_exists(Constraint::class, '__construct')) {
parent::__construct();
if (! method_exists(Constraint::class, '__construct')) {
return;
}

parent::__construct();
}

/**
Expand All @@ -62,7 +60,8 @@ public function __construct(iterable $subset, bool $strict = false)
* failure.
*
* @param mixed[]|ArrayAccess $other
* @return mixed[]|null|bool
*
* @return mixed[]|bool|null
*
* @throws ExpectationFailedException
* @throws InvalidArgumentException
Expand All @@ -77,6 +76,7 @@ public function evaluate($other, $description = '', $returnResult = false)
if ($this->strict) {
$result = $other === $patched;
} else {
// phpcs:ignore SlevomatCodingStandard.Operators.DisallowEqualOperators.DisallowedEqualOperator
$result = $other == $patched;
}
if ($returnResult) {
Expand All @@ -100,7 +100,7 @@ public function evaluate($other, $description = '', $returnResult = false)
*
* @throws InvalidArgumentException
*/
public function toString(): string
public function toString() : string
{
$exporter = method_exists($this, 'exporter') ? $this->exporter() : $this->exporter;

Expand All @@ -117,7 +117,7 @@ public function toString(): string
*
* @throws InvalidArgumentException
*/
protected function failureDescription($other): string
protected function failureDescription($other) : string
{
return 'an array ' . $this->toString();
}
Expand All @@ -127,7 +127,7 @@ protected function failureDescription($other): string
*
* @return mixed[]
*/
private function toArray(iterable $other): array
private function toArray(iterable $other) : array
{
if (is_array($other)) {
return $other;
Expand All @@ -138,6 +138,7 @@ private function toArray(iterable $other): array
if ($other instanceof Traversable) {
return iterator_to_array($other);
}

// Keep BC even if we know that array would not be the expected one
return (array) $other;
}
Expand Down

0 comments on commit 95da877

Please sign in to comment.