Commit 94844231 by Qiang Xue

Merge pull request #2672 from lucianobaraglia/code-style-fixes

Code style fixes
parents 80cb3e71 269d1303
...@@ -25,7 +25,7 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -25,7 +25,7 @@ $this->params['breadcrumbs'][] = $this->title;
to view the mail message on the mail panel of the debugger. to view the mail message on the mail panel of the debugger.
<?php if (Yii::$app->mail->useFileTransport): ?> <?php if (Yii::$app->mail->useFileTransport): ?>
Because the application is in development mode, the email is not sent but saved as Because the application is in development mode, the email is not sent but saved as
a file under <code><?= Yii::getAlias(Yii::$app->mail->fileTransportPath); ?></code>. a file under <code><?= Yii::getAlias(Yii::$app->mail->fileTransportPath) ?></code>.
Please configure the <code>useFileTransport</code> property of the <code>mail</code> Please configure the <code>useFileTransport</code> property of the <code>mail</code>
application component to be false to enable email sending. application component to be false to enable email sending.
<?php endif; ?> <?php endif; ?>
......
...@@ -56,7 +56,7 @@ class ApiController extends BaseController ...@@ -56,7 +56,7 @@ class ApiController extends BaseController
if (file_exists($referenceFile)) { if (file_exists($referenceFile)) {
$renderer->guideUrl = $guideUrl; $renderer->guideUrl = $guideUrl;
$renderer->guideReferences = []; $renderer->guideReferences = [];
foreach(explode("\n", file_get_contents($referenceFile)) as $reference) { foreach (explode("\n", file_get_contents($referenceFile)) as $reference) {
$renderer->guideReferences[BaseRenderer::GUIDE_PREFIX . $reference]['url'] = $renderer->generateGuideUrl($reference); $renderer->guideReferences[BaseRenderer::GUIDE_PREFIX . $reference]['url'] = $renderer->generateGuideUrl($reference);
} }
} }
...@@ -69,7 +69,7 @@ class ApiController extends BaseController ...@@ -69,7 +69,7 @@ class ApiController extends BaseController
// load context from cache // load context from cache
$context = $this->loadContext($targetDir); $context = $this->loadContext($targetDir);
$this->stdout('Checking for updated files... '); $this->stdout('Checking for updated files... ');
foreach($context->files as $file => $sha) { foreach ($context->files as $file => $sha) {
if (!file_exists($file)) { if (!file_exists($file)) {
$this->stdout('At least one file has been removed. Rebuilding the context...'); $this->stdout('At least one file has been removed. Rebuilding the context...');
$context = new Context(); $context = new Context();
...@@ -89,7 +89,7 @@ class ApiController extends BaseController ...@@ -89,7 +89,7 @@ class ApiController extends BaseController
$this->stdout($fileCount . ' file' . ($fileCount == 1 ? '' : 's') . ' to update.' . PHP_EOL); $this->stdout($fileCount . ' file' . ($fileCount == 1 ? '' : 's') . ' to update.' . PHP_EOL);
Console::startProgress(0, $fileCount, 'Processing files... ', false); Console::startProgress(0, $fileCount, 'Processing files... ', false);
$done = 0; $done = 0;
foreach($files as $file) { foreach ($files as $file) {
$context->addFile($file); $context->addFile($file);
Console::updateProgress(++$done, $fileCount); Console::updateProgress(++$done, $fileCount);
} }
...@@ -158,4 +158,4 @@ class ApiController extends BaseController ...@@ -158,4 +158,4 @@ class ApiController extends BaseController
{ {
return array_merge(parent::globalOptions(), ['template', 'guide']); return array_merge(parent::globalOptions(), ['template', 'guide']);
} }
} }
\ No newline at end of file
...@@ -63,14 +63,14 @@ class GuideController extends BaseController ...@@ -63,14 +63,14 @@ class GuideController extends BaseController
$renderer->render($files, $targetDir); $renderer->render($files, $targetDir);
$this->stdout('Publishing images...'); $this->stdout('Publishing images...');
foreach($sourceDirs as $source) { foreach ($sourceDirs as $source) {
FileHelper::copyDirectory(rtrim($source, '/\\') . '/images', $targetDir . '/images'); FileHelper::copyDirectory(rtrim($source, '/\\') . '/images', $targetDir . '/images');
} }
$this->stdout('done.' . PHP_EOL, Console::FG_GREEN); $this->stdout('done.' . PHP_EOL, Console::FG_GREEN);
// generate api references.txt // generate api references.txt
$references = []; $references = [];
foreach($files as $file) { foreach ($files as $file) {
$references[] = basename($file, '.md'); $references[] = basename($file, '.md');
} }
file_put_contents($targetDir . '/guide-references.txt', implode("\n", $references)); file_put_contents($targetDir . '/guide-references.txt', implode("\n", $references));
...@@ -113,4 +113,4 @@ class GuideController extends BaseController ...@@ -113,4 +113,4 @@ class GuideController extends BaseController
{ {
return array_merge(parent::globalOptions(), ['apiDocs']); return array_merge(parent::globalOptions(), ['apiDocs']);
} }
} }
\ No newline at end of file
...@@ -62,8 +62,8 @@ abstract class BaseController extends Controller ...@@ -62,8 +62,8 @@ abstract class BaseController extends Controller
$exclude = []; $exclude = [];
} }
foreach($sourceDirs as $source) { foreach ($sourceDirs as $source) {
foreach($this->findFiles($source, $exclude) as $fileName) { foreach ($this->findFiles($source, $exclude) as $fileName) {
$files[$fileName] = $fileName; $files[$fileName] = $fileName;
} }
} }
......
...@@ -163,9 +163,9 @@ class Context extends Component ...@@ -163,9 +163,9 @@ class Context extends Component
protected function inheritDocs($class) protected function inheritDocs($class)
{ {
// TODO also for properties? // TODO also for properties?
foreach($class->methods as $m) { foreach ($class->methods as $m) {
$inheritedMethod = $this->inheritMethodRecursive($m, $class); $inheritedMethod = $this->inheritMethodRecursive($m, $class);
foreach(['shortDescription', 'description', 'params', 'return', 'returnType', 'returnTypes', 'exceptions'] as $property) { foreach (['shortDescription', 'description', 'params', 'return', 'returnType', 'returnTypes', 'exceptions'] as $property) {
if (empty($m->$property)) { if (empty($m->$property)) {
$m->$property = $inheritedMethod->$property; $m->$property = $inheritedMethod->$property;
} }
......
...@@ -68,7 +68,7 @@ abstract class BaseRenderer extends Component ...@@ -68,7 +68,7 @@ abstract class BaseRenderer extends Component
$title = null; $title = null;
} }
$links = []; $links = [];
foreach($types as $type) { foreach ($types as $type) {
$postfix = ''; $postfix = '';
if (!is_object($type)) { if (!is_object($type)) {
if (substr($type, -2, 2) == '[]') { if (substr($type, -2, 2) == '[]') {
...@@ -195,4 +195,4 @@ abstract class BaseRenderer extends Component ...@@ -195,4 +195,4 @@ abstract class BaseRenderer extends Component
{ {
return rtrim($this->guideUrl, '/') . '/' . static::GUIDE_PREFIX . basename($file, '.md') . '.html'; return rtrim($this->guideUrl, '/') . '/' . static::GUIDE_PREFIX . basename($file, '.md') . '.html';
} }
} }
\ No newline at end of file
...@@ -40,7 +40,7 @@ class ApiRenderer extends \yii\apidoc\templates\html\ApiRenderer ...@@ -40,7 +40,7 @@ class ApiRenderer extends \yii\apidoc\templates\html\ApiRenderer
$types = array_merge($context->classes, $context->interfaces, $context->traits); $types = array_merge($context->classes, $context->interfaces, $context->traits);
$extTypes = []; $extTypes = [];
foreach($this->extensions as $k => $ext) { foreach ($this->extensions as $k => $ext) {
$extType = $this->filterTypes($types, $ext); $extType = $this->filterTypes($types, $ext);
if (empty($extType)) { if (empty($extType)) {
unset($this->extensions[$k]); unset($this->extensions[$k]);
...@@ -56,7 +56,7 @@ class ApiRenderer extends \yii\apidoc\templates\html\ApiRenderer ...@@ -56,7 +56,7 @@ class ApiRenderer extends \yii\apidoc\templates\html\ApiRenderer
$this->controller->stdout('generating extension index files...'); $this->controller->stdout('generating extension index files...');
} }
foreach($extTypes as $ext => $extType) { foreach ($extTypes as $ext => $extType) {
$readme = @file_get_contents("https://raw.github.com/yiisoft/yii2-$ext/master/README.md"); $readme = @file_get_contents("https://raw.github.com/yiisoft/yii2-$ext/master/README.md");
$indexFileContent = $this->renderWithLayout($this->indexView, [ $indexFileContent = $this->renderWithLayout($this->indexView, [
'docContext' => $context, 'docContext' => $context,
...@@ -108,9 +108,9 @@ class ApiRenderer extends \yii\apidoc\templates\html\ApiRenderer ...@@ -108,9 +108,9 @@ class ApiRenderer extends \yii\apidoc\templates\html\ApiRenderer
break; break;
} }
if($line === null) if ($line === null)
return $baseUrl . $url; return $baseUrl . $url;
else else
return $baseUrl . $url . '#L' . $line; return $baseUrl . $url . '#L' . $line;
} }
} }
\ No newline at end of file
...@@ -39,7 +39,7 @@ class GuideRenderer extends \yii\apidoc\templates\html\GuideRenderer ...@@ -39,7 +39,7 @@ class GuideRenderer extends \yii\apidoc\templates\html\GuideRenderer
$types = array_merge($this->apiContext->classes, $this->apiContext->interfaces, $this->apiContext->traits); $types = array_merge($this->apiContext->classes, $this->apiContext->interfaces, $this->apiContext->traits);
$extTypes = []; $extTypes = [];
foreach($this->extensions as $k => $ext) { foreach ($this->extensions as $k => $ext) {
$extType = $this->filterTypes($types, $ext); $extType = $this->filterTypes($types, $ext);
if (empty($extType)) { if (empty($extType)) {
unset($this->extensions[$k]); unset($this->extensions[$k]);
...@@ -50,4 +50,4 @@ class GuideRenderer extends \yii\apidoc\templates\html\GuideRenderer ...@@ -50,4 +50,4 @@ class GuideRenderer extends \yii\apidoc\templates\html\GuideRenderer
parent::render($files, $targetDir); parent::render($files, $targetDir);
} }
} }
\ No newline at end of file
...@@ -99,7 +99,7 @@ class ApiRenderer extends BaseApiRenderer implements ViewContextInterface ...@@ -99,7 +99,7 @@ class ApiRenderer extends BaseApiRenderer implements ViewContextInterface
Console::startProgress(0, $typeCount, 'Rendering files: ', false); Console::startProgress(0, $typeCount, 'Rendering files: ', false);
} }
$done = 0; $done = 0;
foreach($types as $type) { foreach ($types as $type) {
$fileContent = $this->renderWithLayout($this->typeView, [ $fileContent = $this->renderWithLayout($this->typeView, [
'type' => $type, 'type' => $type,
'apiContext' => $context, 'apiContext' => $context,
...@@ -145,7 +145,7 @@ class ApiRenderer extends BaseApiRenderer implements ViewContextInterface ...@@ -145,7 +145,7 @@ class ApiRenderer extends BaseApiRenderer implements ViewContextInterface
$parents = []; $parents = [];
$parents[] = $this->createTypeLink($class); $parents[] = $this->createTypeLink($class);
while ($class->parentClass !== null) { while ($class->parentClass !== null) {
if(isset($this->apiContext->classes[$class->parentClass])) { if (isset($this->apiContext->classes[$class->parentClass])) {
$class = $this->apiContext->classes[$class->parentClass]; $class = $this->apiContext->classes[$class->parentClass];
$parents[] = $this->createTypeLink($class); $parents[] = $this->createTypeLink($class);
} else { } else {
...@@ -164,8 +164,8 @@ class ApiRenderer extends BaseApiRenderer implements ViewContextInterface ...@@ -164,8 +164,8 @@ class ApiRenderer extends BaseApiRenderer implements ViewContextInterface
{ {
$interfaces = []; $interfaces = [];
sort($names, SORT_STRING); sort($names, SORT_STRING);
foreach($names as $interface) { foreach ($names as $interface) {
if(isset($this->apiContext->interfaces[$interface])) { if (isset($this->apiContext->interfaces[$interface])) {
$interfaces[] = $this->createTypeLink($this->apiContext->interfaces[$interface]); $interfaces[] = $this->createTypeLink($this->apiContext->interfaces[$interface]);
} else { } else {
$interfaces[] = $this->createTypeLink($interface); $interfaces[] = $this->createTypeLink($interface);
...@@ -182,8 +182,8 @@ class ApiRenderer extends BaseApiRenderer implements ViewContextInterface ...@@ -182,8 +182,8 @@ class ApiRenderer extends BaseApiRenderer implements ViewContextInterface
{ {
$traits = []; $traits = [];
sort($names, SORT_STRING); sort($names, SORT_STRING);
foreach($names as $trait) { foreach ($names as $trait) {
if(isset($this->apiContext->traits[$trait])) { if (isset($this->apiContext->traits[$trait])) {
$traits[] = $this->createTypeLink($this->apiContext->traits[$trait]); $traits[] = $this->createTypeLink($this->apiContext->traits[$trait]);
} else { } else {
$traits[] = $this->createTypeLink($trait); $traits[] = $this->createTypeLink($trait);
...@@ -200,8 +200,8 @@ class ApiRenderer extends BaseApiRenderer implements ViewContextInterface ...@@ -200,8 +200,8 @@ class ApiRenderer extends BaseApiRenderer implements ViewContextInterface
{ {
$classes = []; $classes = [];
sort($names, SORT_STRING); sort($names, SORT_STRING);
foreach($names as $class) { foreach ($names as $class) {
if(isset($this->apiContext->classes[$class])) { if (isset($this->apiContext->classes[$class])) {
$classes[] = $this->createTypeLink($this->apiContext->classes[$class]); $classes[] = $this->createTypeLink($this->apiContext->classes[$class]);
} else { } else {
$classes[] = $this->createTypeLink($class); $classes[] = $this->createTypeLink($class);
...@@ -237,7 +237,7 @@ class ApiRenderer extends BaseApiRenderer implements ViewContextInterface ...@@ -237,7 +237,7 @@ class ApiRenderer extends BaseApiRenderer implements ViewContextInterface
public function renderMethodSignature($method) public function renderMethodSignature($method)
{ {
$params = []; $params = [];
foreach($method->params as $param) { foreach ($method->params as $param) {
$params[] = (empty($param->typeHint) ? '' : $param->typeHint . ' ') $params[] = (empty($param->typeHint) ? '' : $param->typeHint . ' ')
. ($param->isPassedByReference ? '<b>&</b>' : '') . ($param->isPassedByReference ? '<b>&</b>' : '')
. $param->name . $param->name
......
...@@ -78,7 +78,7 @@ abstract class GuideRenderer extends BaseGuideRenderer ...@@ -78,7 +78,7 @@ abstract class GuideRenderer extends BaseGuideRenderer
$done = 0; $done = 0;
$fileData = []; $fileData = [];
$headlines = []; $headlines = [];
foreach($files as $file) { foreach ($files as $file) {
$fileData[$file] = file_get_contents($file); $fileData[$file] = file_get_contents($file);
if (basename($file) == 'index.md') { if (basename($file) == 'index.md') {
continue; // to not add index file to nav continue; // to not add index file to nav
...@@ -90,7 +90,7 @@ abstract class GuideRenderer extends BaseGuideRenderer ...@@ -90,7 +90,7 @@ abstract class GuideRenderer extends BaseGuideRenderer
} }
} }
foreach($fileData as $file => $content) { foreach ($fileData as $file => $content) {
$output = ApiMarkdown::process($content); // TODO generate links to yiiframework.com by default $output = ApiMarkdown::process($content); // TODO generate links to yiiframework.com by default
$output = $this->fixMarkdownLinks($output); $output = $this->fixMarkdownLinks($output);
if ($this->layout !== false) { if ($this->layout !== false) {
...@@ -157,4 +157,4 @@ abstract class GuideRenderer extends BaseGuideRenderer ...@@ -157,4 +157,4 @@ abstract class GuideRenderer extends BaseGuideRenderer
{ {
return rtrim($this->apiUrl, '/') . '/' . strtolower(str_replace('\\', '-', $typeName)) . '.html'; return rtrim($this->apiUrl, '/') . '/' . strtolower(str_replace('\\', '-', $typeName)) . '.html';
} }
} }
\ No newline at end of file
...@@ -32,8 +32,8 @@ ArrayHelper::multisort($events, 'name'); ...@@ -32,8 +32,8 @@ ArrayHelper::multisort($events, 'name');
<?php echo $event->trigger->signature; ?> <?php echo $event->trigger->signature; ?>
</div>*/ ?> </div>*/ ?>
<?= ApiMarkdown::process($event->description, $type); ?> <?= ApiMarkdown::process($event->description, $type) ?>
<?= $this->render('seeAlso', ['object' => $event]); ?> <?= $this->render('seeAlso', ['object' => $event]) ?>
<?php endforeach; ?> <?php endforeach; ?>
...@@ -48,9 +48,9 @@ ArrayHelper::multisort($methods, 'name'); ...@@ -48,9 +48,9 @@ ArrayHelper::multisort($methods, 'name');
<?php endforeach; ?> <?php endforeach; ?>
<?php if (!empty($method->return)): ?> <?php if (!empty($method->return)): ?>
<tr> <tr>
<th class="paramNameCol"><?= 'return'; ?></th> <th class="paramNameCol"><?= 'return' ?></th>
<td class="paramTypeCol"><?= $renderer->createTypeLink($method->returnTypes); ?></td> <td class="paramTypeCol"><?= $renderer->createTypeLink($method->returnTypes) ?></td>
<td class="paramDescCol"><?= ApiMarkdown::process($method->return, $type); ?></td> <td class="paramDescCol"><?= ApiMarkdown::process($method->return, $type) ?></td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<?php foreach ($method->exceptions as $exception => $description): ?> <?php foreach ($method->exceptions as $exception => $description): ?>
...@@ -61,7 +61,7 @@ ArrayHelper::multisort($methods, 'name'); ...@@ -61,7 +61,7 @@ ArrayHelper::multisort($methods, 'name');
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>
<?php if(($sourceUrl = $renderer->getSourceUrl($method->definedBy, $method->startLine)) !== null): ?> <?php if (($sourceUrl = $renderer->getSourceUrl($method->definedBy, $method->startLine)) !== null): ?>
<tr> <tr>
<td colspan="3">Source Code: <a href="<?= $sourceUrl ?>"><?= $sourceUrl ?></a></td> <td colspan="3">Source Code: <a href="<?= $sourceUrl ?>"><?= $sourceUrl ?></a></td>
</tr> </tr>
...@@ -73,6 +73,6 @@ ArrayHelper::multisort($methods, 'name'); ...@@ -73,6 +73,6 @@ ArrayHelper::multisort($methods, 'name');
<p><strong><?= ApiMarkdown::process($method->shortDescription, $type, true) ?></strong></p> <p><strong><?= ApiMarkdown::process($method->shortDescription, $type, true) ?></strong></p>
<?= ApiMarkdown::process($method->description, $type) ?> <?= ApiMarkdown::process($method->description, $type) ?>
<?= $this->render('seeAlso', ['object' => $method]); ?> <?= $this->render('seeAlso', ['object' => $method]) ?>
<?php endforeach; ?> <?php endforeach; ?>
\ No newline at end of file
...@@ -40,6 +40,6 @@ ArrayHelper::multisort($properties, 'name'); ...@@ -40,6 +40,6 @@ ArrayHelper::multisort($properties, 'name');
<?= ApiMarkdown::process($property->description, $type) ?> <?= ApiMarkdown::process($property->description, $type) ?>
<?= $this->render('seeAlso', ['object' => $property]); ?> <?= $this->render('seeAlso', ['object' => $property]) ?>
<?php endforeach; ?> <?php endforeach; ?>
...@@ -71,7 +71,7 @@ $renderer = $this->context; ...@@ -71,7 +71,7 @@ $renderer = $this->context;
<?php if (!empty($type->since)): ?> <?php if (!empty($type->since)): ?>
<tr><th>Available since version</th><td><?= $type->since ?></td></tr> <tr><th>Available since version</th><td><?= $type->since ?></td></tr>
<?php endif; ?> <?php endif; ?>
<?php if(($sourceUrl = $renderer->getSourceUrl($type)) !== null): ?> <?php if (($sourceUrl = $renderer->getSourceUrl($type)) !== null): ?>
<tr> <tr>
<th>Source Code</th> <th>Source Code</th>
<td><a href="<?= $sourceUrl ?>"><?= $sourceUrl ?></a></td> <td><a href="<?= $sourceUrl ?>"><?= $sourceUrl ?></a></td>
......
...@@ -26,11 +26,11 @@ $redirectJavaScript .= 'popupWindowRedirect(' . Json::encode($url) . ', ' . Json ...@@ -26,11 +26,11 @@ $redirectJavaScript .= 'popupWindowRedirect(' . Json::encode($url) . ', ' . Json
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<?= Html::script($redirectJavaScript); ?> <?= Html::script($redirectJavaScript) ?>
</head> </head>
<body> <body>
<h2 id="title" style="display:none;">Redirecting back to the &quot;<?= Yii::$app->name; ?>&quot;...</h2> <h2 id="title" style="display:none;">Redirecting back to the &quot;<?= Yii::$app->name ?>&quot;...</h2>
<h3 id="link"><a href="<?= $url; ?>">Click here to return to the &quot;<?= Yii::$app->name; ?>&quot;.</a></h3> <h3 id="link"><a href="<?= $url ?>">Click here to return to the &quot;<?= Yii::$app->name ?>&quot;.</a></h3>
<script type="text/javascript"> <script type="text/javascript">
document.getElementById('title').style.display = ''; document.getElementById('title').style.display = '';
document.getElementById('link').style.display = 'none'; document.getElementById('link').style.display = 'none';
......
...@@ -39,7 +39,7 @@ use yii\authclient\ClientInterface; ...@@ -39,7 +39,7 @@ use yii\authclient\ClientInterface;
* ]); ?> * ]); ?>
* <ul> * <ul>
* <?php foreach ($authChoice->getClients() as $client): ?> * <?php foreach ($authChoice->getClients() as $client): ?>
* <li><?= $authChoice->clientLink($client); ?></li> * <li><?= $authChoice->clientLink($client) ?></li>
* <?php endforeach; ?> * <?php endforeach; ?>
* </ul> * </ul>
* <?php Choice::end(); ?> * <?php Choice::end(); ?>
......
...@@ -439,7 +439,7 @@ class ActiveRecord extends BaseActiveRecord ...@@ -439,7 +439,7 @@ class ActiveRecord extends BaseActiveRecord
// TODO do this via command // TODO do this via command
$url = [static::index(), static::type(), '_bulk']; $url = [static::index(), static::type(), '_bulk'];
$response = static::getDb()->post($url, [], $bulk); $response = static::getDb()->post($url, [], $bulk);
$n=0; $n = 0;
$errors = []; $errors = [];
foreach ($response['items'] as $item) { foreach ($response['items'] as $item) {
if (isset($item['update']['error'])) { if (isset($item['update']['error'])) {
...@@ -502,7 +502,7 @@ class ActiveRecord extends BaseActiveRecord ...@@ -502,7 +502,7 @@ class ActiveRecord extends BaseActiveRecord
// TODO do this via command // TODO do this via command
$url = [static::index(), static::type(), '_bulk']; $url = [static::index(), static::type(), '_bulk'];
$response = static::getDb()->post($url, [], $bulk); $response = static::getDb()->post($url, [], $bulk);
$n=0; $n = 0;
$errors = []; $errors = [];
foreach ($response['items'] as $item) { foreach ($response['items'] as $item) {
if (isset($item['update']['error'])) { if (isset($item['update']['error'])) {
...@@ -556,7 +556,7 @@ class ActiveRecord extends BaseActiveRecord ...@@ -556,7 +556,7 @@ class ActiveRecord extends BaseActiveRecord
// TODO do this via command // TODO do this via command
$url = [static::index(), static::type(), '_bulk']; $url = [static::index(), static::type(), '_bulk'];
$response = static::getDb()->post($url, [], $bulk); $response = static::getDb()->post($url, [], $bulk);
$n=0; $n = 0;
$errors = []; $errors = [];
foreach ($response['items'] as $item) { foreach ($response['items'] as $item) {
if (isset($item['delete']['error'])) { if (isset($item['delete']['error'])) {
......
...@@ -245,7 +245,7 @@ class Connection extends Component ...@@ -245,7 +245,7 @@ class Connection extends Component
return mb_strlen($data, '8bit'); return mb_strlen($data, '8bit');
}, },
CURLOPT_HEADERFUNCTION => function($curl, $data) use (&$headers) { CURLOPT_HEADERFUNCTION => function($curl, $data) use (&$headers) {
foreach(explode("\r\n", $data) as $row) { foreach (explode("\r\n", $data) as $row) {
if (($pos = strpos($row, ':')) !== false) { if (($pos = strpos($row, ':')) !== false) {
$headers[strtolower(substr($row, 0, $pos))] = trim(substr($row, $pos + 1)); $headers[strtolower(substr($row, 0, $pos))] = trim(substr($row, $pos + 1));
} }
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
* @var string $tableName full table name * @var string $tableName full table name
* @var string $className class name * @var string $className class name
* @var yii\db\TableSchema $tableSchema * @var yii\db\TableSchema $tableSchema
* @var string[] $labels list of attribute labels (name=>label) * @var string[] $labels list of attribute labels (name => label)
* @var string[] $rules list of validation rules * @var string[] $rules list of validation rules
* @var array $relations list of relations (name=>relation declaration) * @var array $relations list of relations (name => relation declaration)
*/ */
echo "<?php\n"; echo "<?php\n";
......
...@@ -59,7 +59,7 @@ class ActiveRecord extends BaseActiveRecord ...@@ -59,7 +59,7 @@ class ActiveRecord extends BaseActiveRecord
* You may also define default conditions that should apply to all queries unless overridden: * You may also define default conditions that should apply to all queries unless overridden:
* *
* ```php * ```php
* public static function createQuery($config= []) * public static function createQuery($config = [])
* { * {
* return parent::createQuery($config)->where(['deleted' => false]); * return parent::createQuery($config)->where(['deleted' => false]);
* } * }
...@@ -171,7 +171,7 @@ class ActiveRecord extends BaseActiveRecord ...@@ -171,7 +171,7 @@ class ActiveRecord extends BaseActiveRecord
return 0; return 0;
} }
$db = static::getDb(); $db = static::getDb();
$n=0; $n = 0;
foreach (static::fetchPks($condition) as $pk) { foreach (static::fetchPks($condition) as $pk) {
$newPk = $pk; $newPk = $pk;
$pk = static::buildKey($pk); $pk = static::buildKey($pk);
...@@ -223,7 +223,7 @@ class ActiveRecord extends BaseActiveRecord ...@@ -223,7 +223,7 @@ class ActiveRecord extends BaseActiveRecord
return 0; return 0;
} }
$db = static::getDb(); $db = static::getDb();
$n=0; $n = 0;
foreach (static::fetchPks($condition) as $pk) { foreach (static::fetchPks($condition) as $pk) {
$key = static::keyPrefix() . ':a:' . static::buildKey($pk); $key = static::keyPrefix() . ':a:' . static::buildKey($pk);
foreach ($counters as $attribute => $value) { foreach ($counters as $attribute => $value) {
......
...@@ -49,7 +49,7 @@ class Column extends Object ...@@ -49,7 +49,7 @@ class Column extends Object
/** /**
* @var array the HTML attributes for the filter cell tag. * @var array the HTML attributes for the filter cell tag.
*/ */
public $filterOptions=[]; public $filterOptions = [];
/** /**
......
...@@ -57,7 +57,7 @@ class SchemaTest extends SphinxTestCase ...@@ -57,7 +57,7 @@ class SchemaTest extends SphinxTestCase
[1337, \PDO::PARAM_INT], [1337, \PDO::PARAM_INT],
[true, \PDO::PARAM_BOOL], [true, \PDO::PARAM_BOOL],
[false, \PDO::PARAM_BOOL], [false, \PDO::PARAM_BOOL],
[$fp=fopen(__FILE__, 'rb'), \PDO::PARAM_LOB], [$fp = fopen(__FILE__, 'rb'), \PDO::PARAM_LOB],
]; ];
$schema = $this->getConnection()->schema; $schema = $this->getConnection()->schema;
...@@ -80,4 +80,4 @@ class SchemaTest extends SphinxTestCase ...@@ -80,4 +80,4 @@ class SchemaTest extends SphinxTestCase
$this->assertEquals('rt', $index->type); $this->assertEquals('rt', $index->type);
$this->assertTrue($index->isRuntime); $this->assertTrue($index->isRuntime);
} }
} }
\ No newline at end of file
...@@ -70,7 +70,7 @@ class MessageControllerTest extends TestCase ...@@ -70,7 +70,7 @@ class MessageControllerTest extends TestCase
} else { } else {
$dirHandle = opendir($fileSystemObjectFullName); $dirHandle = opendir($fileSystemObjectFullName);
while (($fileSystemObjectName = readdir($dirHandle)) !== false) { while (($fileSystemObjectName = readdir($dirHandle)) !== false) {
if ($fileSystemObjectName==='.' || $fileSystemObjectName==='..') { if ($fileSystemObjectName === '.' || $fileSystemObjectName === '..') {
continue; continue;
} }
$this->removeFileSystemObject($fileSystemObjectFullName . DIRECTORY_SEPARATOR . $fileSystemObjectName); $this->removeFileSystemObject($fileSystemObjectFullName . DIRECTORY_SEPARATOR . $fileSystemObjectName);
......
...@@ -79,7 +79,7 @@ class SchemaTest extends DatabaseTestCase ...@@ -79,7 +79,7 @@ class SchemaTest extends DatabaseTestCase
[1337, \PDO::PARAM_INT], [1337, \PDO::PARAM_INT],
[true, \PDO::PARAM_BOOL], [true, \PDO::PARAM_BOOL],
[false, \PDO::PARAM_BOOL], [false, \PDO::PARAM_BOOL],
[$fp=fopen(__FILE__, 'rb'), \PDO::PARAM_LOB], [$fp = fopen(__FILE__, 'rb'), \PDO::PARAM_LOB],
]; ];
/** @var Schema $schema */ /** @var Schema $schema */
......
...@@ -22,7 +22,7 @@ class CubridSchemaTest extends SchemaTest ...@@ -22,7 +22,7 @@ class CubridSchemaTest extends SchemaTest
[1337, \PDO::PARAM_INT], [1337, \PDO::PARAM_INT],
[true, \PDO::PARAM_INT], [true, \PDO::PARAM_INT],
[false, \PDO::PARAM_INT], [false, \PDO::PARAM_INT],
[$fp=fopen(__FILE__, 'rb'), \PDO::PARAM_LOB], [$fp = fopen(__FILE__, 'rb'), \PDO::PARAM_LOB],
]; ];
/** @var Schema $schema */ /** @var Schema $schema */
......
...@@ -173,7 +173,7 @@ class FileValidatorTest extends TestCase ...@@ -173,7 +173,7 @@ class FileValidatorTest extends TestCase
$this->assertTrue($m->hasErrors('attr_files_empty')); $this->assertTrue($m->hasErrors('attr_files_empty'));
$this->assertSame($val->uploadRequired, current($m->getErrors('attr_files_empty'))); $this->assertSame($val->uploadRequired, current($m->getErrors('attr_files_empty')));
// single File with skipOnEmpty=false // single File with skipOnEmpty = false
$val = new FileValidator(['skipOnEmpty' => false]); $val = new FileValidator(['skipOnEmpty' => false]);
$m = $this->createModelForAttributeTest(); $m = $this->createModelForAttributeTest();
$val->validateAttribute($m, 'attr_files'); $val->validateAttribute($m, 'attr_files');
......
...@@ -34,7 +34,7 @@ class SpacelessTest extends \yiiunit\TestCase ...@@ -34,7 +34,7 @@ class SpacelessTest extends \yiiunit\TestCase
echo "\t<p>Bye!</p>\n"; echo "\t<p>Bye!</p>\n";
echo "</body>\n"; echo "</body>\n";
$expected="<body>\n<div class='wrapper'><div class='left-column'><p>This is a left bar!</p>". $expected = "<body>\n<div class='wrapper'><div class='left-column'><p>This is a left bar!</p>".
"</div><div class='right-column'><p>This is a right bar!</p></div></div>\t<p>Bye!</p>\n</body>\n"; "</div><div class='right-column'><p>This is a right bar!</p></div></div>\t<p>Bye!</p>\n</body>\n";
$this->assertEquals($expected, ob_get_clean()); $this->assertEquals($expected, ob_get_clean());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment