Skip to content

Commit 16aedb3

Browse files
committed
upgraded php-cs-fixer
1 parent e519626 commit 16aedb3

9 files changed

Lines changed: 43 additions & 29 deletions

File tree

File renamed without changes.

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"phpunit/phpunit": "^8.0",
2626
"squizlabs/php_codesniffer": "^3.0",
2727
"brick/varexporter": "^0.2.1",
28-
"friendsofphp/php-cs-fixer": "^2.15",
29-
"oscarotero/php-cs-fixer-config": "^1.0"
28+
"friendsofphp/php-cs-fixer": "^3.2",
29+
"oscarotero/php-cs-fixer-config": "^2.0"
3030
},
3131
"autoload": {
3232
"psr-4": {

src/Headers.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
*/
1515
class Headers implements JsonSerializable, Countable, IteratorAggregate
1616
{
17-
const HEADER_LANGUAGE = 'Language';
18-
const HEADER_PLURAL = 'Plural-Forms';
19-
const HEADER_DOMAIN = 'X-Domain';
17+
public const HEADER_LANGUAGE = 'Language';
18+
public const HEADER_PLURAL = 'Plural-Forms';
19+
public const HEADER_DOMAIN = 'X-Domain';
2020

2121
protected $headers = [];
2222

src/Loader/Loader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected function createTranslation(?string $context, string $original, string
4646
protected static function readFile(string $file): string
4747
{
4848
$content = @file_get_contents($file);
49-
49+
5050
if (false === $content) {
5151
throw new Exception("Cannot read the file '$file', probably permissions");
5252
}

src/Merge.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@
88
*/
99
final class Merge
1010
{
11-
const TRANSLATIONS_OURS = 1 << 0;
12-
const TRANSLATIONS_THEIRS = 1 << 1;
13-
const TRANSLATIONS_OVERRIDE = 1 << 2;
11+
public const TRANSLATIONS_OURS = 1 << 0;
12+
public const TRANSLATIONS_THEIRS = 1 << 1;
13+
public const TRANSLATIONS_OVERRIDE = 1 << 2;
1414

15-
const HEADERS_OURS = 1 << 3;
16-
const HEADERS_THEIRS = 1 << 4;
17-
const HEADERS_OVERRIDE = 1 << 5;
15+
public const HEADERS_OURS = 1 << 3;
16+
public const HEADERS_THEIRS = 1 << 4;
17+
public const HEADERS_OVERRIDE = 1 << 5;
1818

19-
const COMMENTS_OURS = 1 << 6;
20-
const COMMENTS_THEIRS = 1 << 7;
19+
public const COMMENTS_OURS = 1 << 6;
20+
public const COMMENTS_THEIRS = 1 << 7;
2121

22-
const EXTRACTED_COMMENTS_OURS = 1 << 8;
23-
const EXTRACTED_COMMENTS_THEIRS = 1 << 9;
22+
public const EXTRACTED_COMMENTS_OURS = 1 << 8;
23+
public const EXTRACTED_COMMENTS_THEIRS = 1 << 9;
2424

25-
const FLAGS_OURS = 1 << 10;
26-
const FLAGS_THEIRS = 1 << 11;
25+
public const FLAGS_OURS = 1 << 10;
26+
public const FLAGS_THEIRS = 1 << 11;
2727

28-
const REFERENCES_OURS = 1 << 12;
29-
const REFERENCES_THEIRS = 1 << 13;
28+
public const REFERENCES_OURS = 1 << 12;
29+
public const REFERENCES_THEIRS = 1 << 13;
3030

3131
//Merge strategies
32-
const SCAN_AND_LOAD =
32+
public const SCAN_AND_LOAD =
3333
Merge::HEADERS_OVERRIDE
3434
| Merge::TRANSLATIONS_OURS
3535
| Merge::TRANSLATIONS_OVERRIDE

src/Scanner/FunctionsHandlersTrait.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ protected function gettext(ParsedFunction $function): ?Translation
2121
$function,
2222
$this->saveTranslation(null, null, $original)
2323
);
24+
2425
return $this->addFlags($function, $translation);
2526
}
2627

@@ -35,6 +36,7 @@ protected function ngettext(ParsedFunction $function): ?Translation
3536
$function,
3637
$this->saveTranslation(null, null, $original, $plural)
3738
);
39+
3840
return $this->addFlags($function, $translation);
3941
}
4042

@@ -49,6 +51,7 @@ protected function pgettext(ParsedFunction $function): ?Translation
4951
$function,
5052
$this->saveTranslation(null, $context, $original)
5153
);
54+
5255
return $this->addFlags($function, $translation);
5356
}
5457

@@ -63,6 +66,7 @@ protected function dgettext(ParsedFunction $function): ?Translation
6366
$function,
6467
$this->saveTranslation($domain, null, $original)
6568
);
69+
6670
return $this->addFlags($function, $translation);
6771
}
6872

@@ -77,6 +81,7 @@ protected function dpgettext(ParsedFunction $function): ?Translation
7781
$function,
7882
$this->saveTranslation($domain, $context, $original)
7983
);
84+
8085
return $this->addFlags($function, $translation);
8186
}
8287

@@ -91,6 +96,7 @@ protected function npgettext(ParsedFunction $function): ?Translation
9196
$function,
9297
$this->saveTranslation(null, $context, $original, $plural)
9398
);
99+
94100
return $this->addFlags($function, $translation);
95101
}
96102

@@ -105,6 +111,7 @@ protected function dngettext(ParsedFunction $function): ?Translation
105111
$function,
106112
$this->saveTranslation($domain, null, $original, $plural)
107113
);
114+
108115
return $this->addFlags($function, $translation);
109116
}
110117

@@ -119,6 +126,7 @@ protected function dnpgettext(ParsedFunction $function): ?Translation
119126
$function,
120127
$this->saveTranslation($domain, $context, $original, $plural)
121128
);
129+
122130
return $this->addFlags($function, $translation);
123131
}
124132

src/Scanner/Scanner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected static function readFile(string $file): string
8282
if (false === $content) {
8383
throw new Exception("Cannot read the file '$file', probably permissions");
8484
}
85-
85+
8686
return $content;
8787
}
8888
}

tests/PoGeneratorTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public function testPoLoader()
1515
$generator = new PoGenerator();
1616
$translations = Translations::create('my-domain');
1717
$translations->getFlags()->add('fuzzy');
18-
$translations->setDescription(<<<'EOT'
18+
$translations->setDescription(
19+
<<<'EOT'
1920
SOME DESCRIPTIVE TITLE
2021
Copyright (C) YEAR Free Software Foundation, Inc.
2122
This file is distributed under the same license as the PACKAGE package.

tests/PoLoaderTest.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ public function testPoLoader()
1515
$translations = $loader->loadFile(__DIR__.'/assets/translations.po');
1616

1717
$description = $translations->getDescription();
18-
$this->assertSame(<<<'EOT'
18+
$this->assertSame(
19+
<<<'EOT'
1920
SOME DESCRIPTIVE TITLE
2021
Copyright (C) YEAR Free Software Foundation, Inc.
2122
This file is distributed under the same license as the PACKAGE package.
2223
FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
2324
EOT
2425
,
25-
$description);
26+
$description
27+
);
2628

2729
$this->assertSame(['fuzzy'], $translations->getFlags()->toArray());
2830

@@ -150,7 +152,8 @@ private function translation8(Translation $translation)
150152
$this->assertSame('Polje tipa: %ss', $translation->getTranslation());
151153
$this->assertCount(0, $translation->getPluralTranslations());
152154
$this->assertCount(2, $translation->getReferences());
153-
$this->assertSame([
155+
$this->assertSame(
156+
[
154157
'attributes/address/composer.php' => [8],
155158
'attributes/address/form.php' => [7],
156159
],
@@ -177,7 +180,8 @@ private function translation10(Translation $translation)
177180
$this->assertCount(0, $translation->getPluralTranslations());
178181
$this->assertCount(0, $translation->getComments());
179182
$this->assertCount(3, $translation->getReferences());
180-
$this->assertSame([
183+
$this->assertSame(
184+
[
181185
'/var/www/test/test.php' => [96, 97],
182186
'/var/www/test/test2.php' => [98],
183187
],
@@ -259,8 +263,9 @@ public function testStringDecode($source, $decoded)
259263
$this->assertSame($decoded, PoLoader::decode($source));
260264
}
261265

262-
public function testMultilineDisabledTranslations() {
263-
$po = <<<EOT
266+
public function testMultilineDisabledTranslations()
267+
{
268+
$po = <<<'EOT'
264269
#~ msgid "Last agent hours-description"
265270
#~ msgstr ""
266271
#~ "How many hours in the past can system look at finding the last agent? "

0 commit comments

Comments
 (0)