Skip to content

Commit 44157e5

Browse files
authored
Configure compact brace position PHPCSFixer (#277)
1 parent fd9edb6 commit 44157e5

File tree

133 files changed

+632
-1262
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+632
-1262
lines changed

.php-cs-fixer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
'phpdoc_separation' => ['groups' => [['deprecated', 'internal'], ['standard', 'source'], ['covers', 'coversDefaultClass'], ['template', 'implements', 'extends', 'param', 'throws', 'return']]],
2121
'phpdoc_trim' => true,
2222
'concat_space' => ['spacing' => 'one'],
23+
'braces_position' => ['classes_opening_brace' => 'same_line', 'control_structures_opening_brace' => 'same_line', 'functions_opening_brace' => 'same_line'],
2324
]
2425
)->setFinder(
2526
PhpCsFixer\Finder::create()

dev/DataSource/Mapping/CountryMapping.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@
3434
* @template TDataSet of object{name: string, name_french: string, alpha2: string, alpha3: string, numeric: string, subdivisions: array<string, object{category: string, code: string, same_as_country: ?CountryAlpha2, parent: ?string, names: non-empty-list<object{name: string, note: ?string, languages: list<CountryAlpha2>, romanization_system: ?string, local_variant: ?string}&stdClass>}&stdClass>}&stdClass
3535
* @implements Mapping<TDataSet>
3636
*/
37-
class CountryMapping implements Mapping
38-
{
39-
public static function url(): string
40-
{
37+
class CountryMapping implements Mapping {
38+
public static function url(): string {
4139
return 'https://www.iso.org/obp/ui/#search/code/';
4240
}
4341

@@ -49,8 +47,7 @@ public static function url(): string
4947
* @throws TypeError
5048
* @return list<TDataSet>
5149
*/
52-
public static function toDataSet(Client $client, Crawler $crawler): array
53-
{
50+
public static function toDataSet(Client $client, Crawler $crawler): array {
5451
$client->waitFor('#onetrust-accept-btn-handler');
5552
$cookieButton = $crawler->filterXPath(".//button[@id='onetrust-accept-btn-handler']");
5653
$cookieButton->click();
@@ -162,8 +159,7 @@ public static function toDataSet(Client $client, Crawler $crawler): array
162159
* @throws ShouldNotHappenException
163160
* @return array<SpecFile>
164161
*/
165-
public static function toEnumMapping(array $dataSet): array
166-
{
162+
public static function toEnumMapping(array $dataSet): array {
167163
$countryName = new SpecFile(CountryName::class, KeySorting::class);
168164
$countryAlpha2 = (new SpecFile(CountryAlpha2::class, KeySorting::class))
169165
->addMethod($getSubdivisionsMethod = new EnumMappingMethod('getSubdivisions', 'array', '[]', '/** @return list<CountrySubdivision> */'));
@@ -205,8 +201,7 @@ public static function toEnumMapping(array $dataSet): array
205201
}
206202

207203
/** @return array{0: string, 1: ?string} */
208-
private static function getNameNote(string $text): array
209-
{
204+
private static function getNameNote(string $text): array {
210205
if (($notePos = strpos($text, '(see also')) !== false) {
211206
return [rtrim(substr($text, 0, $notePos), ' '), ltrim(rtrim(substr($text, $notePos - 1), ')'), '(')];
212207
}

dev/DataSource/Mapping/CurrencyMapping.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,16 @@
3333
* @template TDataSet of object{CtryNm: string, CcyNm: string, Ccy: string|null, CcyNbr: string|null, CcyMnrUnts: string|null}&stdClass
3434
* @implements Mapping<TDataSet>
3535
*/
36-
class CurrencyMapping implements Mapping
37-
{
38-
public static function url(): string
39-
{
36+
class CurrencyMapping implements Mapping {
37+
public static function url(): string {
4038
return 'https://www.six-group.com/en/products-services/financial-information/data-standards.html';
4139
}
4240

4341
/**
4442
* @throws DomElementNotFoundException|RuntimeException
4543
* @return list<TDataSet>
4644
*/
47-
public static function toDataSet(Client $client, Crawler $crawler): array
48-
{
45+
public static function toDataSet(Client $client, Crawler $crawler): array {
4946
$listLink = $crawler->filterXPath("//a[contains(@href, 'list-one.xml')]");
5047
$listUrl = $listLink->first()->getAttribute('href');
5148
if ($listUrl === null || ($specContent = file_get_contents($listUrl)) === false) {
@@ -92,8 +89,7 @@ public static function toDataSet(Client $client, Crawler $crawler): array
9289
* @throws TransliterationException
9390
* @return array<SpecFile>
9491
*/
95-
public static function toEnumMapping(array $dataSet): array
96-
{
92+
public static function toEnumMapping(array $dataSet): array {
9793
$currencyNameEnum = new SpecFile(CurrencyName::class, KeySorting::class);
9894
$currencyNumericEnum = new SpecFile(CurrencyNumeric::class, KeySorting::class);
9995
$currencyAlpha3Enum = (new SpecFile(CurrencyAlpha3::class, KeySorting::class))

dev/DataSource/Mapping/EUMapping.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,13 @@
2020
* @template TDataSet of object{name: string}&stdClass
2121
* @implements Mapping<TDataSet>
2222
*/
23-
class EUMapping implements Mapping
24-
{
25-
public static function url(): string
26-
{
23+
class EUMapping implements Mapping {
24+
public static function url(): string {
2725
return 'https://european-union.europa.eu/principles-countries-history/eu-countries_en';
2826
}
2927

3028
/** @throws NoSuchElementException|TimeoutException */
31-
public static function toDataSet(Client $client, Crawler $crawler): array
32-
{
29+
public static function toDataSet(Client $client, Crawler $crawler): array {
3330
$client->waitFor('//a[contains(@class, "wt-ecl-button")]');
3431
$crawler->filterXPath('//a[contains(@class, "wt-ecl-button")]')->click();
3532

@@ -58,8 +55,7 @@ public static function toDataSet(Client $client, Crawler $crawler): array
5855
}
5956

6057
/** @throws NameNotFoundException|InvalidArgumentException */
61-
public static function toEnumMapping(array $dataSet): array
62-
{
58+
public static function toEnumMapping(array $dataSet): array {
6359
$EU = (new SpecFile(EU::class, KeySorting::class))
6460
->addMethod($allAlpha2 = new EnumListMethod('allAlpha2', 'array', '/** @return list<CountryAlpha2> */'));
6561

dev/DataSource/Mapping/HttpMethodMapping.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,16 @@
1717
* @template TDataSet of object{alpha3: string, alpha2: string, name: string, name_french: string, name_german: string}&stdClass
1818
* @implements Mapping<TDataSet>
1919
*/
20-
class HttpMethodMapping implements Mapping
21-
{
22-
public static function url(): string
23-
{
20+
class HttpMethodMapping implements Mapping {
21+
public static function url(): string {
2422
return 'https://www.iana.org/assignments/http-methods/http-methods.xhtml';
2523
}
2624

2725
/**
2826
* @throws RuntimeException
2927
* @return list<TDataSet>
3028
*/
31-
public static function toDataSet(Client $client, Crawler $crawler): array
32-
{
29+
public static function toDataSet(Client $client, Crawler $crawler): array {
3330
$items = $crawler->filterXPath('//table[@id="table-methods"]/tbody/tr')->getIterator();
3431

3532
$dataSet = [];
@@ -59,8 +56,7 @@ public static function toDataSet(Client $client, Crawler $crawler): array
5956
* @param list<TDataSet> $dataSet
6057
* @return array<SpecFile>
6158
*/
62-
public static function toEnumMapping(array $dataSet): array
63-
{
59+
public static function toEnumMapping(array $dataSet): array {
6460
$httpMethod = new SpecFile(HttpMethod::class, KeySorting::class);
6561
foreach ($dataSet as $dataRow) {
6662
if ($dataRow->name === '*') {

dev/DataSource/Mapping/HttpStatusCodeMapping.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,16 @@
2222
* @template TDataSet of object{value: string, description: string, reference: string, note: ?string}&stdClass
2323
* @implements Mapping<TDataSet>
2424
*/
25-
class HttpStatusCodeMapping implements Mapping
26-
{
27-
public static function url(): string
28-
{
25+
class HttpStatusCodeMapping implements Mapping {
26+
public static function url(): string {
2927
return 'https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml';
3028
}
3129

3230
/**
3331
* @throws RuntimeException
3432
* @return list<TDataSet>
3533
*/
36-
public static function toDataSet(Client $client, Crawler $crawler): array
37-
{
34+
public static function toDataSet(Client $client, Crawler $crawler): array {
3835
$items = $crawler->filterXPath('//table[@id="table-http-status-codes-1"]/tbody/tr')->getIterator();
3936

4037
$dataSet = [];
@@ -67,8 +64,7 @@ public static function toDataSet(Client $client, Crawler $crawler): array
6764
* @throws Exception
6865
* @return array<SpecFile>
6966
*/
70-
public static function toEnumMapping(array $dataSet): array
71-
{
67+
public static function toEnumMapping(array $dataSet): array {
7268
$httpMethod = new SpecFile(HttpStatusCode::class, ValueSorting::class);
7369
foreach ($dataSet as $dataRow) {
7470
if (in_array($dataRow->description, ['Unassigned', '(Unused)'], true)) {

dev/DataSource/Mapping/LanguageExtensiveMapping.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,13 @@
1616
* @template TDataSet of object{Id: string, Part2B: string, Part2T: string, Part1: string, Scope: string, LanguageType: string, RefName: string, Comment: string}&stdClass
1717
* @implements Mapping<TDataSet>
1818
*/
19-
class LanguageExtensiveMapping implements Mapping
20-
{
21-
public static function url(): string
22-
{
19+
class LanguageExtensiveMapping implements Mapping {
20+
public static function url(): string {
2321
return 'https://iso639-3.sil.org/sites/iso639-3/files/downloads/iso-639-3_Latin1.tab';
2422
}
2523

2624
/** @throws DomElementNotFoundException */
27-
public static function toDataSet(Client $client, Crawler $crawler): array
28-
{
25+
public static function toDataSet(Client $client, Crawler $crawler): array {
2926
$dataSet = [];
3027
foreach (explode("\n", $client->getPageSource()) as $lineNumber => $line) {
3128
if ($lineNumber === 0 || $line === '</pre></body></html>') {
@@ -51,8 +48,7 @@ public static function toDataSet(Client $client, Crawler $crawler): array
5148
return $dataSet;
5249
}
5350

54-
public static function toEnumMapping(array $dataSet): array
55-
{
51+
public static function toEnumMapping(array $dataSet): array {
5652
$languageExtensive = new SpecFile(LanguageAlpha3Extensive::class, ValueSorting::class);
5753
foreach ($dataSet as $dataItem) {
5854
if (in_array($dataItem->RefName, ['Fa D\'ambu', 'C\'lela'], true)) {

dev/DataSource/Mapping/LanguageMapping.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,21 @@
2020
* @template TDataSet of object{alpha3: string, alpha2: string, name: string, name_french: string, name_german: string}&stdClass
2121
* @implements Mapping<TDataSet>
2222
*/
23-
class LanguageMapping implements Mapping
24-
{
23+
class LanguageMapping implements Mapping {
2524
/** @var array<string, string> where key is the new name and value is the previous name */
2625
private const RENAMES = [
2726
'Tlicho; Dogrib' => 'Tlicho, Dogrib',
2827
];
2928

30-
public static function url(): string
31-
{
29+
public static function url(): string {
3230
return 'https://www.loc.gov/standards/iso639-2/php/code_list.php';
3331
}
3432

3533
/**
3634
* @throws RuntimeException
3735
* @return list<TDataSet>
3836
*/
39-
public static function toDataSet(Client $client, Crawler $crawler): array
40-
{
37+
public static function toDataSet(Client $client, Crawler $crawler): array {
4138
$items = $crawler->filterXPath('//table[@width="100%"]/tbody/tr')->getIterator();
4239

4340
$dataSet = [];
@@ -77,8 +74,7 @@ public static function toDataSet(Client $client, Crawler $crawler): array
7774
* @param list<TDataSet> $dataSet
7875
* @return array<SpecFile>
7976
*/
80-
public static function toEnumMapping(array $dataSet): array
81-
{
77+
public static function toEnumMapping(array $dataSet): array {
8278
$languageAlpha2 = new SpecFile(LanguageAlpha2::class, KeySorting::class);
8379
$languageName = new SpecFile(LanguageName::class, KeySorting::class);
8480
$languageAlpha3Bibliographic = new SpecFile(LanguageAlpha3Bibliographic::class, KeySorting::class);

dev/DataSource/Mapping/LanguageSubTagMapping.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,16 @@
1616
* @template TDataSet of object{Type: string, Subtag: string, Description: string, Added: string, SuppressScript: string, Scope: string, Macrolanguage: string, Comments: string, Deprecated: string, PreferredValue: string, Prefix: string, Tag: string}&stdClass
1717
* @implements Mapping<TDataSet>
1818
*/
19-
class LanguageSubTagMapping implements Mapping
20-
{
21-
public static function url(): string
22-
{
19+
class LanguageSubTagMapping implements Mapping {
20+
public static function url(): string {
2321
return 'https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry';
2422
}
2523

2624
/**
2725
* @throws InvalidArgumentException
2826
* @return list<TDataSet>
2927
*/
30-
public static function toDataSet(Client $client, Crawler $crawler): array
31-
{
28+
public static function toDataSet(Client $client, Crawler $crawler): array {
3229
$dataSet = [];
3330
foreach (explode('%%', $client->getPageSource()) as $i => $item) {
3431
if ($i === 0) {
@@ -71,8 +68,7 @@ public static function toDataSet(Client $client, Crawler $crawler): array
7168
* @param list<TDataSet> $dataSet
7269
* @return array<SpecFile>
7370
*/
74-
public static function toEnumMapping(array $dataSet): array
75-
{
71+
public static function toEnumMapping(array $dataSet): array {
7672
$languageTagVariant = new SpecFile(LanguageTagVariant::class, KeySorting::class);
7773
foreach ($dataSet as $dataRow) {
7874
/** @var TDataSet $dataRow */

dev/DataSource/Mapping/Mapping.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
/**
1111
* @template TDataSet
1212
*/
13-
interface Mapping
14-
{
13+
interface Mapping {
1514
public static function url(): string;
1615

1716
/** @return list<TDataSet> */

dev/DataSource/Mapping/PHPRegexSupportedScriptsMapping.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,12 @@
1717
* @template TDataSet of object{name: string}&stdClass
1818
* @implements Mapping<TDataSet>
1919
*/
20-
class PHPRegexSupportedScriptsMapping implements Mapping
21-
{
22-
public static function url(): string
23-
{
20+
class PHPRegexSupportedScriptsMapping implements Mapping {
21+
public static function url(): string {
2422
return 'https://www.php.net/manual/en/regexp.reference.unicode.php';
2523
}
2624

27-
public static function toDataSet(Client $client, Crawler $crawler): array
28-
{
25+
public static function toDataSet(Client $client, Crawler $crawler): array {
2926
$items = $crawler->filterXPath('//table[@class="doctable table"]/tbody/tr/td/code')->getIterator();
3027

3128
$dataSet = [];
@@ -44,8 +41,7 @@ public static function toDataSet(Client $client, Crawler $crawler): array
4441
* @param list<TDataSet> $dataSet
4542
* @return array<SpecFile>
4643
*/
47-
public static function toEnumMapping(array $dataSet): array
48-
{
44+
public static function toEnumMapping(array $dataSet): array {
4945
$scriptAliasStrings = array_map(static function (object $dataSetItem) {
5046
return $dataSetItem->name;
5147
}, $dataSet);

dev/DataSource/Mapping/ScriptMapping.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,16 @@
2525
* @template TDataSet of object{code: string, number: string, name: string, french_name: string, alias: string, age: string, date: string}&stdClass
2626
* @implements Mapping<TDataSet>
2727
*/
28-
class ScriptMapping implements Mapping
29-
{
30-
public static function url(): string
31-
{
28+
class ScriptMapping implements Mapping {
29+
public static function url(): string {
3230
return 'https://www.unicode.org/iso15924/iso15924-codes.html';
3331
}
3432

3533
/**
3634
* @throws RuntimeException
3735
* @return list<TDataSet>
3836
*/
39-
public static function toDataSet(Client $client, Crawler $crawler): array
40-
{
37+
public static function toDataSet(Client $client, Crawler $crawler): array {
4138
$items = $crawler->filterXPath('//table[@class="simple"]/tbody/tr')->getIterator();
4239

4340
$dataSet = [];
@@ -79,8 +76,7 @@ public static function toDataSet(Client $client, Crawler $crawler): array
7976
* @throws TypeError
8077
* @return array<SpecFile>
8178
*/
82-
public static function toEnumMapping(array $dataSet): array
83-
{
79+
public static function toEnumMapping(array $dataSet): array {
8480
$scriptCode = new SpecFile(ScriptCode::class, KeySorting::class);
8581
$scriptName = new SpecFile(ScriptName::class, KeySorting::class);
8682
$scriptNumber = new SpecFile(ScriptNumber::class, KeySorting::class);

dev/DataSource/Mapping/TopLevelDomainMapping.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,16 @@
2727
* @template TDataSet of object{tld: string, type: string, manager: string}&stdClass
2828
* @implements Mapping<TDataSet>
2929
*/
30-
class TopLevelDomainMapping implements Mapping
31-
{
32-
public static function url(): string
33-
{
30+
class TopLevelDomainMapping implements Mapping {
31+
public static function url(): string {
3432
return 'https://www.iana.org/domains/root/db';
3533
}
3634

3735
/**
3836
* @throws RuntimeException
3937
* @return list<TDataSet>
4038
*/
41-
public static function toDataSet(Client $client, Crawler $crawler): array
42-
{
39+
public static function toDataSet(Client $client, Crawler $crawler): array {
4340
$items = $crawler->filterXPath('//table[@id="tld-table"]/tbody/tr')->getIterator();
4441

4542
$dataSet = [];
@@ -68,8 +65,7 @@ public static function toDataSet(Client $client, Crawler $crawler): array
6865
*@throws InvalidArgumentException
6966
* @return array<SpecFile>
7067
*/
71-
public static function toEnumMapping(array $dataSet): array
72-
{
68+
public static function toEnumMapping(array $dataSet): array {
7369
$countryCodeTLD = (new SpecFile(CountryCodeTLD::class, KeySorting::class))
7470
->addMethod($toCountryAlpha2 = new EnumMappingMethod('getCountryAlpha2', '?CountryAlpha2', 'null'));
7571
$genericRestrictedTLD = new SpecFile(GenericRestrictedTLD::class, KeySorting::class);

0 commit comments

Comments
 (0)