Browse Source

Removed unnecessary parentheses

batch-query-test
Alexander Makarov 9 years ago
parent
commit
5c4e2d4372
  1. 6
      framework/captcha/CaptchaAction.php
  2. 4
      framework/db/BaseActiveRecord.php
  3. 2
      framework/grid/DataColumn.php
  4. 2
      framework/helpers/BaseInflector.php
  5. 2
      framework/mail/BaseMailer.php
  6. 2
      framework/validators/IpValidator.php

6
framework/captcha/CaptchaAction.php

@ -332,8 +332,8 @@ class CaptchaAction extends Action
$fontMetrics = $image->queryFontMetrics($draw, $code);
$length = strlen($code);
$w = (int) ($fontMetrics['textWidth']) - 8 + $this->offset * ($length - 1);
$h = (int) ($fontMetrics['textHeight']) - 8;
$w = (int) $fontMetrics['textWidth'] - 8 + $this->offset * ($length - 1);
$h = (int) $fontMetrics['textHeight'] - 8;
$scale = min(($this->width - $this->padding * 2) / $w, ($this->height - $this->padding * 2) / $h);
$x = 10;
$y = round($this->height * 27 / 40);
@ -344,7 +344,7 @@ class CaptchaAction extends Action
$draw->setFillColor($foreColor);
$image->annotateImage($draw, $x, $y, rand(-10, 10), $code[$i]);
$fontMetrics = $image->queryFontMetrics($draw, $code[$i]);
$x += (int) ($fontMetrics['textWidth']) + $this->offset;
$x += (int) $fontMetrics['textWidth'] + $this->offset;
}
$image->setImageFormat('png');

4
framework/db/BaseActiveRecord.php

@ -1466,7 +1466,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
{
$labels = $this->attributeLabels();
if (isset($labels[$attribute])) {
return ($labels[$attribute]);
return $labels[$attribute];
} elseif (strpos($attribute, '.')) {
$attributeParts = explode('.', $attribute);
$neededAttribute = array_pop($attributeParts);
@ -1506,7 +1506,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
{
$hints = $this->attributeHints();
if (isset($hints[$attribute])) {
return ($hints[$attribute]);
return $hints[$attribute];
} elseif (strpos($attribute, '.')) {
$attributeParts = explode('.', $attribute);
$neededAttribute = array_pop($attributeParts);

2
framework/grid/DataColumn.php

@ -139,7 +139,7 @@ class DataColumn extends Column
if ($this->attribute !== null && $this->enableSorting &&
($sort = $provider->getSort()) !== false && $sort->hasAttribute($this->attribute)) {
return $sort->link($this->attribute, array_merge($this->sortLinkOptions, ['label' => ($this->encodeLabel ? Html::encode($label) : $label)]));
return $sort->link($this->attribute, array_merge($this->sortLinkOptions, ['label' => $this->encodeLabel ? Html::encode($label) : $label]));
} else {
return $this->encodeLabel ? Html::encode($label) : $label;
}

2
framework/helpers/BaseInflector.php

@ -522,7 +522,7 @@ class BaseInflector
*/
public static function ordinalize($number)
{
if (in_array(($number % 100), range(11, 13))) {
if (in_array($number % 100, range(11, 13))) {
return $number . 'th';
}
switch ($number % 10) {

2
framework/mail/BaseMailer.php

@ -320,7 +320,7 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
protected function saveMessage($message)
{
$path = Yii::getAlias($this->fileTransportPath);
if (!is_dir(($path))) {
if (!is_dir($path)) {
mkdir($path, 0777, true);
}
if ($this->fileTransportCallback !== null) {

2
framework/validators/IpValidator.php

@ -457,7 +457,7 @@ class IpValidator extends Validator
*/
private function parseNegatedRange ($string) {
$isNegated = strpos($string, static::NEGATION_CHAR) === 0;
return [$isNegated, ($isNegated ? substr($string, strlen(static::NEGATION_CHAR)) : $string)];
return [$isNegated, $isNegated ? substr($string, strlen(static::NEGATION_CHAR)) : $string];
}
/**

Loading…
Cancel
Save