GithubHelp home page GithubHelp logo

phplint's People

Watchers

James Cloos avatar  avatar  avatar

Forkers

fishcg

phplint's Issues

<?php 长标签内的代码块推进判断有误

<?php if ($event['end_time']): ?>
    <?php
         if ($event['create_time'] >= $_SERVER['REQUEST_TIME']) {
             echo '<span class="eventstatus">未开始</span>';
         } elseif (($event['end_time'] + ONE_DAY) > $_SERVER['REQUEST_TIME']) {
              echo '<span class="eventstatus indate">进行中</span>';
         } else {
              echo '<span class="eventstatus outdate">已结束</span>';
         }
     ?>
<?php endif; ?>

echo 这一行的代码会提示需要再缩进 4 个空格

?callback lint 检查要求问题的问题

<?php

class A
{
    public function ignoreExceptionSave(string $a, bool $b = true, ?callable $callback = null): bool
    {
        // ...
        return true;
    }
}
$ phplint a.php
a.php:
+------+----------+----------------------------------------+-----------------+
| loc  | severity | message                                | ruleId          |
+------+----------+----------------------------------------+-----------------+
| 5:69 | error    | A space is required before 'callable'. | keyword-spacing |
+------+----------+----------------------------------------+-----------------+

回调函数中 use 换行的 indent 问题

一行超过 120 个字符时换行时,将 use 换行写会出现 indent 问题

$records = array_reduce($res, function ($ret, $item)
    use ($msgids_uuid, $msgids_userid, $now, $uuid, $user_id, $expired_msg_ids) {
    // ... ...
}, []);

image
如果写成如下不会出现 indent 问题:

$records = array_reduce($res, function ($ret, $item) use ($msgids_uuid, $msgids_userid, 
        $now, $uuid, $user_id, $expired_msg_ids) {
    // ... ...
}, []);

batchInsert 参数换行时要求缩进字符数量错误

<?php
// ...
        Yii::$app->maindb->createCommand()
            ->batchInsert(Yii::$app->authManager->itemChildTable,
                array_keys($authitemchild_rows[0]), $authitemchild_rows)
            ->execute();
+------+----------+-------------------------------------------------+--------+
| loc  | severity | message                                         | ruleId |
+------+----------+-------------------------------------------------+--------+
| 68:1 | error    | Expected indentation of 12 spaces but found 16. | indent |
+------+----------+-------------------------------------------------+--------+

相关 PR: https://github.com/MiaoSiLa/missevan-backend/pull/271

数组里的 function value 空格问题

<? php
// ...
['attribute'=>'radio_drama_dramainfo.name',
'label'=>'剧集名称',
'format'=>'raw',
'value' => function($model) {
    return Html::a(Html::encode($model->radio_drama_dramainfo->name), Yii::$app->params['domainMissevan'] . '/mdrama/' . $model->drama_id);
}],
`indent` 45:1 Expected indentation of 16 spaces but found 20.

SQL 关键字需要缩到下一格

$query->addSelect('t2.user_id AS subscribed_user_id')
    ->leftJoin(EventVoteDetail::tableName() . ' AS t2', 't1.event_id = t2.event_id
    AND t2.user_id = :user_id')

AND 需要缩到下一格

创建匿名类对象时的空格问题

function foo($msg, $code, $error_info) 
{
      // 将提示:A space is required after 'class'.
      return new class($msg, $code, $error_info) extends \Exception {
          /**
           * @var array
           */
          public $errorInfo = [];

          public function __construct($msg, $code, $error_info)
          {
              $this->code = $code;
              $this->message = $msg;
              $this->errorInfo = $error_info;
          }
      };

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.