diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index ad28290..eb052c5 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -10,7 +10,7 @@ return new PhpCsFixer\Config() ->setRules([ - '@PSR12' => true, + '@PER-CS2.0' => true, 'array_syntax' => ['syntax' => 'short'], 'blank_line_after_opening_tag' => true, 'compact_nullable_type_declaration' => true, diff --git a/src/CircularDependencyException.php b/src/CircularDependencyException.php index 30d3c61..bc03efa 100644 --- a/src/CircularDependencyException.php +++ b/src/CircularDependencyException.php @@ -17,7 +17,4 @@ /** * Defines an exception that's thrown when a circular dependency is detected */ -final class CircularDependencyException extends Exception -{ - // Don't do anything -} +final class CircularDependencyException extends Exception {} diff --git a/src/ConstraintViolation.php b/src/ConstraintViolation.php index 2135913..c620a23 100644 --- a/src/ConstraintViolation.php +++ b/src/ConstraintViolation.php @@ -34,6 +34,5 @@ public function __construct( public mixed $rootValue, public ?string $propertyName = null, public ?string $methodName = null - ) { - } + ) {} } diff --git a/src/Constraints/Attributes/ConstraintAttribute.php b/src/Constraints/Attributes/ConstraintAttribute.php index 1d56df6..581a0c7 100644 --- a/src/Constraints/Attributes/ConstraintAttribute.php +++ b/src/Constraints/Attributes/ConstraintAttribute.php @@ -20,7 +20,5 @@ abstract class ConstraintAttribute implements IConstraintAttribute /** * @param string|null $errorMessageId The error message ID, or null if there is none */ - protected function __construct(public readonly ?string $errorMessageId) - { - } + protected function __construct(public readonly ?string $errorMessageId) {} } diff --git a/src/Constraints/Caching/FileObjectConstraintsRegistryCache.php b/src/Constraints/Caching/FileObjectConstraintsRegistryCache.php index 61d7c0b..23d12b4 100644 --- a/src/Constraints/Caching/FileObjectConstraintsRegistryCache.php +++ b/src/Constraints/Caching/FileObjectConstraintsRegistryCache.php @@ -23,9 +23,7 @@ final class FileObjectConstraintsRegistryCache implements IObjectConstraintsRegi /** * @param string $path The path to the cache file */ - public function __construct(private readonly string $path) - { - } + public function __construct(private readonly string $path) {} /** * @inheritdoc diff --git a/src/Constraints/ObjectConstraintsRegistrantCollection.php b/src/Constraints/ObjectConstraintsRegistrantCollection.php index 51464ff..d1b3ac3 100644 --- a/src/Constraints/ObjectConstraintsRegistrantCollection.php +++ b/src/Constraints/ObjectConstraintsRegistrantCollection.php @@ -25,9 +25,7 @@ class ObjectConstraintsRegistrantCollection implements IObjectConstraintsRegistr /** * @param IObjectConstraintsRegistryCache|null $objectConstraintsCache The optional cache of constraints */ - public function __construct(private readonly ?IObjectConstraintsRegistryCache $objectConstraintsCache = null) - { - } + public function __construct(private readonly ?IObjectConstraintsRegistryCache $objectConstraintsCache = null) {} /** * Adds a registrant to the collection diff --git a/src/ErrorMessages/ErrorMessageInterpolationException.php b/src/ErrorMessages/ErrorMessageInterpolationException.php index 825a7e0..d9b411e 100644 --- a/src/ErrorMessages/ErrorMessageInterpolationException.php +++ b/src/ErrorMessages/ErrorMessageInterpolationException.php @@ -17,7 +17,4 @@ /** * Defines an exception that occurs if an error message could not be interpolated */ -final class ErrorMessageInterpolationException extends Exception -{ - // Don't do anything -} +final class ErrorMessageInterpolationException extends Exception {} diff --git a/src/ErrorMessages/StringReplaceErrorMessageInterpolator.php b/src/ErrorMessages/StringReplaceErrorMessageInterpolator.php index 9eff476..dcba88e 100644 --- a/src/ErrorMessages/StringReplaceErrorMessageInterpolator.php +++ b/src/ErrorMessages/StringReplaceErrorMessageInterpolator.php @@ -36,8 +36,7 @@ final class StringReplaceErrorMessageInterpolator implements IErrorMessageInterp */ public function __construct( private readonly IErrorMessageTemplateRegistry $errorMessageTemplates = new DefaultErrorMessageTemplateRegistry() - ) { - } + ) {} /** * @inheritdoc diff --git a/src/ObjectConstraintsBuilderRegistrant.php b/src/ObjectConstraintsBuilderRegistrant.php index 3f8795e..07554a8 100644 --- a/src/ObjectConstraintsBuilderRegistrant.php +++ b/src/ObjectConstraintsBuilderRegistrant.php @@ -24,9 +24,7 @@ final class ObjectConstraintsBuilderRegistrant implements IObjectConstraintsRegi /** * @param array $closures The list of closures to execute (must take in an ObjectConstraintsRegistryBuilder parameter) */ - public function __construct(private array $closures) - { - } + public function __construct(private array $closures) {} /** * @inheritdoc diff --git a/src/ObjectConstraintsRegistryBuilder.php b/src/ObjectConstraintsRegistryBuilder.php index 59bcc3a..a784ad7 100644 --- a/src/ObjectConstraintsRegistryBuilder.php +++ b/src/ObjectConstraintsRegistryBuilder.php @@ -27,8 +27,7 @@ final class ObjectConstraintsRegistryBuilder */ public function __construct( private readonly ObjectConstraintsRegistry $objectConstraints = new ObjectConstraintsRegistry() - ) { - } + ) {} /** * Builds the object constraints diff --git a/src/Validator.php b/src/Validator.php index 805b8cc..721f376 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -52,8 +52,7 @@ final class Validator implements IValidator public function __construct( private readonly ObjectConstraintsRegistry $objectConstraints, private readonly IErrorMessageInterpolator $errorMessageInterpolator = new StringReplaceErrorMessageInterpolator() - ) { - } + ) {} /** * @inheritdoc diff --git a/tests/Constraints/Attributes/AttributeConstraintsRegistrantTest.php b/tests/Constraints/Attributes/AttributeConstraintsRegistrantTest.php index 82dbd02..cc4edc9 100644 --- a/tests/Constraints/Attributes/AttributeConstraintsRegistrantTest.php +++ b/tests/Constraints/Attributes/AttributeConstraintsRegistrantTest.php @@ -44,7 +44,8 @@ public function method(): bool return true; } }; - $this->typeFinder->expects($this->once()) + $this->typeFinder + ->expects($this->once()) ->method('findAllClasses') ->with([self::PATH]) ->willReturn([$object::class]); @@ -65,7 +66,8 @@ public function method(): bool return true; } }; - $this->typeFinder->expects($this->once()) + $this->typeFinder + ->expects($this->once()) ->method('findAllClasses') ->with([self::PATH]) ->willReturn([$object::class]); @@ -85,7 +87,8 @@ public function method(): bool return true; } }; - $this->typeFinder->expects($this->once()) + $this->typeFinder + ->expects($this->once()) ->method('findAllClasses') ->with([self::PATH]) ->willReturn([$object::class]); @@ -104,7 +107,8 @@ public function testMultiplePropertyConstraintAttributesCanBeRegistered(): void #[Required, Email] public bool $prop = true; }; - $this->typeFinder->expects($this->once()) + $this->typeFinder + ->expects($this->once()) ->method('findAllClasses') ->with([self::PATH]) ->willReturn([$object::class]); @@ -123,7 +127,8 @@ public function testPropertiesWithConstraintsAreRegistered(): void #[Required] public bool $prop = true; }; - $this->typeFinder->expects($this->once()) + $this->typeFinder + ->expects($this->once()) ->method('findAllClasses') ->with([self::PATH]) ->willReturn([$object::class]); @@ -141,7 +146,8 @@ public function testPropertiesWithNonValidationConstraintAttributesAreNotRegiste #[NonConstraintAttribute] public bool $prop = true; }; - $this->typeFinder->expects($this->once()) + $this->typeFinder + ->expects($this->once()) ->method('findAllClasses') ->with([self::PATH]) ->willReturn([$object::class]); diff --git a/tests/Constraints/CallbackConstraintTest.php b/tests/Constraints/CallbackConstraintTest.php index 5656389..92fd95b 100644 --- a/tests/Constraints/CallbackConstraintTest.php +++ b/tests/Constraints/CallbackConstraintTest.php @@ -46,12 +46,12 @@ public function testCallbackReturnValueIsRespected(): void public function testGettingErrorMessageId(): void { - $constraint = new CallbackConstraint(fn (): bool => true, 'foo'); + $constraint = new CallbackConstraint(fn(): bool => true, 'foo'); $this->assertSame('foo', $constraint->errorMessageId); } public function testGettingErrorMessagePlaceholdersIncludesValue(): void { - $this->assertEquals(['value' => 'val'], (new CallbackConstraint(fn (mixed $value): bool => true))->getErrorMessagePlaceholders('val')); + $this->assertEquals(['value' => 'val'], (new CallbackConstraint(fn(mixed $value): bool => true))->getErrorMessagePlaceholders('val')); } } diff --git a/tests/Constraints/ConstraintTest.php b/tests/Constraints/ConstraintTest.php index 8ce7df4..741e6c9 100644 --- a/tests/Constraints/ConstraintTest.php +++ b/tests/Constraints/ConstraintTest.php @@ -60,8 +60,7 @@ public function __toString(): string public function testGettingErrorMessagePlaceholderForUnserializableObjectsUsesClassName(): void { - $value = new class () { - }; + $value = new class () {}; $this->assertEquals( ['value' => $value::class . ' object'], $this->constraint->getErrorMessagePlaceholders($value) diff --git a/tests/Constraints/EachConstraintTest.php b/tests/Constraints/EachConstraintTest.php index 17c7638..640113d 100644 --- a/tests/Constraints/EachConstraintTest.php +++ b/tests/Constraints/EachConstraintTest.php @@ -30,12 +30,14 @@ public function testGettingErrorMessagePlaceholdersIncludesValue(): void public function testMultipleConstraintsAreAccepted(): void { $constraint1 = $this->createMock(IConstraint::class); - $constraint1->expects($this->once()) + $constraint1 + ->expects($this->once()) ->method('passes') ->with('foo') ->willReturn(true); $constraint2 = $this->createMock(IConstraint::class); - $constraint2->expects($this->once()) + $constraint2 + ->expects($this->once()) ->method('passes') ->with('foo') ->willReturn(true); @@ -46,12 +48,14 @@ public function testMultipleConstraintsAreAccepted(): void public function testPassesOnAllPassedConstraintsReturnsTrue(): void { $constraint1 = $this->createMock(IConstraint::class); - $constraint1->expects($this->once()) + $constraint1 + ->expects($this->once()) ->method('passes') ->with('foo') ->willReturn(true); $constraint2 = $this->createMock(IConstraint::class); - $constraint2->expects($this->once()) + $constraint2 + ->expects($this->once()) ->method('passes') ->with('foo') ->willReturn(true); @@ -62,7 +66,8 @@ public function testPassesOnAllPassedConstraintsReturnsTrue(): void public function testPassesOnEmptyValueReturnsTrue(): void { $constraint = $this->createMock(IConstraint::class); - $constraint->expects($this->never()) + $constraint + ->expects($this->never()) ->method('passes'); $eachConstraint = new EachConstraint($constraint, 'foo'); $this->assertTrue($eachConstraint->passes([])); @@ -71,12 +76,14 @@ public function testPassesOnEmptyValueReturnsTrue(): void public function testPassesOnFailedConstraintDoesNotCallSecondConstraint(): void { $constraint1 = $this->createMock(IConstraint::class); - $constraint1->expects($this->once()) + $constraint1 + ->expects($this->once()) ->method('passes') ->with('foo') ->willReturn(false); $constraint2 = $this->createMock(IConstraint::class); - $constraint2->expects($this->never()) + $constraint2 + ->expects($this->never()) ->method('passes'); $eachConstraint = new EachConstraint([$constraint1, $constraint2], 'foo'); $this->assertFalse($eachConstraint->passes(['foo'])); @@ -93,12 +100,14 @@ public function testPassesOnNonIterableValueThrowsException(): void public function testPassesOnPassedAndFailedConstraintsReturnsFalse(): void { $constraint1 = $this->createMock(IConstraint::class); - $constraint1->expects($this->once()) + $constraint1 + ->expects($this->once()) ->method('passes') ->with('foo') ->willReturn(true); $constraint2 = $this->createMock(IConstraint::class); - $constraint2->expects($this->once()) + $constraint2 + ->expects($this->once()) ->method('passes') ->with('foo') ->willReturn(false); @@ -109,7 +118,8 @@ public function testPassesOnPassedAndFailedConstraintsReturnsFalse(): void public function testSingleConstraintIsAccepted(): void { $constraint = $this->createMock(IConstraint::class); - $constraint->expects($this->once()) + $constraint + ->expects($this->once()) ->method('passes') ->with('foo') ->willReturn(true); diff --git a/tests/Constraints/ObjectConstraintsRegistrantCollectionTest.php b/tests/Constraints/ObjectConstraintsRegistrantCollectionTest.php index a4f36cb..e0e61e9 100644 --- a/tests/Constraints/ObjectConstraintsRegistrantCollectionTest.php +++ b/tests/Constraints/ObjectConstraintsRegistrantCollectionTest.php @@ -46,7 +46,8 @@ public function testCacheHitCopiesCachedConstraintsIntoParameterConstraints(): v $cachedConstraints = new ObjectConstraintsRegistry(); $cachedConstraints->registerObjectConstraints(new ObjectConstraints(self::class)); $cache = $this->createMock(IObjectConstraintsRegistryCache::class); - $cache->method('get') + $cache + ->method('get') ->willReturn($cachedConstraints); $collection = new ObjectConstraintsRegistrantCollection($cache); $paramConstraints = new ObjectConstraintsRegistry(); @@ -58,9 +59,11 @@ public function testCacheMissPopulatesCache(): void { $expectedObjectConstraints = new ObjectConstraintsRegistry(); $cache = $this->createMock(IObjectConstraintsRegistryCache::class); - $cache->method('get') + $cache + ->method('get') ->willReturn(null); - $cache->method('set') + $cache + ->method('set') ->with($expectedObjectConstraints); $collection = new ObjectConstraintsRegistrantCollection($cache); $collection->registerConstraints($expectedObjectConstraints); diff --git a/tests/Constraints/RequiredConstraintTest.php b/tests/Constraints/RequiredConstraintTest.php index 53f6f48..6361376 100644 --- a/tests/Constraints/RequiredConstraintTest.php +++ b/tests/Constraints/RequiredConstraintTest.php @@ -23,7 +23,8 @@ public function testEmptyArrayFails(): void $constraint = new RequiredConstraint('foo'); $this->assertFalse($constraint->passes([])); $countable = $this->createMock(Countable::class); - $countable->expects($this->once()) + $countable + ->expects($this->once()) ->method('count') ->willReturn(0); $this->assertFalse($constraint->passes($countable)); diff --git a/tests/ErrorMessages/IcuFormatErrorMessageInterpolatorTest.php b/tests/ErrorMessages/IcuFormatErrorMessageInterpolatorTest.php index 12f040e..d1b7b72 100644 --- a/tests/ErrorMessages/IcuFormatErrorMessageInterpolatorTest.php +++ b/tests/ErrorMessages/IcuFormatErrorMessageInterpolatorTest.php @@ -57,7 +57,8 @@ public function testInterpolatingCorrectlyFormatsIcuFormattedErrorMessageIdWithP public function testInterpolatingGetsErrorMessageTemplateFromRegistry(): void { $errorMessageTemplates = $this->createMock(IErrorMessageTemplateRegistry::class); - $errorMessageTemplates->expects($this->once()) + $errorMessageTemplates + ->expects($this->once()) ->method('getErrorMessageTemplate') ->with('foo', 'en-US') ->willReturn('bar'); diff --git a/tests/ErrorMessages/StringReplaceErrorMessageInterpolatorTest.php b/tests/ErrorMessages/StringReplaceErrorMessageInterpolatorTest.php index a11b75c..60cf64c 100644 --- a/tests/ErrorMessages/StringReplaceErrorMessageInterpolatorTest.php +++ b/tests/ErrorMessages/StringReplaceErrorMessageInterpolatorTest.php @@ -27,7 +27,8 @@ public function testErrorMessageIdWithNoPlaceholdersIsReturnedIntact(): void public function testInterpolatingGetsErrorMessageTemplateFromRegistry(): void { $errorMessageTemplates = $this->createMock(IErrorMessageTemplateRegistry::class); - $errorMessageTemplates->expects($this->once()) + $errorMessageTemplates + ->expects($this->once()) ->method('getErrorMessageTemplate') ->with('foo', 'en-US') ->willReturn('bar'); diff --git a/tests/ObjectConstraintsBuilderRegistrantTest.php b/tests/ObjectConstraintsBuilderRegistrantTest.php index d007b75..171ea96 100644 --- a/tests/ObjectConstraintsBuilderRegistrantTest.php +++ b/tests/ObjectConstraintsBuilderRegistrantTest.php @@ -24,7 +24,8 @@ public function testRegisteringConstraintsRegistersConstraintsFromClosures(): vo { $expectedConstraint = $this->createMock(IConstraint::class); $closures = [function (ObjectConstraintsRegistryBuilder $objectConstraintsRegistryBuilder) use ($expectedConstraint): void { - $objectConstraintsRegistryBuilder->class(self::class) + $objectConstraintsRegistryBuilder + ->class(self::class) ->hasPropertyConstraints('prop', $expectedConstraint); }]; $closureConstraintRegistrant = new ObjectConstraintsBuilderRegistrant($closures); diff --git a/tests/ObjectConstraintsBuilderTest.php b/tests/ObjectConstraintsBuilderTest.php index 5841f47..9ca22f2 100644 --- a/tests/ObjectConstraintsBuilderTest.php +++ b/tests/ObjectConstraintsBuilderTest.php @@ -33,7 +33,8 @@ public function testBuiltConstraintsHasCorrectClassName(): void public function testHasMethodConstraintsWithMultipleConstraintsAddsThemToRegistry(): void { $expectedMethodConstraints = [$this->createMock(IConstraint::class), $this->createMock(IConstraint::class)]; - $objectConstraints = $this->builder->hasMethodConstraints('method', $expectedMethodConstraints) + $objectConstraints = $this->builder + ->hasMethodConstraints('method', $expectedMethodConstraints) ->build(); $this->assertSame($expectedMethodConstraints, $objectConstraints->getConstraintsForMethod('method')); } @@ -41,7 +42,8 @@ public function testHasMethodConstraintsWithMultipleConstraintsAddsThemToRegistr public function testHasMethodConstraintsWithSingleConstraintAddsItToRegistry(): void { $expectedMethodConstraint = $this->createMock(IConstraint::class); - $objectConstraints = $this->builder->hasMethodConstraints('method', $expectedMethodConstraint) + $objectConstraints = $this->builder + ->hasMethodConstraints('method', $expectedMethodConstraint) ->build(); $this->assertSame([$expectedMethodConstraint], $objectConstraints->getConstraintsForMethod('method')); } @@ -49,7 +51,8 @@ public function testHasMethodConstraintsWithSingleConstraintAddsItToRegistry(): public function testHasPropertyConstraintsWithMultipleConstraintsAddsThemToRegistry(): void { $expectedPropertyConstraints = [$this->createMock(IConstraint::class), $this->createMock(IConstraint::class)]; - $objectConstraints = $this->builder->hasPropertyConstraints('prop', $expectedPropertyConstraints) + $objectConstraints = $this->builder + ->hasPropertyConstraints('prop', $expectedPropertyConstraints) ->build(); $this->assertSame($expectedPropertyConstraints, $objectConstraints->getConstraintsForProperty('prop')); } @@ -57,7 +60,8 @@ public function testHasPropertyConstraintsWithMultipleConstraintsAddsThemToRegis public function testHasPropertyConstraintsWithSingleConstraintAddsItToRegistry(): void { $expectedPropertyConstraint = $this->createMock(IConstraint::class); - $objectConstraints = $this->builder->hasPropertyConstraints('prop', $expectedPropertyConstraint) + $objectConstraints = $this->builder + ->hasPropertyConstraints('prop', $expectedPropertyConstraint) ->build(); $this->assertSame([$expectedPropertyConstraint], $objectConstraints->getConstraintsForProperty('prop')); } diff --git a/tests/ObjectConstraintsRegistryBuilderTest.php b/tests/ObjectConstraintsRegistryBuilderTest.php index 6cdf8aa..baba7f2 100644 --- a/tests/ObjectConstraintsRegistryBuilderTest.php +++ b/tests/ObjectConstraintsRegistryBuilderTest.php @@ -38,10 +38,8 @@ public function testBuildWithInjectedRegistryRegistersConstraintsToIt(): void public function testBuildWithMultipleSubBuildersCreatesRegistryWithMultipleObjectConstraints(): void { - $foo = new class () { - }; - $bar = new class () { - }; + $foo = new class () {}; + $bar = new class () {}; $expectedObjectConstraints = new ObjectConstraintsRegistry(); $expectedObjectConstraints->registerObjectConstraints(new ObjectConstraints($foo::class)); $expectedObjectConstraints->registerObjectConstraints(new ObjectConstraints($bar::class)); diff --git a/tests/ValidationContextTest.php b/tests/ValidationContextTest.php index d58519b..533a7df 100644 --- a/tests/ValidationContextTest.php +++ b/tests/ValidationContextTest.php @@ -86,8 +86,7 @@ public function testAddingMoreConstraintViolationsAppendsThemToExistingViolation public function testCircularDependencyDetectedIfObjectAppearsInChildContext(): void { - $object = new class () { - }; + $object = new class () {}; $this->expectException(CircularDependencyException::class); $this->expectExceptionMessage('Circular dependency on ' . $object::class . ' detected'); $parentContext = new ValidationContext($object); @@ -187,8 +186,7 @@ public function testGettingPropertyNameReturnsOneSetInConstructor(): void public function testGettingRootValueReturnsParentValueIfParentContextExists(): void { $parentContext = new ValidationContext($this); - $childContext = new ValidationContext(new class () { - }, null, null, $parentContext); + $childContext = new ValidationContext(new class () {}, null, null, $parentContext); $this->assertSame($this, $childContext->rootValue); $this->assertSame($this, $parentContext->rootValue); } diff --git a/tests/ValidatorTest.php b/tests/ValidatorTest.php index 12e7635..7432322 100644 --- a/tests/ValidatorTest.php +++ b/tests/ValidatorTest.php @@ -132,7 +132,8 @@ public function method(): int [], ['method' => $constraints] )); - $this->errorMessageInterpolator->expects($this->once()) + $this->errorMessageInterpolator + ->expects($this->once()) ->method('interpolate') ->with($constraints[0]->errorMessageId, $constraints[0]->getErrorMessagePlaceholders(1)) ->willReturn('error'); @@ -265,7 +266,8 @@ public function testTryValidateObjectWithInvalidValueSetsConstraintViolations(): ['prop' => $constraints], [] )); - $this->errorMessageInterpolator->expects($this->once()) + $this->errorMessageInterpolator + ->expects($this->once()) ->method('interpolate') ->with($constraints[0]->errorMessageId, $constraints[0]->getErrorMessagePlaceholders(1)) ->willReturn('error'); @@ -357,7 +359,8 @@ public function testTryValidatePropertyWithInvalidValueSetsConstraintViolations( ['prop' => $constraints], [] )); - $this->errorMessageInterpolator->expects($this->once()) + $this->errorMessageInterpolator + ->expects($this->once()) ->method('interpolate') ->with($constraints[0]->errorMessageId, $constraints[0]->getErrorMessagePlaceholders(1)) ->willReturn('error'); @@ -405,8 +408,7 @@ public function testTryValidateValueWithValidValueHasNoConstraintViolations(): v public function testValidateMethodThatDoesNotExistThrowsException(): void { - $class = new class () { - }; + $class = new class () {}; $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage($class::class . '::foo() does not exist'); $this->validator->validateMethod($class, 'foo'); @@ -422,7 +424,8 @@ public function foo(): string }; $this->expectException(ValidationException::class); $constraint = $this->createMock(IConstraint::class); - $constraint->expects($this->once()) + $constraint + ->expects($this->once()) ->method('passes') ->with('foo') ->willReturn(false); @@ -477,8 +480,7 @@ public function testValidateObjectWithCircularDependencyThrowsException(): void public function testValidatePropertyThatDoesNotExistThrowsException(): void { - $class = new class () { - }; + $class = new class () {}; $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage($class::class . '::foo does not exist'); $this->validator->validateProperty($class, 'foo'); @@ -491,7 +493,8 @@ public function testValidatePropertyThrowsIfInvalid(): void }; $this->expectException(ValidationException::class); $constraint = $this->createMock(IConstraint::class); - $constraint->expects($this->once()) + $constraint + ->expects($this->once()) ->method('passes') ->with('foo') ->willReturn(false); @@ -522,7 +525,8 @@ public function testValidateValueThrowsIfInvalid(): void { $this->expectException(ValidationException::class); $constraint = $this->createMock(IConstraint::class); - $constraint->expects($this->once()) + $constraint + ->expects($this->once()) ->method('passes') ->with('foo') ->willReturn(false); @@ -539,7 +543,8 @@ public function testValidateValueThrowsIfInvalid(): void private function createMockConstraint(bool $shouldPass, mixed $value): IConstraint { $constraint = $this->createMock(IConstraint::class); - $constraint->expects($this->once()) + $constraint + ->expects($this->once()) ->method('passes') ->with($value) ->willReturn($shouldPass);