Skip to content

Commit f5d9264

Browse files
SpacePossumnicolas-grekas
authored andcommitted
[CS][2.7] yoda_style, no_unneeded_curly_braces, no_unneeded_final_method, semicolon_after_instruction
1 parent c0b0a31 commit f5d9264

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

Data/Bundle/Compiler/GenrbCompiler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function compile($sourcePath, $targetDir)
6161

6262
exec($this->genrb.' --quiet -e UTF-8 -d '.$targetDir.' '.$sourcePath, $output, $status);
6363

64-
if ($status !== 0) {
64+
if (0 !== $status) {
6565
throw new RuntimeException(sprintf(
6666
'genrb failed with status %d while compiling %s to %s.',
6767
$status,

DateFormatter/DateFormat/TimeZoneTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public static function getEtcTimeZoneId($formattedTimeZone)
101101
if (preg_match('/GMT(?P<signal>[+-])(?P<hours>\d{2}):?(?P<minutes>\d{2})/', $formattedTimeZone, $matches)) {
102102
$hours = (int) $matches['hours'];
103103
$minutes = (int) $matches['minutes'];
104-
$signal = $matches['signal'] == '-' ? '+' : '-';
104+
$signal = '-' == $matches['signal'] ? '+' : '-';
105105

106106
if (0 < $minutes) {
107107
throw new NotImplementedException(sprintf(
@@ -110,7 +110,7 @@ public static function getEtcTimeZoneId($formattedTimeZone)
110110
));
111111
}
112112

113-
return 'Etc/GMT'.($hours !== 0 ? $signal.$hours : '');
113+
return 'Etc/GMT'.(0 !== $hours ? $signal.$hours : '');
114114
}
115115

116116
throw new \InvalidArgumentException(sprintf('The GMT time zone "%s" does not match with the supported formats GMT[+-]HH:MM or GMT[+-]HHMM.', $formattedTimeZone));

Exception/MethodArgumentValueNotImplementedException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct($methodName, $argName, $argValue, $additionalMessage
3131
$methodName,
3232
$argName,
3333
var_export($argValue, true),
34-
$additionalMessage !== '' ? ' '.$additionalMessage.'. ' : ''
34+
'' !== $additionalMessage ? ' '.$additionalMessage.'. ' : ''
3535
);
3636

3737
parent::__construct($message);

NumberFormatter/NumberFormatter.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public static function create($locale = 'en', $style = null, $pattern = null)
330330
*/
331331
public function formatCurrency($value, $currency)
332332
{
333-
if ($this->style == self::DECIMAL) {
333+
if (self::DECIMAL == $this->style) {
334334
return $this->format($value);
335335
}
336336

@@ -369,21 +369,21 @@ public function formatCurrency($value, $currency)
369369
public function format($value, $type = self::TYPE_DEFAULT)
370370
{
371371
// The original NumberFormatter does not support this format type
372-
if ($type == self::TYPE_CURRENCY) {
372+
if (self::TYPE_CURRENCY == $type) {
373373
trigger_error(__METHOD__.'(): Unsupported format type '.$type, \E_USER_WARNING);
374374

375375
return false;
376376
}
377377

378-
if ($this->style == self::CURRENCY) {
378+
if (self::CURRENCY == $this->style) {
379379
throw new NotImplementedException(sprintf(
380380
'%s() method does not support the formatting of currencies (instance with CURRENCY style). %s',
381381
__METHOD__, NotImplementedException::INTL_INSTALL_MESSAGE
382382
));
383383
}
384384

385385
// Only the default type is supported.
386-
if ($type != self::TYPE_DEFAULT) {
386+
if (self::TYPE_DEFAULT != $type) {
387387
throw new MethodArgumentValueNotImplementedException(__METHOD__, 'type', $type, 'Only TYPE_DEFAULT is supported');
388388
}
389389

@@ -526,7 +526,7 @@ public function parseCurrency($value, &$currency, &$position = null)
526526
*/
527527
public function parse($value, $type = self::TYPE_DOUBLE, &$position = 0)
528528
{
529-
if ($type == self::TYPE_DEFAULT || $type == self::TYPE_CURRENCY) {
529+
if (self::TYPE_DEFAULT == $type || self::TYPE_CURRENCY == $type) {
530530
trigger_error(__METHOD__.'(): Unsupported format type '.$type, \E_USER_WARNING);
531531

532532
return false;
@@ -773,7 +773,7 @@ private function formatNumber($value, $precision)
773773
*/
774774
private function getUninitializedPrecision($value, $precision)
775775
{
776-
if ($this->style == self::CURRENCY) {
776+
if (self::CURRENCY == $this->style) {
777777
return $precision;
778778
}
779779

@@ -809,11 +809,11 @@ private function isInitializedAttribute($attr)
809809
*/
810810
private function convertValueDataType($value, $type)
811811
{
812-
if ($type == self::TYPE_DOUBLE) {
812+
if (self::TYPE_DOUBLE == $type) {
813813
$value = (float) $value;
814-
} elseif ($type == self::TYPE_INT32) {
814+
} elseif (self::TYPE_INT32 == $type) {
815815
$value = $this->getInt32Value($value);
816-
} elseif ($type == self::TYPE_INT64) {
816+
} elseif (self::TYPE_INT64 == $type) {
817817
$value = $this->getInt64Value($value);
818818
}
819819

Tests/Data/Provider/AbstractCurrencyDataProviderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,15 +676,15 @@ function ($currency) { return array($currency); },
676676
*/
677677
public function testGetFractionDigits($currency)
678678
{
679-
$this->assertTrue(is_numeric($this->dataProvider->getFractionDigits($currency)));
679+
$this->assertInternalType('numeric', $this->dataProvider->getFractionDigits($currency));
680680
}
681681

682682
/**
683683
* @dataProvider provideCurrencies
684684
*/
685685
public function testGetRoundingIncrement($currency)
686686
{
687-
$this->assertTrue(is_numeric($this->dataProvider->getRoundingIncrement($currency)));
687+
$this->assertInternalType('numeric', $this->dataProvider->getRoundingIncrement($currency));
688688
}
689689

690690
public function provideCurrenciesWithNumericEquivalent()

Tests/NumberFormatter/AbstractNumberFormatterTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ public function testParse($value, $expected, $message, $expectedPosition, $group
621621
$this->assertSame($expected, $parsedValue, $message);
622622
$this->assertSame($expectedPosition, $position, $message);
623623

624-
if ($expected === false) {
624+
if (false === $expected) {
625625
$errorCode = IntlGlobals::U_PARSE_ERROR;
626626
$errorMessage = 'Number parsing failed: U_PARSE_ERROR';
627627
} else {
@@ -631,10 +631,10 @@ public function testParse($value, $expected, $message, $expectedPosition, $group
631631

632632
$this->assertSame($errorMessage, $this->getIntlErrorMessage());
633633
$this->assertSame($errorCode, $this->getIntlErrorCode());
634-
$this->assertSame($errorCode !== 0, $this->isIntlFailure($this->getIntlErrorCode()));
634+
$this->assertSame(0 !== $errorCode, $this->isIntlFailure($this->getIntlErrorCode()));
635635
$this->assertSame($errorMessage, $formatter->getErrorMessage());
636636
$this->assertSame($errorCode, $formatter->getErrorCode());
637-
$this->assertSame($errorCode !== 0, $this->isIntlFailure($formatter->getErrorCode()));
637+
$this->assertSame(0 !== $errorCode, $this->isIntlFailure($formatter->getErrorCode()));
638638
}
639639

640640
public function parseProvider()

Util/SvnRepository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static function download($url, $targetDir)
5050
{
5151
exec('which svn', $output, $result);
5252

53-
if ($result !== 0) {
53+
if (0 !== $result) {
5454
throw new RuntimeException('The command "svn" is not installed.');
5555
}
5656

@@ -62,7 +62,7 @@ public static function download($url, $targetDir)
6262

6363
exec('svn checkout '.$url.' '.$targetDir, $output, $result);
6464

65-
if ($result !== 0) {
65+
if (0 !== $result) {
6666
throw new RuntimeException('The SVN checkout of '.$url.'failed.');
6767
}
6868
}
@@ -128,7 +128,7 @@ private function getSvnInfo()
128128

129129
$svnInfo = simplexml_load_string(implode("\n", $output));
130130

131-
if ($result !== 0) {
131+
if (0 !== $result) {
132132
throw new RuntimeException('svn info failed');
133133
}
134134

0 commit comments

Comments
 (0)