Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Validator] Fix CS in constraint tests#41440

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
derrabus merged 1 commit intosymfony:6.0fromderrabus:cs/constraint-tests
May 29, 2021
Merged
Show file tree
Hide file tree
Changes fromall 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
Fix CS in constraint tests
  • Loading branch information
@derrabus
derrabus committedMay 29, 2021
commit59727d3f182b24178902c79df008aa4944a1d56b
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -223,7 +223,7 @@ public function testInvalidBics($bic, $code)
*/
public function testInvalidBicsNamed($bic, $code)
{
$constraint = new Bic(message:"myMessage");
$constraint = new Bic(message:'myMessage');

$this->validator->validate($bic, $constraint);

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -243,7 +243,7 @@ public function testPayloadIsPassedToCallback()
$this->assertEquals('Hello world!', $payloadCopy);

$payloadCopy = 'Replace me!';
$constraint = new Callback(callback: $callback, payload:"Hello world!");
$constraint = new Callback(callback: $callback, payload:'Hello world!');
$this->validator->validate($object, $constraint);
$this->assertEquals('Hello world!', $payloadCopy);
$payloadCopy = 'Replace me!';
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -89,7 +89,7 @@ public function provideConstraintsWithChoicesArray(): iterable
yield 'Doctrine style' => [new Choice(['choices' => ['foo', 'bar']])];
yield 'Doctrine default option' => [new Choice(['value' => ['foo', 'bar']])];
yield 'first argument' => [new Choice(['foo', 'bar'])];
yield 'named arguments' => [new Choice(choices: ["foo", "bar"])];
yield 'named arguments' => [new Choice(choices: ['foo', 'bar'])];
}

/**
Expand All@@ -111,9 +111,9 @@ public function provideConstraintsWithCallbackFunction(): iterable
},
])];
yield 'doctrine style, static method' => [new Choice(['callback' => [__CLASS__, 'staticCallback']])];
yield 'named arguments, namespaced function' => [new Choice(callback:'Symfony\Component\Validator\Tests\Constraints\choice_callback')];
yield 'named arguments, closure' => [new Choice(callback: fn () => ["foo", "bar"])];
yield 'named arguments, static method' => [new Choice(callback: ["Symfony\Component\Validator\Tests\Constraints\ChoiceValidatorTest", "staticCallback"])];
yield 'named arguments, namespaced function' => [new Choice(callback:__NAMESPACE__.'\choice_callback')];
yield 'named arguments, closure' => [new Choice(callback: fn () => ['foo', 'bar'])];
yield 'named arguments, static method' => [new Choice(callback: [__CLASS__, 'staticCallback'])];
}

public function testValidChoiceCallbackContextMethod()
Expand DownExpand Up@@ -179,7 +179,7 @@ public function testInvalidChoice(Choice $constraint)
public function provideConstraintsWithMessage(): iterable
{
yield 'Doctrine style' => [new Choice(['choices' => ['foo', 'bar'], 'message' => 'myMessage'])];
yield 'named arguments' => [new Choice(choices: ["foo", "bar"], message:"myMessage")];
yield 'named arguments' => [new Choice(choices: ['foo', 'bar'], message:'myMessage')];
}

public function testInvalidChoiceEmptyChoices()
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -161,7 +161,7 @@ public function testTooManyValues($value)
*/
public function testTooManyValuesNamed($value)
{
$constraint = new Count(max: 4, maxMessage:"myMessage");
$constraint = new Count(max: 4, maxMessage:'myMessage');

$this->validator->validate($value, $constraint);

Expand DownExpand Up@@ -200,7 +200,7 @@ public function testTooFewValues($value)
*/
public function testTooFewValuesNamed($value)
{
$constraint = new Count(min: 4, minMessage:"myMessage");
$constraint = new Count(min: 4, minMessage:'myMessage');

$this->validator->validate($value, $constraint);

Expand DownExpand Up@@ -240,7 +240,7 @@ public function testTooManyValuesExact($value)
*/
public function testTooManyValuesExactNamed($value)
{
$constraint = new Count(exactly: 4, exactMessage:"myMessage");
$constraint = new Count(exactly: 4, exactMessage:'myMessage');

$this->validator->validate($value, $constraint);

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -157,7 +157,7 @@ public function testInvalidAlpha3CountryNamed()
{
$this->validator->validate(
'DE',
new Country(alpha3: true, message:"myMessage")
new Country(alpha3: true, message:'myMessage')
);

$this->buildViolation('myMessage')
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,7 +117,7 @@ public function testInvalidCurrencies($currency)
*/
public function testInvalidCurrenciesNamed($currency)
{
$constraint = new Currency(message:"myMessage");
$constraint = new Currency(message:'myMessage');

$this->validator->validate($currency, $constraint);

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -118,7 +118,7 @@ public function getInvalidDateTimes()

public function testInvalidDateTimeNamed()
{
$constraint = new DateTime(message:"myMessage", format:"Y-m-d");
$constraint = new DateTime(message:'myMessage', format:'Y-m-d');

$this->validator->validate('2010-01-01 00:00:00', $constraint);

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -81,7 +81,7 @@ public function testInvalidDates($date, $code)

public function testInvalidDateNamed()
{
$constraint = new Date(message:"myMessage");
$constraint = new Date(message:'myMessage');

$this->validator->validate('foobar', $constraint);

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ public function provideServiceValidatedConstraints(): iterable
{
yield 'Doctrine style' => [new ExpressionLanguageSyntax(['service' => 'my_service'])];

yield 'named arguments' => [new ExpressionLanguageSyntax(service:"my_service")];
yield 'named arguments' => [new ExpressionLanguageSyntax(service:'my_service')];

$metadata = new ClassMetadata(ExpressionLanguageSyntaxDummy::class);
self::assertTrue((new AnnotationLoader())->loadClassMetadata($metadata));
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -289,7 +289,7 @@ public function testBinaryFormatNamed()
fwrite($this->file, '0');
fclose($this->file);

$constraint = new File(maxSize: 10, binaryFormat: true, maxSizeMessage:"myMessage");
$constraint = new File(maxSize: 10, binaryFormat: true, maxSizeMessage:'myMessage');

$this->validator->validate($this->getFile($this->path), $constraint);

Expand DownExpand Up@@ -387,7 +387,7 @@ public function provideMimeTypeConstraints(): iterable
'mimeTypesMessage' => 'myMessage',
])];
yield 'named arguments' => [
new File(mimeTypes: ["image/png", "image/jpg"], mimeTypesMessage:"myMessage"),
new File(mimeTypes: ['image/png', 'image/jpg'], mimeTypesMessage:'myMessage'),
];
}

Expand DownExpand Up@@ -444,7 +444,7 @@ public function provideDisallowEmptyConstraints(): iterable
'disallowEmptyMessage' => 'myMessage',
])];
yield 'named arguments' => [
new File(disallowEmptyMessage:"myMessage"),
new File(disallowEmptyMessage:'myMessage'),
];
}

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,7 +43,7 @@ class HostnameDummy
#[Hostname]
private $a;

#[Hostname(message:"myMessage", requireTld: false)]
#[Hostname(message:'myMessage', requireTld: false)]
private $b;

#[Hostname(groups: ['my_group'], payload: 'some attached data')]
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -162,7 +162,7 @@ public function testReservedDomainsRaiseViolationIfTldRequiredNamed()
{
$this->validator->validate(
'example',
new Hostname(message:"myMessage", requireTld: true)
new Hostname(message:'myMessage', requireTld: true)
);

$this->buildViolation('myMessage')
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -93,7 +93,7 @@ public function provideConstraintsWithNotFoundMessage(): iterable
'notFoundMessage' => 'myMessage',
])];
yield 'Named arguments' => [
new Image(notFoundMessage:"myMessage"),
new Image(notFoundMessage:'myMessage'),
];
}

Expand DownExpand Up@@ -132,7 +132,7 @@ public function provideMinWidthConstraints(): iterable
'minWidthMessage' => 'myMessage',
])];
yield 'Named arguments' => [
new Image(minWidth: 3, minWidthMessage:"myMessage"),
new Image(minWidth: 3, minWidthMessage:'myMessage'),
];
}

Expand All@@ -157,7 +157,7 @@ public function provideMaxWidthConstraints(): iterable
'maxWidthMessage' => 'myMessage',
])];
yield 'Named arguments' => [
new Image(maxWidth: 1, maxWidthMessage:"myMessage"),
new Image(maxWidth: 1, maxWidthMessage:'myMessage'),
];
}

Expand All@@ -182,7 +182,7 @@ public function provideMinHeightConstraints(): iterable
'minHeightMessage' => 'myMessage',
])];
yield 'Named arguments' => [
new Image(minHeight: 3, minHeightMessage:"myMessage"),
new Image(minHeight: 3, minHeightMessage:'myMessage'),
];
}

Expand All@@ -207,7 +207,7 @@ public function provideMaxHeightConstraints(): iterable
'maxHeightMessage' => 'myMessage',
])];
yield 'Named arguments' => [
new Image(maxHeight: 1, maxHeightMessage:"myMessage"),
new Image(maxHeight: 1, maxHeightMessage:'myMessage'),
];
}

Expand All@@ -234,7 +234,7 @@ public function provideMinPixelsConstraints(): iterable
'minPixelsMessage' => 'myMessage',
])];
yield 'Named arguments' => [
new Image(minPixels: 5, minPixelsMessage:"myMessage"),
new Image(minPixels: 5, minPixelsMessage:'myMessage'),
];
}

Expand All@@ -261,7 +261,7 @@ public function provideMaxPixelsConstraints(): iterable
'maxPixelsMessage' => 'myMessage',
])];
yield 'Named arguments' => [
new Image(maxPixels: 3, maxPixelsMessage:"myMessage"),
new Image(maxPixels: 3, maxPixelsMessage:'myMessage'),
];
}

Expand DownExpand Up@@ -346,7 +346,7 @@ public function provideMinRatioConstraints(): iterable
'minRatioMessage' => 'myMessage',
])];
yield 'Named arguments' => [
new Image(minRatio: 2, minRatioMessage:"myMessage"),
new Image(minRatio: 2, minRatioMessage:'myMessage'),
];
}

Expand All@@ -371,7 +371,7 @@ public function provideMaxRatioConstraints(): iterable
'maxRatioMessage' => 'myMessage',
])];
yield 'Named arguments' => [
new Image(maxRatio: 0.5, maxRatioMessage:"myMessage"),
new Image(maxRatio: 0.5, maxRatioMessage:'myMessage'),
];
}

Expand DownExpand Up@@ -427,7 +427,7 @@ public function provideAllowSquareConstraints(): iterable
'allowSquareMessage' => 'myMessage',
])];
yield 'Named arguments' => [
new Image(allowSquare: false, allowSquareMessage:"myMessage"),
new Image(allowSquare: false, allowSquareMessage:'myMessage'),
];
}

Expand All@@ -452,7 +452,7 @@ public function provideAllowLandscapeConstraints(): iterable
'allowLandscapeMessage' => 'myMessage',
])];
yield 'Named arguments' => [
new Image(allowLandscape: false, allowLandscapeMessage:"myMessage"),
new Image(allowLandscape: false, allowLandscapeMessage:'myMessage'),
];
}

Expand All@@ -477,7 +477,7 @@ public function provideAllowPortraitConstraints(): iterable
'allowPortraitMessage' => 'myMessage',
])];
yield 'Named arguments' => [
new Image(allowPortrait: false, allowPortraitMessage:"myMessage"),
new Image(allowPortrait: false, allowPortraitMessage:'myMessage'),
];
}

Expand DownExpand Up@@ -508,7 +508,7 @@ public function provideDetectCorruptedConstraints(): iterable
'corruptedMessage' => 'myMessage',
])];
yield 'Named arguments' => [
new Image(detectCorrupted: true, corruptedMessage:"myMessage"),
new Image(detectCorrupted: true, corruptedMessage:'myMessage'),
];
}
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -95,7 +95,7 @@ public function testValidIpV6WithWhitespacesNamed()
{
$this->validator->validate(
"\n\t2001:0db8:85a3:0000:0000:8a2e:0370:7334\r\n",
new Ip(version: \Symfony\Component\Validator\Constraints\Ip::V6, normalizer:"trim")
new Ip(version: \Symfony\Component\Validator\Constraints\Ip::V6, normalizer:'trim')
);

$this->assertNoViolation();
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -54,6 +54,6 @@ public function provideInvalidConstraints(): iterable
yield 'Doctrine style' => [new IsFalse([
'message' => 'myMessage',
])];
yield 'named parameters' => [new IsFalse(message:"myMessage")];
yield 'named parameters' => [new IsFalse(message:'myMessage')];
}
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -51,7 +51,7 @@ public function testInvalidValues($value, $valueAsString)
*/
public function testInvalidValuesNamed($value, $valueAsString)
{
$constraint = new IsNull(message:"myMessage");
$constraint = new IsNull(message:'myMessage');

$this->validator->validate($value, $constraint);

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -54,6 +54,6 @@ public function provideInvalidConstraints(): iterable
yield 'Doctrine style' => [new IsTrue([
'message' => 'myMessage',
])];
yield 'named parameters' => [new IsTrue(message:"myMessage")];
yield 'named parameters' => [new IsTrue(message:'myMessage')];
}
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -181,7 +181,7 @@ public function testInvalidIsbn10Named()
{
$this->validator->validate(
'978-2723442282',
new Isbn(type: Isbn::ISBN_10, isbn10Message:"myMessage")
new Isbn(type: Isbn::ISBN_10, isbn10Message:'myMessage')
);

$this->buildViolation('myMessage')
Expand DownExpand Up@@ -224,7 +224,7 @@ public function testInvalidIsbn13Named()
{
$this->validator->validate(
'2723442284',
new Isbn(type: Isbn::ISBN_13, isbn13Message:"myMessage")
new Isbn(type: Isbn::ISBN_13, isbn13Message:'myMessage')
);

$this->buildViolation('myMessage')
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -183,7 +183,7 @@ public function testNamedArguments()
{
$this->validator->validate(
'2162321x',
new Issn(message:"myMessage", caseSensitive: true, requireHyphen: true)
new Issn(message:'myMessage', caseSensitive: true, requireHyphen: true)
);

$this->buildViolation('myMessage')
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -156,7 +156,7 @@ public function testInvalidAlpha3LanguageNamed()
{
$this->validator->validate(
'DE',
new Language(alpha3: true, message:"myMessage")
new Language(alpha3: true, message:'myMessage')
);

$this->buildViolation('myMessage')
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -192,7 +192,7 @@ public function testInvalidValuesMin($value)
*/
public function testInvalidValuesMinNamed($value)
{
$constraint = new Length(min: 4, minMessage:"myMessage");
$constraint = new Length(min: 4, minMessage:'myMessage');

$this->validator->validate($value, $constraint);

Expand DownExpand Up@@ -231,7 +231,7 @@ public function testInvalidValuesMax($value)
*/
public function testInvalidValuesMaxNamed($value)
{
$constraint = new Length(max: 4, maxMessage:"myMessage");
$constraint = new Length(max: 4, maxMessage:'myMessage');

$this->validator->validate($value, $constraint);

Expand DownExpand Up@@ -271,7 +271,7 @@ public function testInvalidValuesExactLessThanFour($value)
*/
public function testInvalidValuesExactLessThanFourNamed($value)
{
$constraint = new Length(exactly: 4, exactMessage:"myMessage");
$constraint = new Length(exactly: 4, exactMessage:'myMessage');

$this->validator->validate($value, $constraint);

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -142,7 +142,7 @@ public function testInvalidLocaleWithoutCanonicalizationNamed()
{
$this->validator->validate(
'en-US',
new Locale(message:"myMessage", canonicalize: false)
new Locale(message:'myMessage', canonicalize: false)
);

$this->buildViolation('myMessage')
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,6 +60,6 @@ public function provideInvalidConstraints(): iterable
yield 'Doctrine style' => [new NotNull([
'message' => 'myMessage',
])];
yield 'named parameters' => [new NotNull(message:"myMessage")];
yield 'named parameters' => [new NotNull(message:'myMessage')];
}
}
Loading

[8]ページ先頭

©2009-2025 Movatter.jp