소스 검색

Strict type checking

Visman 3 년 전
부모
커밋
d9101e83bd

+ 1 - 1
app/Controllers/Routing.php

@@ -740,7 +740,7 @@ class Routing
             case $r::NOT_FOUND:
                 // ... 404 Not Found
                 if (
-                    '1' != $user->g_read_board
+                    1 !== $user->g_read_board
                     && $user->isGuest
                 ) {
                     $page = $this->c->Redirect->page('Login');

+ 2 - 2
app/Core/Config.php

@@ -186,7 +186,7 @@ class Config
                             } else {
                                 $result[] = $value;
                             }
-                        } elseif (null != $key) {
+                        } elseif (null !== $key) {
                             throw new ForkException('Config array cannot be parsed');
                         }
 
@@ -267,7 +267,7 @@ class Config
 
                             $value = null;
                             $key   = null;
-                        } elseif (null != $key) {
+                        } elseif (null !== $key) {
                             throw new ForkException('Config array cannot be parsed');
                         }
 

+ 2 - 2
app/Core/Parser.php

@@ -59,8 +59,8 @@ class Parser extends Parserus
         }
 
         $this->setAttr('baseUrl', $this->c->BASE_URL);
-        $this->setAttr('showImg', '0' != $this->c->user->show_img);
-        $this->setAttr('showImgSign', '0' != $this->c->user->show_img_sig);
+        $this->setAttr('showImg', 1 === $this->c->user->show_img);
+        $this->setAttr('showImgSign', 1 === $this->c->user->show_img_sig);
     }
 
     /**

+ 1 - 1
app/Models/Pages/Post.php

@@ -291,7 +291,7 @@ class Post extends Page
                 $this->user->num_posts = $this->user->num_posts + 1;
 
                 if (
-                    0 != $this->user->g_promote_next_group
+                    $this->user->g_promote_next_group > 0
                     && $this->user->num_posts >= $this->user->g_promote_min_posts
                 ) {
                     $this->user->group_id = $this->user->g_promote_next_group;

+ 2 - 2
app/Models/Pages/PostValidatorTrait.php

@@ -27,7 +27,7 @@ trait PostValidatorTrait
         // заголовок темы только заглавными буквами
         } elseif (
             ! $executive
-            && 1 != $this->c->config->b_subject_all_caps
+            && 1 !== $this->c->config->b_subject_all_caps
             && \preg_match('%\p{Lu}%u', $subject)
             && ! \preg_match('%\p{Ll}%u', $subject)
         ) {
@@ -62,7 +62,7 @@ trait PostValidatorTrait
         if (
             true === $prepare
             && ! $executive
-            && 1 != $this->c->config->b_message_all_caps
+            && 1 !== $this->c->config->b_message_all_caps
         ) {
             $text = $this->c->Parser->getText();
 

+ 1 - 1
app/Models/Pages/Profile/Edit.php

@@ -194,7 +194,7 @@ class Edit extends Profile
             if (
                 true === $prepare
                 && ! $this->user->isAdmin
-                && 1 != $this->c->config->b_sig_all_caps
+                && 1 !== $this->c->config->b_sig_all_caps
             ) {
                 $text = $this->c->Parser->getText();
 

+ 2 - 2
app/Models/Subscription/Subscription.php

@@ -217,7 +217,7 @@ class Subscription extends Model
 
             if (self::FORUMS_DATA & $type) {
                 if (
-                    1 != $this->c->config->b_forum_subscriptions
+                    1 !== $this->c->config->b_forum_subscriptions
                     || $model->isGuest
                 ) {
                     $result[self::FORUMS_DATA] = null;
@@ -232,7 +232,7 @@ class Subscription extends Model
 
             if (self::TOPICS_DATA & $type) {
                 if (
-                    1 != $this->c->config->b_topic_subscriptions
+                    1 !== $this->c->config->b_topic_subscriptions
                     || $model->isGuest
                 ) {
                     $result[self::TOPICS_DATA] = null;

+ 1 - 1
app/Models/User/ChangeGroup.php

@@ -41,7 +41,7 @@ class ChangeGroup extends Action
             }
 
             if (
-                1 != $newGroup->g_moderator
+                1 !== $newGroup->g_moderator
                 && $user->isAdmMod
             ) {
                 $moderators[$user->id] = $user;

+ 1 - 1
app/Models/Validators/NoURL.php

@@ -29,7 +29,7 @@ class NoURL extends RulesValidator
         if (
             (
                 ! empty($flag)
-                || '1' != $this->c->user->g_post_links
+                || 1 !== $this->c->user->g_post_links
             )
             && \preg_match('%https?://|www\.%i', $value)
         ) {