Skip to content

Draft : change to SF 6 #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix CI
  • Loading branch information
nguyenk committed Mar 20, 2023
commit 7b1ee6e6743c35502135315d2d4d7a54014cf71d
17 changes: 3 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,13 @@ env:
matrix:
fast_finish: true
include:
# Test the latest stable release
- php: 7.2
- php: 8.0
env: COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text"

# Test LTS versions.
- php: 8.0
env: DEPENDENCIES="symfony/lts:^4"

# Latest commit to master
- php: 8.0
env: STABILITY="dev"
- php: 8.1
env: DEPENDENCIES="symfony/^6"

allow_failures:
# Minimum supported dependencies with the latest and oldest PHP version
- php: 8.0
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak_vendors"
- php: 7.2
- php: 8.1
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak_vendors"
# Dev-master is allowed to fail.
- env: STABILITY="dev"
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"doctrine/annotations": "^1.13"
},
"require-dev": {
"phpunit/phpunit": "^8.4.1",
"phpunit/phpunit": "^9.6.5",
"mouf/picotainer": "^1.1",
"phpstan/phpstan": "^0.12.14",
"phpstan/phpstan": "^1.8",
"php-coveralls/php-coveralls": "^2.1.0",
"symfony/translation": "^6",
"doctrine/coding-standard": "^11.1"
Expand Down
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
parameters:
ignoreErrors:

excludePaths:
- vendor
- cache
- .phpstan-cache

#includes:
# - vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon
8 changes: 2 additions & 6 deletions src/Annotations/Assertion.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ class Assertion implements ParameterAnnotationInterface
/** @var Constraint[] */
private $constraint;

/**
* @param array<string, mixed> $values
*/
/** @param array<string, mixed> $values */
public function __construct(array $values)
{
if (! isset($values['for'])) {
Expand All @@ -50,9 +48,7 @@ public function getTarget(): string
return $this->for;
}

/**
* @return Constraint[]
*/
/** @return Constraint[] */
public function getConstraint(): array
{
return $this->constraint;
Expand Down
1 change: 1 addition & 0 deletions src/ConstraintViolationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ConstraintViolationException extends Exception implements GraphQLException
public function __construct(ConstraintViolationInterface $violation)
{
parent::__construct((string) $violation->getMessage(), 400);

$this->violation = $violation;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Mappers/Parameters/AssertParameterMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(ConstraintValidatorFactoryInterface $constraintValid
$this->translator = $translator;
}

public function mapParameter(ReflectionParameter $refParameter, DocBlock $docBlock, ?Type $paramTagType, ParameterAnnotations $parameterAnnotations, ParameterHandlerInterface $next): ParameterInterface
public function mapParameter(ReflectionParameter $refParameter, DocBlock $docBlock, Type|null $paramTagType, ParameterAnnotations $parameterAnnotations, ParameterHandlerInterface $next): ParameterInterface
{
/** @var Assertion[] $assertionAnnotations */
$assertionAnnotations = $parameterAnnotations->getAnnotationsByType(Assertion::class);
Expand Down
10 changes: 3 additions & 7 deletions src/Mappers/Parameters/ParameterValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ class ParameterValidator implements InputTypeParameterInterface
/** @var TranslatorInterface */
private $translator;

/**
* @param Constraint[] $constraints
*/
/** @param Constraint[] $constraints */
public function __construct(InputTypeParameterInterface $parameter, string $parameterName, array $constraints, ConstraintValidatorFactoryInterface $constraintValidatorFactory, ValidatorInterface $validator, TranslatorInterface $translator)
{
$this->parameter = $parameter;
Expand All @@ -48,7 +46,7 @@ public function __construct(InputTypeParameterInterface $parameter, string $para
*
* @return mixed
*/
public function resolve(?object $source, array $args, $context, ResolveInfo $info)
public function resolve(object|null $source, array $args, $context, ResolveInfo $info)
{
$value = $this->parameter->resolve($source, $args, $context, $info);

Expand Down Expand Up @@ -79,9 +77,7 @@ public function hasDefaultValue(): bool
return $this->parameter->hasDefaultValue();
}

/**
* @return mixed
*/
/** @return mixed */
public function getDefaultValue()
{
return $this->parameter->getDefaultValue();
Expand Down
9 changes: 3 additions & 6 deletions src/ValidationFailedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ class ValidationFailedException extends InvalidArgumentException implements Grap
/** @var ConstraintViolationException[] */
private $exceptions = [];

/**
* @param ConstraintViolationListInterface<ConstraintViolationInterface> $constraintViolationList
*/
/** @param ConstraintViolationListInterface<ConstraintViolationInterface> $constraintViolationList */
public function __construct(ConstraintViolationListInterface $constraintViolationList)
{
parent::__construct('Validation failed:', 400);

foreach ($constraintViolationList as $constraintViolation) {
$this->add($constraintViolation);
}
Expand All @@ -33,9 +32,7 @@ private function add(ConstraintViolationInterface $violation): void
$this->message .= "\n" . $violation->getMessage();
}

/**
* @return (ClientAware&Throwable)[]
*/
/** @return (ClientAware&Throwable)[] */
public function getExceptions(): array
{
return $this->exceptions;
Expand Down