Skip to content

Commit 4362f6e

Browse files
minor symfony#48709 Use static methods inside data providers (OskarStark)
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- Use static methods inside data providers | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | n/a | License | MIT | Doc PR | n/a refs symfony#48668 follows * symfony#48625 Commits ------- 9a18048 Use static methods inside data providers
2 parents 2aedd16 + 9a18048 commit 4362f6e

File tree

11 files changed

+28
-28
lines changed

11 files changed

+28
-28
lines changed

src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testIsFresh(callable $mockContainer, $expected)
5151
$this->assertSame($expected, $this->resourceChecker->isFresh($this->resource, time()));
5252
}
5353

54-
public function isFreshProvider()
54+
public static function isFreshProvider()
5555
{
5656
yield 'not fresh on missing parameter' => [function (MockObject $container) {
5757
$container->method('hasParameter')->with('locales')->willReturn(false);
@@ -62,11 +62,11 @@ public function isFreshProvider()
6262
}, false];
6363

6464
yield 'fresh on every identical parameters' => [function (MockObject $container) {
65-
$container->expects($this->exactly(2))->method('hasParameter')->willReturn(true);
66-
$container->expects($this->exactly(2))->method('getParameter')
65+
$container->expects(self::exactly(2))->method('hasParameter')->willReturn(true);
66+
$container->expects(self::exactly(2))->method('getParameter')
6767
->withConsecutive(
68-
[$this->equalTo('locales')],
69-
[$this->equalTo('default_locale')]
68+
[self::equalTo('locales')],
69+
[self::equalTo('default_locale')]
7070
)
7171
->willReturnMap([
7272
['locales', ['fr', 'en']],

src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ abstract class AbstractCrawlerTest extends TestCase
2222
{
2323
use ExpectDeprecationTrait;
2424

25-
abstract public function getDoctype(): string;
25+
abstract public static function getDoctype(): string;
2626

2727
protected function createCrawler($node = null, string $uri = null, string $baseHref = null)
2828
{

src/Symfony/Component/DomCrawler/Tests/Html5ParserCrawlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
class Html5ParserCrawlerTest extends AbstractCrawlerTest
1515
{
16-
public function getDoctype(): string
16+
public static function getDoctype(): string
1717
{
1818
return '<!DOCTYPE html>';
1919
}

src/Symfony/Component/DomCrawler/Tests/NativeParserCrawlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
class NativeParserCrawlerTest extends AbstractCrawlerTest
1515
{
16-
public function getDoctype(): string
16+
public static function getDoctype(): string
1717
{
1818
return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
1919
}

src/Symfony/Component/Finder/Tests/GitignoreTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function testToRegex(array $gitignoreLines, array $matchingCases, array $
5555
}
5656
}
5757

58-
public function provider(): array
58+
public static function provider(): array
5959
{
6060
$cases = [
6161
[
@@ -394,7 +394,7 @@ public function provider(): array
394394

395395
public function providerExtended(): array
396396
{
397-
$basicCases = $this->provider();
397+
$basicCases = self::provider();
398398

399399
$cases = [];
400400
foreach ($basicCases as $case) {

src/Symfony/Component/Finder/Tests/Iterator/SizeRangeFilterIteratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function getAcceptData()
4141
];
4242

4343
return [
44-
[[new NumberComparator('< 1K'), new NumberComparator('> 0.5K')], $this->toAbsolute($lessThan1KGreaterThan05K)],
44+
[[new NumberComparator('< 1K'), new NumberComparator('> 0.5K')], self::toAbsolute($lessThan1KGreaterThan05K)],
4545
];
4646
}
4747
}

src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function getNormalizedIniPostMaxSize(): string
6565
$this->request = null;
6666
}
6767

68-
public function methodExceptGetProvider()
68+
public static function methodExceptGetProvider()
6969
{
7070
return [
7171
['POST'],
@@ -79,7 +79,7 @@ public function methodProvider()
7979
{
8080
return array_merge([
8181
['GET'],
82-
], $this->methodExceptGetProvider());
82+
], self::methodExceptGetProvider());
8383
}
8484

8585
/**

src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public function provideCompletionSuggestions(): iterable
215215

216216
yield 'form_type' => [
217217
[''],
218-
$this->getCoreTypes(),
218+
self::getCoreTypes(),
219219
];
220220

221221
yield 'option for FQCN' => [
@@ -267,7 +267,7 @@ public function provideCompletionSuggestions(): iterable
267267
];
268268
}
269269

270-
private function getCoreTypes(): array
270+
private static function getCoreTypes(): array
271271
{
272272
$coreExtension = new CoreExtension();
273273
$loadTypesRefMethod = (new \ReflectionObject($coreExtension))->getMethod('loadTypes');

src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,31 +285,31 @@ public function privateTaggedServicesProvider()
285285
function (ContainerBuilder $container) {
286286
$formTypes = $container->getDefinition('form.extension')->getArgument(0);
287287

288-
$this->assertInstanceOf(Reference::class, $formTypes);
288+
self::assertInstanceOf(Reference::class, $formTypes);
289289

290290
$locator = $container->getDefinition((string) $formTypes);
291291
$expectedLocatorMap = [
292292
'stdClass' => new ServiceClosureArgument(new Reference('my.type')),
293293
];
294294

295-
$this->assertInstanceOf(Definition::class, $locator);
296-
$this->assertEquals($expectedLocatorMap, $locator->getArgument(0));
295+
self::assertInstanceOf(Definition::class, $locator);
296+
self::assertEquals($expectedLocatorMap, $locator->getArgument(0));
297297
},
298298
],
299299
[
300300
'my.type_extension',
301301
Type1TypeExtension::class,
302302
'form.type_extension',
303303
function (ContainerBuilder $container) {
304-
$this->assertEquals(
304+
self::assertEquals(
305305
['Symfony\Component\Form\Extension\Core\Type\FormType' => new IteratorArgument([new Reference('my.type_extension')])],
306306
$container->getDefinition('form.extension')->getArgument(1)
307307
);
308308
},
309309
['extended_type' => 'Symfony\Component\Form\Extension\Core\Type\FormType'],
310310
],
311311
['my.guesser', 'stdClass', 'form.type_guesser', function (ContainerBuilder $container) {
312-
$this->assertEquals(new IteratorArgument([new Reference('my.guesser')]), $container->getDefinition('form.extension')->getArgument(2));
312+
self::assertEquals(new IteratorArgument([new Reference('my.guesser')]), $container->getDefinition('form.extension')->getArgument(2));
313313
}],
314314
];
315315
}

src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function tearDown(): void
3737
$this->dateTimeWithoutSeconds = null;
3838
}
3939

40-
public function allProvider()
40+
public static function allProvider()
4141
{
4242
return [
4343
['UTC', 'UTC', '2010-02-03 04:05:06 UTC', '2010-02-03T04:05:06Z'],
@@ -51,12 +51,12 @@ public function allProvider()
5151

5252
public function transformProvider()
5353
{
54-
return $this->allProvider();
54+
return self::allProvider();
5555
}
5656

5757
public function reverseTransformProvider()
5858
{
59-
return array_merge($this->allProvider(), [
59+
return array_merge(self::allProvider(), [
6060
// format without seconds, as appears in some browsers
6161
['UTC', 'UTC', '2010-02-03 04:05:00 UTC', '2010-02-03T04:05Z'],
6262
['America/New_York', 'Asia/Hong_Kong', '2010-02-03 04:05:00 America/New_York', '2010-02-03T17:05+08:00'],

0 commit comments

Comments
 (0)