Skip to:
Content

bbPress.org

Ticket #3613: phpcs-resurrect.patch

File phpcs-resurrect.patch, 57.1 KB (added by SirLouen, 16 months ago)

Patch with PHPCS Dist file resurrection + All the YodaConditions Sorted

  • composer.json

    diff --git composer.json composer.json
    index 7be27081..f105c2ae 100644
     
    33        "license": "GPL-2.0-or-later",
    44        "description": "bbPress is forum software with a twist from the creators of WordPress.",
    55        "require-dev": {
     6                "squizlabs/php_codesniffer": "^3.7.2",
    67                "phpcompatibility/phpcompatibility-wp": "^2.1",
    7                 "wp-coding-standards/wpcs": "^2.3",
    8                 "dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
     8                "wp-coding-standards/wpcs": "^3.0",
     9                "dealerdirect/phpcodesniffer-composer-installer": "^1.0",
    910                "phpunit/phpunit": "^9",
    1011                "yoast/phpunit-polyfills": "^3.0"
    1112        },
  • phpcs.xml.dist

    diff --git phpcs.xml.dist phpcs.xml.dist
    index 7ecf9303..183f7ad2 100644
     
    105105                </properties>
    106106        </rule>
    107107
    108         <rule ref="WordPress.PHP.NoSilencedErrors">
    109                 <properties>
    110                         <property name="use_default_whitelist" value="true"/>
    111                 </properties>
    112         </rule>
    113 
    114108
    115109        <!--
    116110        #############################################################################
     
    156150                <exclude-pattern>/src/*</exclude-pattern>
    157151        </rule>
    158152
    159         <rule ref="WordPress.Arrays.CommaAfterArrayItem.NoComma">
    160                 <exclude-pattern>/src/*</exclude-pattern>
    161         </rule>
    162 
    163153
    164154        <!--
    165155        #############################################################################
     
    167157        Adjustments which should be removed once the associated issues have been reviewed and resolved.
    168158        #############################################################################
    169159        -->
     160       
     161        <rule ref="Generic.CodeAnalysis.AssignmentInCondition.Found">
     162                <exclude-pattern>/src/*</exclude-pattern>
     163        </rule>
    170164
    171         <!-- Rules that require further review, partially reviewed -->
     165        <rule ref="Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition">
     166                <exclude-pattern>/src/*</exclude-pattern>
     167        </rule>
    172168
    173         <rule ref="Generic.Formatting.DisallowMultipleStatements.SameLine">
     169        <rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedElseif">
    174170                <exclude-pattern>/src/*</exclude-pattern>
    175171        </rule>
    176172
    177         <rule ref="Generic.Formatting.SpaceAfterCast.TooMuchSpace">
     173        <rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedIf">
    178174                <exclude-pattern>/src/*</exclude-pattern>
    179175        </rule>
    180176
    181         <rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie.ContentAfterBrace">
     177        <rule ref="Generic.CodeAnalysis.RequireExplicitBooleanOperatorPrecedence.MissingParentheses">
    182178                <exclude-pattern>/src/*</exclude-pattern>
    183179        </rule>
    184180
    185         <rule ref="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceBeforeClose">
     181        <rule ref="Generic.CodeAnalysis.UselessOverridingMethod.Found">
    186182                <exclude-pattern>/src/*</exclude-pattern>
    187183        </rule>
    188184
    189         <rule ref="PEAR.Functions.FunctionCallSignature.Indent">
     185        <rule ref="Generic.ControlStructures.InlineControlStructure.NotAllowed">
    190186                <exclude-pattern>/src/*</exclude-pattern>
    191187        </rule>
    192188
    193         <rule ref="PEAR.Functions.FunctionCallSignature.EmptyLine">
     189        <rule ref="Generic.Files.LineEndings.InvalidEOLChar">
    194190                <exclude-pattern>/src/*</exclude-pattern>
    195191        </rule>
    196192
    197         <rule ref="PSR2.ControlStructures.SwitchDeclaration.BreakIndent">
     193        <rule ref="Generic.Files.OneObjectStructurePerFile.MultipleFound">
    198194                <exclude-pattern>/src/*</exclude-pattern>
    199195        </rule>
    200196
    201         <!-- Rules that require further review, not yet reviewed -->
     197        <rule ref="Generic.Formatting.DisallowMultipleStatements.SameLine">
     198                <exclude-pattern>/src/*</exclude-pattern>
     199        </rule>
    202200
    203         <rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedElseif">
     201        <rule ref="Generic.Formatting.SpaceAfterCast.TooMuchSpace">
    204202                <exclude-pattern>/src/*</exclude-pattern>
    205203        </rule>
    206204
    207         <rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedIf">
     205        <rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie.ContentAfterBrace">
    208206                <exclude-pattern>/src/*</exclude-pattern>
    209207        </rule>
    210208
    211         <rule ref="Generic.CodeAnalysis.UselessOverridingMethod.Found">
     209        <rule ref="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceBeforeClose">
    212210                <exclude-pattern>/src/*</exclude-pattern>
    213211        </rule>
    214212
    215         <rule ref="Generic.ControlStructures.InlineControlStructure.NotAllowed">
     213        <rule ref="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed">
    216214                <exclude-pattern>/src/*</exclude-pattern>
    217215        </rule>
    218216
    219         <rule ref="Generic.Files.LineEndings.InvalidEOLChar">
     217        <rule ref="NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceAfterArrayOpenerMultiLine">
    220218                <exclude-pattern>/src/*</exclude-pattern>
    221219        </rule>
    222220
    223         <rule ref="Generic.Files.OneObjectStructurePerFile.MultipleFound">
     221        <rule ref="NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceAfterArrayOpenerSingleLine">
     222                <exclude-pattern>/src/*</exclude-pattern>
     223        </rule>
     224
     225        <rule ref="NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceBeforeArrayCloserMultiLine">
     226                <exclude-pattern>/src/*</exclude-pattern>
     227        </rule>
     228
     229        <rule ref="NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceBeforeArrayCloserSingleLine">
     230                <exclude-pattern>/src/*</exclude-pattern>
     231        </rule>
     232
     233        <rule ref="NormalizedArrays.Arrays.CommaAfterLast.MissingMultiLine">
     234                <exclude-pattern>/src/*</exclude-pattern>
     235        </rule>
     236
     237        <rule ref="NormalizedArrays.Arrays.CommaAfterLast.MissingMultiLineCloserSameLine">
    224238                <exclude-pattern>/src/*</exclude-pattern>
    225239        </rule>
    226240
     
    237251                <exclude-pattern>/src/*</exclude-pattern>
    238252        </rule>
    239253
     254        <rule ref="PEAR.Functions.FunctionCallSignature.EmptyLine">
     255                <exclude-pattern>/src/*</exclude-pattern>
     256        </rule>
     257
    240258        <rule ref="PEAR.Functions.FunctionCallSignature.FirstArgumentPosition">
    241259                <exclude-pattern>/src/*</exclude-pattern>
    242260        </rule>
    243261
     262        <rule ref="PEAR.Functions.FunctionCallSignature.Indent">
     263                <exclude-pattern>/src/*</exclude-pattern>
     264        </rule>
     265
    244266        <rule ref="PEAR.Functions.FunctionCallSignature.MultipleArguments">
    245267                <exclude-pattern>/src/*</exclude-pattern>
    246268        </rule>
     
    269291                <exclude-pattern>/src/*</exclude-pattern>
    270292        </rule>
    271293
     294        <rule ref="PSR2.Classes.ClassDeclaration.CloseBraceAfterBody">
     295                <exclude-pattern>/src/*</exclude-pattern>
     296        </rule>
     297
    272298        <rule ref="PSR2.Classes.PropertyDeclaration.ScopeMissing">
    273299                <exclude-pattern>/src/*</exclude-pattern>
    274300        </rule>
     
    293319                <exclude-pattern>/src/*</exclude-pattern>
    294320        </rule>
    295321
     322        <rule ref="PSR2.ControlStructures.SwitchDeclaration.BreakIndent">
     323                <exclude-pattern>/src/*</exclude-pattern>
     324        </rule>
     325
    296326        <rule ref="PSR2.ControlStructures.SwitchDeclaration.SpaceBeforeColonCASE">
    297327                <exclude-pattern>/src/*</exclude-pattern>
    298328        </rule>
     
    301331                <exclude-pattern>/src/*</exclude-pattern>
    302332        </rule>
    303333
     334        <rule ref="PSR2.Methods.FunctionClosingBrace.SpacingBeforeClose">
     335                <exclude-pattern>/src/*</exclude-pattern>
     336        </rule>
     337
    304338        <rule ref="PSR2.Methods.MethodDeclaration.Underscore">
    305339                <exclude-pattern>/src/*</exclude-pattern>
    306340        </rule>
     
    317351                <exclude-pattern>/src/*</exclude-pattern>
    318352        </rule>
    319353
     354        <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose">
     355                <exclude-pattern>/src/*</exclude-pattern>
     356        </rule>
     357
     358        <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.ContentAfterBrace">
     359                <exclude-pattern>/src/*</exclude-pattern>
     360        </rule>
     361
    320362        <rule ref="Squiz.PHP.CommentedOutCode.Found">
    321363                <exclude-pattern>/src/*</exclude-pattern>
    322364        </rule>
     
    361403                <exclude-pattern>/src/*</exclude-pattern>
    362404        </rule>
    363405
    364         <rule ref="WordPress.Arrays.ArrayDeclarationSpacing.ArrayItemNoNewLine">
     406        <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine">
    365407                <exclude-pattern>/src/*</exclude-pattern>
    366408        </rule>
    367409
    368         <rule ref="WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound">
     410        <rule ref="Universal.Arrays.DuplicateArrayKey.Found">
    369411                <exclude-pattern>/src/*</exclude-pattern>
    370412        </rule>
    371413
    372         <rule ref="WordPress.Arrays.ArrayDeclarationSpacing.CloseBraceNewLine">
     414        <rule ref="Universal.ControlStructures.DisallowLonelyIf.Found">
    373415                <exclude-pattern>/src/*</exclude-pattern>
    374416        </rule>
    375417
    376         <rule ref="WordPress.Arrays.ArrayDeclarationSpacing.NoSpaceAfterArrayOpener">
     418        <rule ref="Universal.Files.SeparateFunctionsFromOO.Mixed">
    377419                <exclude-pattern>/src/*</exclude-pattern>
    378420        </rule>
    379421
    380         <rule ref="WordPress.Arrays.ArrayDeclarationSpacing.NoSpaceBeforeArrayCloser">
     422        <rule ref="Universal.NamingConventions.NoReservedKeywordParameterNames.arrayFound">
    381423                <exclude-pattern>/src/*</exclude-pattern>
    382424        </rule>
    383425
    384         <rule ref="WordPress.Arrays.ArrayDeclarationSpacing.SpaceBeforeArrayCloser">
     426        <rule ref="Universal.NamingConventions.NoReservedKeywordParameterNames.classFound">
    385427                <exclude-pattern>/src/*</exclude-pattern>
    386428        </rule>
    387429
    388         <rule ref="WordPress.Arrays.ArrayIndentation.CloseBraceNotAligned">
     430        <rule ref="Universal.NamingConventions.NoReservedKeywordParameterNames.defaultFound">
    389431                <exclude-pattern>/src/*</exclude-pattern>
    390432        </rule>
    391433
    392         <rule ref="WordPress.Arrays.ArrayIndentation.ItemNotAligned">
     434        <rule ref="Universal.NamingConventions.NoReservedKeywordParameterNames.echoFound">
    393435                <exclude-pattern>/src/*</exclude-pattern>
    394436        </rule>
    395437
    396         <rule ref="WordPress.Arrays.ArrayIndentation.MultiLineArrayItemNotAligned">
     438        <rule ref="Universal.NamingConventions.NoReservedKeywordParameterNames.objectFound">
    397439                <exclude-pattern>/src/*</exclude-pattern>
    398440        </rule>
    399441
    400         <rule ref="WordPress.Arrays.ArrayKeySpacingRestrictions.NoSpacesAroundArrayKeys">
     442        <rule ref="Universal.NamingConventions.NoReservedKeywordParameterNames.parentFound">
    401443                <exclude-pattern>/src/*</exclude-pattern>
    402444        </rule>
    403445
    404         <rule ref="WordPress.Arrays.ArrayKeySpacingRestrictions.SpacesAroundArrayKeys">
     446        <rule ref="Universal.NamingConventions.NoReservedKeywordParameterNames.require_onceFound">
    405447                <exclude-pattern>/src/*</exclude-pattern>
    406448        </rule>
    407449
    408         <rule ref="WordPress.Arrays.ArrayKeySpacingRestrictions.TooMuchSpaceAfterKey">
     450        <rule ref="Universal.NamingConventions.NoReservedKeywordParameterNames.stringFound">
    409451                <exclude-pattern>/src/*</exclude-pattern>
    410452        </rule>
    411453
    412         <rule ref="WordPress.Arrays.CommaAfterArrayItem.SpaceAfterComma">
     454        <rule ref="Universal.Operators.DisallowStandalonePostIncrementDecrement.PostDecrementFound">
    413455                <exclude-pattern>/src/*</exclude-pattern>
    414456        </rule>
    415457
    416         <rule ref="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned">
     458        <rule ref="Universal.Operators.DisallowStandalonePostIncrementDecrement.PostIncrementFound">
    417459                <exclude-pattern>/src/*</exclude-pattern>
    418460        </rule>
    419461
    420         <rule ref="WordPress.Arrays.MultipleStatementAlignment.MultilineItemSpaceBeforeDoubleArrow">
     462        <rule ref="Universal.Operators.StrictComparisons.LooseEqual">
    421463                <exclude-pattern>/src/*</exclude-pattern>
    422464        </rule>
    423465
    424         <rule ref="WordPress.Arrays.MultipleStatementAlignment.SpaceBeforeDoubleArrow">
     466        <rule ref="Universal.Operators.StrictComparisons.LooseNotEqual">
    425467                <exclude-pattern>/src/*</exclude-pattern>
    426468        </rule>
    427469
    428         <rule ref="WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition">
     470        <rule ref="Universal.WhiteSpace.CommaSpacing.TooMuchSpaceAfter">
    429471                <exclude-pattern>/src/*</exclude-pattern>
    430472        </rule>
    431473
    432         <rule ref="WordPress.CodeAnalysis.AssignmentInCondition.Found">
     474        <rule ref="Universal.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed">
    433475                <exclude-pattern>/src/*</exclude-pattern>
    434476        </rule>
    435477
    436         <rule ref="WordPress.CodeAnalysis.EmptyStatement">
     478        <rule ref="Universal.WhiteSpace.PrecisionAlignment.Found">
    437479                <exclude-pattern>/src/*</exclude-pattern>
    438480        </rule>
    439481
    440         <rule ref="WordPress.DateTime.CurrentTimeTimestamp.Requested">
     482        <rule ref="WordPress.Arrays.ArrayDeclarationSpacing.ArrayItemNoNewLine">
    441483                <exclude-pattern>/src/*</exclude-pattern>
    442484        </rule>
    443485
    444         <rule ref="WordPress.DateTime.RestrictedFunctions.date_date">
     486        <rule ref="WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound">
    445487                <exclude-pattern>/src/*</exclude-pattern>
    446488        </rule>
    447489
    448         <rule ref="WordPress.DB.PreparedSQL.InterpolatedNotPrepared">
     490        <rule ref="WordPress.Arrays.ArrayIndentation.CloseBraceNotAligned">
     491                <exclude-pattern>/src/*</exclude-pattern>
     492        </rule>
     493
     494        <rule ref="WordPress.Arrays.ArrayIndentation.ItemNotAligned">
     495                <exclude-pattern>/src/*</exclude-pattern>
     496        </rule>
     497
     498        <rule ref="WordPress.Arrays.ArrayIndentation.MultiLineArrayItemNotAligned">
     499                <exclude-pattern>/src/*</exclude-pattern>
     500        </rule>
     501
     502        <rule ref="WordPress.Arrays.ArrayKeySpacingRestrictions.NoSpacesAroundArrayKeys">
     503                <exclude-pattern>/src/*</exclude-pattern>
     504        </rule>
     505
     506        <rule ref="WordPress.Arrays.ArrayKeySpacingRestrictions.SpacesAroundArrayKeys">
     507                <exclude-pattern>/src/*</exclude-pattern>
     508        </rule>
     509
     510        <rule ref="WordPress.Arrays.ArrayKeySpacingRestrictions.TooMuchSpaceAfterKey">
     511                <exclude-pattern>/src/*</exclude-pattern>
     512        </rule>
     513
     514        <rule ref="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned">
     515                <exclude-pattern>/src/*</exclude-pattern>
     516        </rule>
     517
     518        <rule ref="WordPress.Arrays.MultipleStatementAlignment.MultilineItemSpaceBeforeDoubleArrow">
    449519                <exclude-pattern>/src/*</exclude-pattern>
    450520        </rule>
    451521
     522        <rule ref="WordPress.Arrays.MultipleStatementAlignment.SpaceBeforeDoubleArrow">
     523                <exclude-pattern>/src/*</exclude-pattern>
     524        </rule>
     525
     526        <rule ref="WordPress.DB.PreparedSQL.InterpolatedNotPrepared">
     527    <exclude-pattern>/src/*</exclude-pattern>
     528        </rule>
     529
    452530        <rule ref="WordPress.DB.PreparedSQL.NotPrepared">
    453531                <exclude-pattern>/src/*</exclude-pattern>
    454532        </rule>
    455533
    456         <rule ref="WordPress.Files.FileName.InvalidClassFileName">
     534        <rule ref="WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare">
     535                <exclude-pattern>/src/*</exclude-pattern>
     536        </rule>
     537
     538        <rule ref="WordPress.DateTime.CurrentTimeTimestamp.Requested">
    457539                <exclude-pattern>/src/*</exclude-pattern>
    458540        </rule>
    459541
     542        <rule ref="WordPress.DateTime.RestrictedFunctions.date_date">
     543                <exclude-pattern>/src/*</exclude-pattern>
     544        </rule>
     545
     546        <rule ref="WordPress.Files.FileName.InvalidClassFileName">
     547    <exclude-pattern>/src/*</exclude-pattern>
     548        </rule>
     549
    460550        <rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
    461551                <exclude-pattern>/src/*</exclude-pattern>
    462552        </rule>
     
    470560        </rule>
    471561
    472562        <rule ref="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound">
    473                 <exclude-pattern>/src/*</exclude-pattern>
     563    <exclude-pattern>/src/*</exclude-pattern>
    474564        </rule>
    475565
    476566        <rule ref="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound">
     
    485575                <exclude-pattern>/src/*</exclude-pattern>
    486576        </rule>
    487577
    488         <rule ref="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid">
    489                 <exclude-pattern>/src/*</exclude-pattern>
    490         </rule>
    491 
    492578        <rule ref="WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase">
    493579                <exclude-pattern>/src/*</exclude-pattern>
    494580        </rule>
     
    517603                <exclude-pattern>/src/*</exclude-pattern>
    518604        </rule>
    519605
    520         <rule ref="WordPress.PHP.StrictComparisons.LooseComparison">
     606        <rule ref="WordPress.PHP.StrictInArray.MissingTrueStrict">
    521607                <exclude-pattern>/src/*</exclude-pattern>
    522608        </rule>
    523609
    524         <rule ref="WordPress.PHP.StrictInArray.MissingTrueStrict">
     610        <rule ref="WordPress.Security.EscapeOutput.OutputNotEscaped">
    525611                <exclude-pattern>/src/*</exclude-pattern>
    526612        </rule>
    527613
    528         <rule ref="WordPress.PHP.YodaConditions.NotYoda">
     614        <rule ref="WordPress.Security.EscapeOutput.UnsafePrintingFunction">
    529615                <exclude-pattern>/src/*</exclude-pattern>
    530616        </rule>
    531617
    532         <rule ref="WordPress.Security.EscapeOutput.OutputNotEscaped">
     618        <rule ref="WordPress.Security.NonceVerification.Missing">
    533619                <exclude-pattern>/src/*</exclude-pattern>
    534620        </rule>
    535621
    536         <rule ref="WordPress.Security.EscapeOutput.UnsafePrintingFunction">
     622        <rule ref="WordPress.Security.NonceVerification.Recommended">
    537623                <exclude-pattern>/src/*</exclude-pattern>
    538624        </rule>
    539625
    540         <rule ref="WordPress.Security.NonceVerification.Missing">
     626        <rule ref="WordPress.WP.AlternativeFunctions.json_encode_json_encode">
    541627                <exclude-pattern>/src/*</exclude-pattern>
    542628        </rule>
    543629
    544         <rule ref="WordPress.Security.NonceVerification.Recommended">
     630        <rule ref="WordPress.WP.AlternativeFunctions.parse_url_parse_url">
    545631                <exclude-pattern>/src/*</exclude-pattern>
    546632        </rule>
    547633
    548         <rule ref="WordPress.WhiteSpace.ControlStructureSpacing.ExtraSpaceAfterCloseParenthesis">
     634        <rule ref="WordPress.WP.AlternativeFunctions.rand_mt_rand">
    549635                <exclude-pattern>/src/*</exclude-pattern>
    550636        </rule>
    551637
    552         <rule ref="WordPress.WhiteSpace.ControlStructureSpacing.ExtraSpaceAfterOpenParenthesis">
     638        <rule ref="WordPress.WP.AlternativeFunctions.strip_tags_strip_tag">
    553639                <exclude-pattern>/src/*</exclude-pattern>
    554640        </rule>
    555641
    556         <rule ref="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterOpenParenthesis">
     642        <rule ref="WordPress.WP.AlternativeFunctions.strip_tags_strip_tags">
    557643                <exclude-pattern>/src/*</exclude-pattern>
    558644        </rule>
    559645
    560         <rule ref="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeCloseParenthesis">
     646        <rule ref="WordPress.WP.Capabilities.Unknown">
    561647                <exclude-pattern>/src/*</exclude-pattern>
    562648        </rule>
    563649
    564         <rule ref="WordPress.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed">
     650        <rule ref="WordPress.WP.DeprecatedParameters.Get_termsParam2Found">
    565651                <exclude-pattern>/src/*</exclude-pattern>
    566652        </rule>
    567653
    568         <rule ref="WordPress.WhiteSpace.OperatorSpacing.NoSpaceAfter">
     654        <rule ref="WordPress.WP.DeprecatedParameters.Wp_count_termsParam2Found">
    569655                <exclude-pattern>/src/*</exclude-pattern>
    570656        </rule>
    571657
    572         <rule ref="WordPress.WhiteSpace.OperatorSpacing.NoSpaceBefore">
     658        <rule ref="WordPress.WP.DiscouragedFunctions.query_posts_query_posts">
    573659                <exclude-pattern>/src/*</exclude-pattern>
    574660        </rule>
    575661
    576         <rule ref="WordPress.WhiteSpace.OperatorSpacing.SpacingAfter">
     662        <rule ref="WordPress.WP.DiscouragedFunctions.wp_reset_query_wp_reset_query">
    577663                <exclude-pattern>/src/*</exclude-pattern>
    578664        </rule>
    579665
    580         <rule ref="WordPress.WhiteSpace.OperatorSpacing.SpacingBefore">
     666        <rule ref="WordPress.WP.EnqueuedResourceParameters.NotInFooter">
    581667                <exclude-pattern>/src/*</exclude-pattern>
    582668        </rule>
    583669
    584         <rule ref="WordPress.WhiteSpace.PrecisionAlignment.Found">
     670        <rule ref="WordPress.WP.GlobalVariablesOverride.Prohibited">
    585671                <exclude-pattern>/src/*</exclude-pattern>
    586672        </rule>
    587673
    588         <rule ref="WordPress.WP.AlternativeFunctions.json_encode_json_encode">
     674        <rule ref="WordPress.WP.I18n.LowLevelTranslationFunction">
    589675                <exclude-pattern>/src/*</exclude-pattern>
    590676        </rule>
    591677
    592         <rule ref="WordPress.WP.AlternativeFunctions.parse_url_parse_url">
     678        <rule ref="WordPress.WP.I18n.MissingTranslatorsComment">
    593679                <exclude-pattern>/src/*</exclude-pattern>
    594680        </rule>
    595681
    596         <rule ref="WordPress.WP.AlternativeFunctions.rand_mt_rand">
     682        <rule ref="WordPress.WP.I18n.NonSingularStringLiteralText">
    597683                <exclude-pattern>/src/*</exclude-pattern>
    598684        </rule>
    599685
    600         <rule ref="WordPress.WP.AlternativeFunctions.strip_tags_strip_tags">
     686        <rule ref="WordPress.WP.PostsPerPage.posts_per_page_posts_per_page">
    601687                <exclude-pattern>/src/*</exclude-pattern>
    602688        </rule>
    603689
    604         <rule ref="WordPress.WP.DiscouragedFunctions.query_posts_query_posts">
     690        <rule ref="WordPress.WhiteSpace.ControlStructureSpacing.ExtraSpaceAfterOpenParenthesis">
    605691                <exclude-pattern>/src/*</exclude-pattern>
    606692        </rule>
    607693
    608         <rule ref="WordPress.WP.DiscouragedFunctions.wp_reset_query_wp_reset_query">
     694        <rule ref="WordPress.WhiteSpace.ControlStructureSpacing.ExtraSpaceBeforeCloseParenthesis">
    609695                <exclude-pattern>/src/*</exclude-pattern>
    610696        </rule>
    611697
    612         <rule ref="WordPress.WP.EnqueuedResourceParameters.NotInFooter">
     698        <rule ref="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterOpenParenthesis">
    613699                <exclude-pattern>/src/*</exclude-pattern>
    614700        </rule>
    615701
    616         <rule ref="WordPress.WP.GlobalVariablesOverride.Prohibited">
     702        <rule ref="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeCloseParenthesis">
    617703                <exclude-pattern>/src/*</exclude-pattern>
    618704        </rule>
    619705
    620         <rule ref="WordPress.WP.I18n.LowLevelTranslationFunction">
     706        <rule ref="WordPress.WhiteSpace.OperatorSpacing.NoSpaceAfter">
    621707                <exclude-pattern>/src/*</exclude-pattern>
    622708        </rule>
    623709
    624         <rule ref="WordPress.WP.I18n.MissingTranslatorsComment">
     710        <rule ref="WordPress.WhiteSpace.OperatorSpacing.NoSpaceBefore">
    625711                <exclude-pattern>/src/*</exclude-pattern>
    626712        </rule>
    627713
    628         <rule ref="WordPress.WP.I18n.NonSingularStringLiteralText">
     714        <rule ref="WordPress.WhiteSpace.OperatorSpacing.SpacingAfter">
    629715                <exclude-pattern>/src/*</exclude-pattern>
    630716        </rule>
    631717
     718        <rule ref="WordPress.WhiteSpace.OperatorSpacing.SpacingBefore">
     719                <exclude-pattern>/src/*</exclude-pattern>
     720        </rule>
     721       
    632722</ruleset>
  • src/includes/admin/classes/class-bbp-admin.php

    diff --git src/includes/admin/classes/class-bbp-admin.php src/includes/admin/classes/class-bbp-admin.php
    index 7b3b00b3..4316c10f 100644
    class BBP_Admin { 
    972972                /** Paths *************************************************************/
    973973
    974974                // Forum Archive
    975                 } elseif ( $post->post_name === bbp_get_root_slug() ) {
     975                } elseif ( bbp_get_root_slug() === $post->post_name ) {
    976976                        $retval[] = esc_html_x( 'Forum Archive', 'page label', 'bbpress' );
    977977
    978978                // Topic Archive
    979                 } elseif ( $post->post_name === bbp_get_topic_archive_slug() ) {
     979                } elseif ( bbp_get_topic_archive_slug() === $post->post_name ) {
    980980                        $retval[] = esc_html_x( 'Topic Archive', 'page label', 'bbpress' );
    981981                }
    982982
  • src/includes/admin/classes/class-bbp-converter-base.php

    diff --git src/includes/admin/classes/class-bbp-converter-base.php src/includes/admin/classes/class-bbp-converter-base.php
    index 989fcd34..ee93a622 100644
    abstract class BBP_Converter_Base { 
    472472
    473473                                                                // Translates a field from the old forum.
    474474                                                                } elseif ( isset( $row['callback_method'] ) ) {
    475                                                                         if ( ( $row['callback_method'] === 'callback_userid' ) && ( false === $this->convert_users ) ) {
     475                                                                        if ( ( 'callback_userid' === $row['callback_method'] ) && ( false === $this->convert_users ) ) {
    476476                                                                                $insert_postmeta[ $row['to_fieldname'] ] = $forum[ $row['from_fieldname'] ];
    477477                                                                        } else {
    478478                                                                                $insert_postmeta[ $row['to_fieldname'] ] = call_user_func_array( array( $this, $row['callback_method'] ), array( $forum[ $row['from_fieldname'] ], $forum ) );
    abstract class BBP_Converter_Base { 
    489489                                        /** Step 3 ************************************************/
    490490
    491491                                        // Something to insert into the destination field
    492                                         if ( count( $insert_post ) > 0 || ( $to_type == 'tags' && count( $insert_postmeta ) > 0 ) ) {
     492                                        if ( count( $insert_post ) > 0 || ( 'tags' === $to_type && count( $insert_postmeta ) > 0 ) ) {
    493493
    494494                                                switch ( $to_type ) {
    495495
  • src/includes/admin/converters/AEF.php

    diff --git src/includes/admin/converters/AEF.php src/includes/admin/converters/AEF.php
    index 4bebb486..abc29935 100644
    class AEF extends BBP_Converter_Base { 
    587587         */
    588588        public function authenticate_pass( $password, $serialized_pass ) {
    589589                $pass_array = unserialize( $serialized_pass );
    590                 return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) );
     590                return ( md5( md5( $password ). $pass_array['salt'] ) == $pass_array['hash'] );
    591591        }
    592592
    593593        /**
  • src/includes/admin/converters/Drupal7.php

    diff --git src/includes/admin/converters/Drupal7.php src/includes/admin/converters/Drupal7.php
    index 54d161ef..6dee1313 100644
    class Drupal7 extends BBP_Converter_Base { 
    585585         */
    586586        public function authenticate_pass( $password, $serialized_pass ) {
    587587                $pass_array = unserialize( $serialized_pass );
    588                 return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) );
     588                return ( md5( md5( $password ). $pass_array['salt'] ) == $pass_array['hash'] );
    589589        }
    590590
    591591        /**
  • src/includes/admin/converters/Example.php

    diff --git src/includes/admin/converters/Example.php src/includes/admin/converters/Example.php
    index 4b7c4ecf..df85490a 100644
    class Example extends BBP_Converter_Base { 
    706706         */
    707707        public function authenticate_pass( $password, $serialized_pass ) {
    708708                $pass_array = unserialize( $serialized_pass );
    709                 return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) );
     709                return ( md5( md5( $password ). $pass_array['salt'] ) == $pass_array['hash'] );
    710710        }
    711711}
  • src/includes/admin/converters/FluxBB.php

    diff --git src/includes/admin/converters/FluxBB.php src/includes/admin/converters/FluxBB.php
    index 58c5e97c..e9fe9376 100644
    class FluxBB extends BBP_Converter_Base { 
    608608         */
    609609        public function authenticate_pass( $password, $serialized_pass ) {
    610610                $pass_array = unserialize( $serialized_pass );
    611                 return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) );
     611                return ( md5( md5( $password ). $pass_array['salt'] ) == $pass_array['hash'] );
    612612        }
    613613
    614614        /**
  • src/includes/admin/converters/Invision.php

    diff --git src/includes/admin/converters/Invision.php src/includes/admin/converters/Invision.php
    index 56ae94bd..39ac6b60 100644
    class Invision extends BBP_Converter_Base { 
    482482         * @return string WordPress safe
    483483         */
    484484        public function callback_forum_type( $status = 0 ) {
    485                 if ( $status == -1 ) {
     485                if ( -1 == $status ) {
    486486                        $status = 'category';
    487487                } else {
    488488                        $status = 'forum';
    class Invision extends BBP_Converter_Base { 
    536536         */
    537537        public function authenticate_pass( $password, $serialized_pass ) {
    538538                $pass_array = unserialize( $serialized_pass );
    539                 return ( $pass_array['hash'] == md5( md5( $pass_array['salt'] ) . md5( $this->to_char( $password ) ) ) );
     539                return ( md5( md5( $pass_array['salt'] ) . md5( $this->to_char( $password ) ) ) == $pass_array['hash'] );
    540540        }
    541541
    542542        private function to_char( $input ) {
  • src/includes/admin/converters/Kunena1.php

    diff --git src/includes/admin/converters/Kunena1.php src/includes/admin/converters/Kunena1.php
    index de5bc88f..1c9e43ce 100644
    class Kunena1 extends BBP_Converter_Base { 
    463463         */
    464464        public function authenticate_pass($password, $serialized_pass) {
    465465                $pass_array = unserialize($serialized_pass);
    466                 return ( $pass_array['hash'] == md5(md5($password) . $pass_array['salt']) );
     466                return ( md5(md5($password) . $pass_array['salt']) == $pass_array['hash'] );
    467467        }
    468468
    469469        /**
    class Kunena1 extends BBP_Converter_Base { 
    473473         * @return string WordPress safe
    474474         */
    475475        public function callback_forum_type( $status = 0 ) {
    476                 if ( $status == 0 ) {
     476                if ( 0 == $status ) {
    477477                        $status = 'category';
    478478                } else {
    479479                        $status = 'forum';
  • src/includes/admin/converters/Kunena2.php

    diff --git src/includes/admin/converters/Kunena2.php src/includes/admin/converters/Kunena2.php
    index ebac4206..61d30cd5 100644
    class Kunena2 extends BBP_Converter_Base { 
    494494         */
    495495        public function authenticate_pass($password, $serialized_pass) {
    496496                $pass_array = unserialize($serialized_pass);
    497                 return ( $pass_array['hash'] == md5(md5($password) . $pass_array['salt']) );
     497                return ( md5(md5($password) . $pass_array['salt']) == $pass_array['hash'] );
    498498        }
    499499        /**
    500500         * Translate the forum type from Kunena v2.x numerics to WordPress's strings.
    class Kunena2 extends BBP_Converter_Base { 
    503503         * @return string WordPress safe
    504504         */
    505505        public function callback_forum_type( $status = 0 ) {
    506                 if ( $status == 0 ) {
     506                if ( 0 == $status ) {
    507507                        $status = 'category';
    508508                } else {
    509509                        $status = 'forum';
  • src/includes/admin/converters/Kunena3.php

    diff --git src/includes/admin/converters/Kunena3.php src/includes/admin/converters/Kunena3.php
    index 23bfbd11..4ac8ce75 100644
    class Kunena3 extends BBP_Converter_Base { 
    718718         */
    719719        public function authenticate_pass( $password, $serialized_pass ) {
    720720                $pass_array = unserialize( $serialized_pass );
    721                 return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) );
     721                return ( md5( md5( $password ). $pass_array['salt'] ) == $pass_array['hash'] );
    722722        }
    723723
    724724        /**
    class Kunena3 extends BBP_Converter_Base { 
    728728         * @return string WordPress safe
    729729         */
    730730        public function callback_forum_type( $status = 0 ) {
    731                 if ( $status == 0 ) {
     731                if ( 0 == $status ) {
    732732                        $status = 'category';
    733733                } else {
    734734                        $status = 'forum';
  • src/includes/admin/converters/MyBB.php

    diff --git src/includes/admin/converters/MyBB.php src/includes/admin/converters/MyBB.php
    index 4e22ab5c..8cd64de5 100644
    class MyBB extends BBP_Converter_Base { 
    534534         */
    535535        public function authenticate_pass( $password, $serialized_pass ) {
    536536                $pass_array = unserialize( $serialized_pass );
    537                 return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) );
     537                return ( md5( md5( $password ). $pass_array['salt'] ) == $pass_array['hash'] );
    538538        }
    539539
    540540        /**
  • src/includes/admin/converters/PHPFox3.php

    diff --git src/includes/admin/converters/PHPFox3.php src/includes/admin/converters/PHPFox3.php
    index 4626b395..ac4417ba 100644
    class PHPFox3 extends BBP_Converter_Base { 
    524524         */
    525525        public function authenticate_pass( $password, $serialized_pass ) {
    526526                $pass_array = unserialize( $serialized_pass );
    527                 return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) );
     527                return ( md5( md5( $password ). $pass_array['salt'] ) == $pass_array['hash'] );
    528528        }
    529529
    530530        /**
  • src/includes/admin/converters/PHPWind.php

    diff --git src/includes/admin/converters/PHPWind.php src/includes/admin/converters/PHPWind.php
    index e0419ce0..9ea19f01 100644
    class PHPWind extends BBP_Converter_Base { 
    504504         */
    505505        public function authenticate_pass( $password, $serialized_pass ) {
    506506                $pass_array = unserialize( $serialized_pass );
    507                 return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) );
     507                return ( md5( md5( $password ). $pass_array['salt'] ) == $pass_array['hash'] );
    508508        }
    509509
    510510        /**
  • src/includes/admin/converters/Phorum.php

    diff --git src/includes/admin/converters/Phorum.php src/includes/admin/converters/Phorum.php
    index 82a75adb..72cd7563 100644
    class Phorum extends BBP_Converter_Base { 
    534534         */
    535535        public function authenticate_pass( $password, $serialized_pass ) {
    536536                $pass_array = unserialize( $serialized_pass );
    537                 return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) );
     537                return ( md5( md5( $password ). $pass_array['salt'] ) == $pass_array['hash'] );
    538538        }
    539539
    540540        /**
  • src/includes/admin/converters/PunBB.php

    diff --git src/includes/admin/converters/PunBB.php src/includes/admin/converters/PunBB.php
    index 63712f07..76ce903c 100644
    class PunBB extends BBP_Converter_Base { 
    681681         */
    682682        public function authenticate_pass( $password, $serialized_pass ) {
    683683                $pass_array = unserialize( $serialized_pass );
    684                 return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) );
     684                return ( md5( md5( $password ). $pass_array['salt'] ) == $pass_array['hash'] );
    685685        }
    686686
    687687        /**
  • src/includes/admin/converters/SMF.php

    diff --git src/includes/admin/converters/SMF.php src/includes/admin/converters/SMF.php
    index 8e405683..46e8a293 100644
    class SMF extends BBP_Converter_Base { 
    676676         */
    677677        public function authenticate_pass( $password, $serialized_pass ) {
    678678                $pass_array = unserialize( $serialized_pass );
    679                 return ( $pass_array['hash'] === sha1( strtolower( $pass_array['username'] ) . $password ) ? true : false );
     679                return ( sha1( strtolower( $pass_array['username'] ) . $password ) === $pass_array['hash'] ? true : false );
    680680        }
    681681
    682682        /**
  • src/includes/admin/converters/Vanilla.php

    diff --git src/includes/admin/converters/Vanilla.php src/includes/admin/converters/Vanilla.php
    index 8f18b6b6..1021f16f 100644
    class Vanilla extends BBP_Converter_Base { 
    571571         * @return int
    572572         */
    573573        public function callback_forum_parent( $parent = 0 ) {
    574                 if ( $parent == -1 ) {
     574                if ( -1 == $parent ) {
    575575                        return 0;
    576576                } else {
    577577                        return $parent;
  • src/includes/admin/converters/XMB.php

    diff --git src/includes/admin/converters/XMB.php src/includes/admin/converters/XMB.php
    index eb1fdce0..9ece8d03 100644
    class XMB extends BBP_Converter_Base { 
    641641         */
    642642        public function authenticate_pass( $password, $serialized_pass ) {
    643643                $pass_array = unserialize( $serialized_pass );
    644                 return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) );
     644                return ( md5( md5( $password ). $pass_array['salt'] == $pass_array['hash'] ) );
    645645        }
    646646
    647647        /**
  • src/includes/admin/converters/XenForo.php

    diff --git src/includes/admin/converters/XenForo.php src/includes/admin/converters/XenForo.php
    index 834c5268..fb12b427 100644
    class XenForo extends BBP_Converter_Base { 
    699699                $pass_array = unserialize( $serialized_pass );
    700700                switch ( $pass_array['hashFunc'] ) {
    701701                        case 'sha256':
    702                                 return ( $pass_array['hash'] == hash( 'sha256', hash( 'sha256', $password ) . $pass_array['salt'] ) );
     702                                return ( hash( 'sha256', hash( 'sha256', $password ) . $pass_array['salt'] ) == $pass_array['hash'] );
    703703                        case 'sha1':
    704                                 return ( $pass_array['hash'] == sha1( sha1( $password ) . $pass_array['salt'] ) );
     704                                return ( sha1( sha1( $password ) . $pass_array['salt'] ) == $pass_array['hash'] );
    705705                }
    706706        }
    707707
  • src/includes/admin/converters/bbPress1.php

    diff --git src/includes/admin/converters/bbPress1.php src/includes/admin/converters/bbPress1.php
    index fe202662..8c455a45 100644
    class bbPress1 extends BBP_Converter_Base { 
    661661         * @return string WordPress safe
    662662         */
    663663        public function callback_forum_type( $status = 0 ) {
    664                 if ( $status == 1 ) {
     664                if ( 1 == $status ) {
    665665                        $status = 'category';
    666666                } else {
    667667                        $status = 'forum';
  • src/includes/admin/converters/e107v1.php

    diff --git src/includes/admin/converters/e107v1.php src/includes/admin/converters/e107v1.php
    index efc971a1..d4938e25 100644
    class e107v1 extends BBP_Converter_Base { 
    489489         */
    490490        public function authenticate_pass( $password, $serialized_pass ) {
    491491                $pass_array = unserialize( $serialized_pass );
    492                 return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) );
     492                return ( md5( md5( $password ). $pass_array['salt'] ) == $pass_array['hash'] );
    493493        }
    494494
    495495        /**
    class e107v1 extends BBP_Converter_Base { 
    499499         * @return string WordPress safe
    500500         */
    501501        public function callback_forum_type( $status = 0 ) {
    502                 if ( $status == 0 ) {
     502                if ( 0 == $status ) {
    503503                        $status = 'category';
    504504                } else {
    505505                        $status = 'forum';
  • src/includes/admin/converters/vBulletin.php

    diff --git src/includes/admin/converters/vBulletin.php src/includes/admin/converters/vBulletin.php
    index d2664745..55fcb977 100644
    class vBulletin extends BBP_Converter_Base { 
    651651         */
    652652        public function authenticate_pass( $password, $serialized_pass ) {
    653653                $pass_array = unserialize( $serialized_pass );
    654                 return ( $pass_array['hash'] == md5( md5( $password ) . $pass_array['salt'] ) );
     654                return ( md5( md5( $password ) . $pass_array['salt'] ) == $pass_array['hash'] );
    655655        }
    656656
    657657        /**
    class vBulletin extends BBP_Converter_Base { 
    661661         * @return string WordPress safe
    662662         */
    663663        public function callback_forum_type( $status = 0 ) {
    664                 if ( $status == -1 ) {
     664                if ( -1 == $status ) {
    665665                        $status = 'category';
    666666                } else {
    667667                        $status = 'forum';
  • src/includes/admin/converters/vBulletin3.php

    diff --git src/includes/admin/converters/vBulletin3.php src/includes/admin/converters/vBulletin3.php
    index e325bac1..d80e84f8 100644
    class vBulletin3 extends BBP_Converter_Base { 
    655655         */
    656656        public function authenticate_pass( $password, $serialized_pass ) {
    657657                $pass_array = unserialize( $serialized_pass );
    658                 return ( $pass_array['hash'] == md5( md5( $password ) . $pass_array['salt'] ) );
     658                return ( md5( md5( $password ) . $pass_array['salt'] ) == $pass_array['hash'] );
    659659        }
    660660
    661661        /**
    class vBulletin3 extends BBP_Converter_Base { 
    665665         * @return string WordPress safe
    666666         */
    667667        public function callback_forum_type( $status = 0 ) {
    668                 if ( $status == -1 ) {
     668                if ( -1 == $status ) {
    669669                        $status = 'category';
    670670                } else {
    671671                        $status = 'forum';
  • src/includes/admin/forums.php

    diff --git src/includes/admin/forums.php src/includes/admin/forums.php
    index 54ad64e6..965380ff 100644
    class BBP_Forums_Admin { 
    447447
    448448                switch ( $notice ) {
    449449                        case 'opened' :
    450                                 $message = ( $is_failure === true )
     450                                $message = ( true === $is_failure )
    451451                                        ? sprintf( esc_html__( 'There was a problem opening the forum "%1$s".', 'bbpress' ), $forum_title )
    452452                                        : sprintf( esc_html__( 'Forum "%1$s" successfully opened.',             'bbpress' ), $forum_title );
    453453                                break;
    454454
    455455                        case 'closed' :
    456                                 $message = ( $is_failure === true )
     456                                $message = ( true === $is_failure )
    457457                                        ? sprintf( esc_html__( 'There was a problem closing the forum "%1$s".', 'bbpress' ), $forum_title )
    458458                                        : sprintf( esc_html__( 'Forum "%1$s" successfully closed.',             'bbpress' ), $forum_title );
    459459                                break;
    class BBP_Forums_Admin { 
    461461
    462462                // Do additional forum toggle notice filters (admin side)
    463463                $message = apply_filters( 'bbp_toggle_forum_notice_admin', $message, $forum_id, $notice, $is_failure );
    464                 $class   = ( $is_failure === true )
     464                $class   = ( true === $is_failure )
    465465                        ? 'error'
    466466                        : 'updated';
    467467
  • src/includes/admin/replies.php

    diff --git src/includes/admin/replies.php src/includes/admin/replies.php
    index c294373e..250797db 100644
    class BBP_Replies_Admin { 
    421421                // Get reply author data
    422422                $anonymous_data = bbp_filter_anonymous_post_data();
    423423                $author_id      = bbp_get_reply_author_id( $reply_id );
    424                 $is_edit        = ( isset( $_POST['hidden_post_status'] ) && ( $_POST['hidden_post_status'] !== 'draft' ) );
     424                $is_edit        = ( isset( $_POST['hidden_post_status'] ) && ( 'draft' !== $_POST['hidden_post_status'] ) );
    425425
    426426                // Formally update the reply
    427427                bbp_update_reply( $reply_id, $topic_id, $forum_id, $anonymous_data, $author_id, $is_edit, $reply_to );
    class BBP_Replies_Admin { 
    558558
    559559                switch ( $notice ) {
    560560                        case 'spammed' :
    561                                 $message = ( $is_failure === true )
     561                                $message = ( true === $is_failure )
    562562                                        ? sprintf( esc_html__( 'There was a problem marking the reply "%1$s" as spam.', 'bbpress' ), $reply_title )
    563563                                        : sprintf( esc_html__( 'Reply "%1$s" successfully marked as spam.',             'bbpress' ), $reply_title );
    564564                                break;
    565565
    566566                        case 'unspammed' :
    567                                 $message = ( $is_failure === true )
     567                                $message = ( true === $is_failure )
    568568                                        ? sprintf( esc_html__( 'There was a problem unmarking the reply "%1$s" as spam.', 'bbpress' ), $reply_title )
    569569                                        : sprintf( esc_html__( 'Reply "%1$s" successfully unmarked as spam.',             'bbpress' ), $reply_title );
    570570                                break;
    571571
    572572                        case 'approved' :
    573                                 $message = ( $is_failure === true )
     573                                $message = ( true === $is_failure )
    574574                                        ? sprintf( esc_html__( 'There was a problem approving the reply "%1$s".', 'bbpress' ), $reply_title )
    575575                                        : sprintf( esc_html__( 'Reply "%1$s" successfully approved.',             'bbpress' ), $reply_title );
    576576                                break;
    577577
    578578                        case 'unapproved' :
    579                                 $message = ( $is_failure === true )
     579                                $message = ( true === $is_failure )
    580580                                        ? sprintf( esc_html__( 'There was a problem unapproving the reply "%1$s".', 'bbpress' ), $reply_title )
    581581                                        : sprintf( esc_html__( 'Reply "%1$s" successfully unapproved.',             'bbpress' ), $reply_title );
    582582                                break;
    class BBP_Replies_Admin { 
    584584
    585585                // Do additional reply toggle notice filters (admin side)
    586586                $message = apply_filters( 'bbp_toggle_reply_notice_admin', $message, $reply_id, $notice, $is_failure );
    587                 $class   = ( $is_failure === true )
     587                $class   = ( true === $is_failure )
    588588                        ? 'error'
    589589                        : 'updated';
    590590
  • src/includes/admin/tools/repair.php

    diff --git src/includes/admin/tools/repair.php src/includes/admin/tools/repair.php
    index 4504edfc..4638e7cd 100644
    function bbp_admin_repair_sticky() { 
    10661066
    10671067                        // If the topic is not a super sticky, and the forum ID does not
    10681068                        // match the topic's forum ID, unset the forum's sticky meta.
    1069                         if ( ! bbp_is_topic_super_sticky( $topic_id ) && ( $forum_id !== bbp_get_topic_forum_id( $topic_id ) ) ) {
     1069                        if ( ! bbp_is_topic_super_sticky( $topic_id ) && ( bbp_get_topic_forum_id( $topic_id ) ) !== $forum_id ) {
    10701070                                unset( $forum_stickies[ $forum_id ][ $id ] );
    10711071                        }
    10721072                }
  • src/includes/admin/topics.php

    diff --git src/includes/admin/topics.php src/includes/admin/topics.php
    index def70dd2..8fcc27aa 100644
    class BBP_Topics_Admin { 
    538538                // Get topic author data
    539539                $anonymous_data = bbp_filter_anonymous_post_data();
    540540                $author_id      = bbp_get_topic_author_id( $topic_id );
    541                 $is_edit        = ( isset( $_POST['hidden_post_status'] ) && ( $_POST['hidden_post_status'] !== 'draft' ) );
     541                $is_edit        = ( isset( $_POST['hidden_post_status'] ) && ( 'draft' !== $_POST['hidden_post_status'] ) );
    542542
    543543                // Formally update the topic
    544544                bbp_update_topic( $topic_id, $forum_id, $anonymous_data, $author_id, $is_edit );
    class BBP_Topics_Admin { 
    709709                // Which notice?
    710710                switch ( $notice ) {
    711711                        case 'opened'    :
    712                                 $message = ( $is_failure === true )
     712                                $message = ( true === $is_failure )
    713713                                        ? sprintf( esc_html__( 'There was a problem opening the topic "%1$s".', 'bbpress' ), $topic_title )
    714714                                        : sprintf( esc_html__( 'Topic "%1$s" successfully opened.',             'bbpress' ), $topic_title );
    715715                                break;
    716716
    717717                        case 'closed'    :
    718                                 $message = ( $is_failure === true )
     718                                $message = ( true === $is_failure )
    719719                                        ? sprintf( esc_html__( 'There was a problem closing the topic "%1$s".', 'bbpress' ), $topic_title )
    720720                                        : sprintf( esc_html__( 'Topic "%1$s" successfully closed.',             'bbpress' ), $topic_title );
    721721                                break;
    722722
    723723                        case 'super_sticky' :
    724                                 $message = ( $is_failure === true )
     724                                $message = ( true ===  $is_failure )
    725725                                        ? sprintf( esc_html__( 'There was a problem sticking the topic "%1$s" to front.', 'bbpress' ), $topic_title )
    726726                                        : sprintf( esc_html__( 'Topic "%1$s" successfully stuck to front.',               'bbpress' ), $topic_title );
    727727                                break;
    728728
    729729                        case 'stuck'   :
    730                                 $message = ( $is_failure === true )
     730                                $message = ( true === $is_failure )
    731731                                        ? sprintf( esc_html__( 'There was a problem sticking the topic "%1$s".', 'bbpress' ), $topic_title )
    732732                                        : sprintf( esc_html__( 'Topic "%1$s" successfully stuck.',               'bbpress' ), $topic_title );
    733733                                break;
    734734
    735735                        case 'unstuck' :
    736                                 $message = ( $is_failure === true )
     736                                $message = ( true === $is_failure )
    737737                                        ? sprintf( esc_html__( 'There was a problem unsticking the topic "%1$s".', 'bbpress' ), $topic_title )
    738738                                        : sprintf( esc_html__( 'Topic "%1$s" successfully unstuck.',               'bbpress' ), $topic_title );
    739739                                break;
    740740
    741741                        case 'spammed'   :
    742                                 $message = ( $is_failure === true )
     742                                $message = ( true === $is_failure )
    743743                                        ? sprintf( esc_html__( 'There was a problem marking the topic "%1$s" as spam.', 'bbpress' ), $topic_title )
    744744                                        : sprintf( esc_html__( 'Topic "%1$s" successfully marked as spam.',             'bbpress' ), $topic_title );
    745745                                break;
    746746
    747747                        case 'unspammed' :
    748                                 $message = ( $is_failure === true )
     748                                $message = ( true === $is_failure )
    749749                                        ? sprintf( esc_html__( 'There was a problem unmarking the topic "%1$s" as spam.', 'bbpress' ), $topic_title )
    750750                                        : sprintf( esc_html__( 'Topic "%1$s" successfully unmarked as spam.',             'bbpress' ), $topic_title );
    751751                                break;
    752752
    753753                        case 'approved'   :
    754                                 $message = ( $is_failure === true )
     754                                $message = ( true === $is_failure )
    755755                                        ? sprintf( esc_html__( 'There was a problem approving the topic "%1$s".', 'bbpress' ), $topic_title )
    756756                                        : sprintf( esc_html__( 'Topic "%1$s" successfully approved.',             'bbpress' ), $topic_title );
    757757                                break;
    758758
    759759                        case 'unapproved' :
    760                                 $message = ( $is_failure === true )
     760                                $message = ( true === $is_failure )
    761761                                        ? sprintf( esc_html__( 'There was a problem unapproving the topic "%1$s".', 'bbpress' ), $topic_title )
    762762                                        : sprintf( esc_html__( 'Topic "%1$s" successfully unapproved.',             'bbpress' ), $topic_title );
    763763                                break;
    class BBP_Topics_Admin { 
    765765
    766766                // Do additional topic toggle notice filters (admin side)
    767767                $message = apply_filters( 'bbp_toggle_topic_notice_admin', $message, $topic_id, $notice, $is_failure );
    768                 $class   = ( $is_failure === true )
     768                $class   = ( true === $is_failure )
    769769                        ? 'error'
    770770                        : 'updated';
    771771
  • src/includes/common/formatting.php

    diff --git src/includes/common/formatting.php src/includes/common/formatting.php
    index 0f9ff4f1..746f89c1 100644
    function bbp_make_clickable( $text = '' ) { 
    368368                        $nested_code_pre--;
    369369                }
    370370
    371                 if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {
     371                if ( $nested_code_pre || empty( $piece ) || ( '<' === $piece[0] && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {
    372372                        $r .= $piece;
    373373                        continue;
    374374                }
  • src/includes/common/locks.php

    diff --git src/includes/common/locks.php src/includes/common/locks.php
    index 49558e86..0d3945fb 100644
    function bbp_check_post_lock( $post_id = 0 ) { 
    4343        $time_window = apply_filters( 'bbp_check_post_lock_window', 3 * MINUTE_IN_SECONDS );
    4444
    4545        // Return user who is or last edited
    46         if ( ! empty( $time ) && ( $time > ( time() - $time_window ) ) && ( $user !== bbp_get_current_user_id() ) ) {
     46        if ( ! empty( $time ) && ( $time > ( time() - $time_window ) ) && ( bbp_get_current_user_id() ) !== $user ) {
    4747                return (int) $user;
    4848        }
    4949
  • src/includes/common/template.php

    diff --git src/includes/common/template.php src/includes/common/template.php
    index 12467827..9babd75e 100644
    function bbp_is_forum_edit() { 
    193193        $wp_query = bbp_get_wp_query();
    194194
    195195        // Check query
    196         if ( ! empty( $wp_query->bbp_is_forum_edit ) && ( $wp_query->bbp_is_forum_edit === true ) ) {
     196        if ( ! empty( $wp_query->bbp_is_forum_edit ) && ( true === $wp_query->bbp_is_forum_edit ) ) {
    197197                $retval = true;
    198198
    199199        // Editing in admin
    function bbp_is_topic_edit() { 
    291291        $wp_query = bbp_get_wp_query();
    292292
    293293        // Check query
    294         if ( ! empty( $wp_query->bbp_is_topic_edit ) && ( $wp_query->bbp_is_topic_edit === true ) ) {
     294        if ( ! empty( $wp_query->bbp_is_topic_edit ) && ( true === $wp_query->bbp_is_topic_edit ) ) {
    295295                $retval = true;
    296296
    297297        // Editing in admin
    function bbp_is_edit() { 
    948948        $wp_query = bbp_get_wp_query();
    949949
    950950        // Check query
    951         if ( ! empty( $wp_query->bbp_is_edit ) && ( $wp_query->bbp_is_edit === true ) ) {
     951        if ( ! empty( $wp_query->bbp_is_edit ) && ( true === $wp_query->bbp_is_edit ) ) {
    952952                $retval = true;
    953953        }
    954954
    function bbp_breadcrumb( $args = array() ) { 
    23082308                }
    23092309
    23102310                // Don't show root if viewing page in place of forum archive
    2311                 if ( ! empty( $root_id ) && ( ( is_single() || is_page() ) && ( $root_id === get_the_ID() ) ) ) {
     2311                if ( ! empty( $root_id ) && ( ( is_single() || is_page() ) && ( get_the_ID() === $root_id ) ) ) {
    23122312                        $pre_include_root = false;
    23132313                }
    23142314
  • src/includes/core/abstraction.php

    diff --git src/includes/core/abstraction.php src/includes/core/abstraction.php
    index 25f54a4e..8945bbc0 100644
    function bbp_maybe_intercept( $action = '', $args = array() ) { 
    471471        $filtered = call_user_func_array( 'apply_filters', $args );
    472472
    473473        // Return filtered value, or default if not intercepted
    474         return ( $filtered === reset( $r ) )
     474        return ( reset( $r ) === $filtered )
    475475                ? $default
    476476                : $filtered;
    477477}
  • src/includes/core/update.php

    diff --git src/includes/core/update.php src/includes/core/update.php
    index 7b2997ec..bd331649 100644
    function bbp_is_activation( $basename = '' ) { 
    6868        }
    6969
    7070        // The plugin(s) being activated
    71         if ( $action === 'activate' ) {
     71        if ( 'activate' === $action ) {
    7272                $plugins = isset( $_GET['plugin'] ) ? array( $_GET['plugin'] ) : array();
    7373        } else {
    7474                $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
    function bbp_is_deactivation( $basename = '' ) { 
    118118        }
    119119
    120120        // The plugin(s) being deactivated
    121         if ( $action === 'deactivate' ) {
     121        if ( 'deactivate' === $action ) {
    122122                $plugins = isset( $_GET['plugin'] ) ? array( $_GET['plugin'] ) : array();
    123123        } else {
    124124                $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
  • src/includes/extend/akismet.php

    diff --git src/includes/extend/akismet.php src/includes/extend/akismet.php
    index 1617ae6a..bcd05c78 100644
    class BBP_Akismet { 
    595595                                }
    596596
    597597                                // Normal result: true
    598                                 if ( ! empty( $this->last_post['bbp_akismet_result'] ) && ( $this->last_post['bbp_akismet_result'] === 'true' ) ) {
     598                                if ( ! empty( $this->last_post['bbp_akismet_result'] ) && ( 'true' === $this->last_post['bbp_akismet_result'] ) ) {
    599599
    600600                                        // Leave a trail so other's know what we did
    601601                                        update_post_meta( $post_id, '_bbp_akismet_result', 'true' );
    class BBP_Akismet { 
    618618                                        }
    619619
    620620                                // Normal result: false
    621                                 } elseif ( ! empty( $this->last_post['bbp_akismet_result'] ) && ( $this->last_post['bbp_akismet_result'] === 'false' ) ) {
     621                                } elseif ( ! empty( $this->last_post['bbp_akismet_result'] ) && ( 'false' === $this->last_post['bbp_akismet_result'] ) ) {
    622622
    623623                                        // Leave a trail so other's know what we did
    624624                                        update_post_meta( $post_id, '_bbp_akismet_result', 'false' );
  • src/includes/forums/functions.php

    diff --git src/includes/forums/functions.php src/includes/forums/functions.php
    index fa54e9d8..a459410f 100644
    function bbp_new_forum_handler( $action = '' ) { 
    292292
    293293                // If the forum is trash, or the forum_status is switched to
    294294                // trash, trash it properly
    295                 if ( ( get_post_field( 'post_status', $forum_id ) === bbp_get_trash_status_id() ) || ( $forum_data['post_status'] === bbp_get_trash_status_id() ) ) {
     295                if ( ( get_post_field( 'post_status', $forum_id ) === bbp_get_trash_status_id() ) || ( bbp_get_trash_status_id() === $forum_data['post_status'] ) ) {
    296296
    297297                        // Trash the reply
    298298                        wp_trash_post( $forum_id );
    function bbp_new_forum_handler( $action = '' ) { 
    304304                /** Spam Check ********************************************************/
    305305
    306306                // If reply or forum are spam, officially spam this reply
    307                 if ( $forum_data['post_status'] === bbp_get_spam_status_id() ) {
     307                if ( bbp_get_spam_status_id() === $forum_data['post_status'] ) {
    308308                        add_post_meta( $forum_id, '_bbp_spam_meta_status', bbp_get_public_status_id() );
    309309
    310310                        // Force view=all
  • src/includes/forums/template.php

    diff --git src/includes/forums/template.php src/includes/forums/template.php
    index a9eefdca..20316b92 100644
    function bbp_get_forum( $forum, $output = OBJECT, $filter = 'raw' ) { 
    293293        }
    294294
    295295        // Bail if not correct post type
    296         if ( $forum->post_type !== bbp_get_forum_post_type() ) {
     296        if (  bbp_get_forum_post_type() !== $forum->post_type ) {
    297297                return null;
    298298        }
    299299
    function bbp_get_forum( $forum, $output = OBJECT, $filter = 'raw' ) { 
    301301        $retval = $forum;
    302302
    303303        // Array A
    304         if ( $output === ARRAY_A ) {
     304        if ( ARRAY_A === $output ) {
    305305                $retval = get_object_vars( $forum );
    306306
    307307        // Array N
    308         } elseif ( $output === ARRAY_N ) {
     308        } elseif ( ARRAY_N === $output ) {
    309309                $retval = array_values( get_object_vars( $forum ) );
    310310        }
    311311
    function bbp_is_forum_status( $forum_id, $status_name, $check_ancestors = true, 
    15991599                                }
    16001600
    16011601                                // Break when it reach the max count
    1602                                 if ( ( $operator === 'OR' ) && ( $count >= 1 ) ) {
     1602                                if ( ( 'OR' === $operator ) && ( $count >= 1 ) ) {
    16031603                                        break;
    16041604                                }
    16051605                        }
    function bbp_is_forum_visibility( $forum_id, $status_name, $check_ancestors = tr 
    17361736                                }
    17371737
    17381738                                // Break when it reach the max count
    1739                                 if ( ( $operator === 'OR' ) && ( $count >= 1 ) ) {
     1739                                if ( ( 'OR' === $operator ) && ( $count >= 1 ) ) {
    17401740                                        break;
    17411741                                }
    17421742                        }
  • src/includes/replies/functions.php

    diff --git src/includes/replies/functions.php src/includes/replies/functions.php
    index 220d6380..55180be5 100644
    function bbp_new_reply_handler( $action = '' ) { 
    412412
    413413                // If this reply starts as trash, add it to pre_trashed_replies
    414414                // for the topic, so it is properly restored.
    415                 if ( bbp_is_topic_trash( $topic_id ) || ( $reply_data['post_status'] === bbp_get_trash_status_id() ) ) {
     415                if ( bbp_is_topic_trash( $topic_id ) || ( bbp_get_trash_status_id() === $reply_data['post_status'] ) ) {
    416416
    417417                        // Trash the reply
    418418                        wp_trash_post( $reply_id );
    function bbp_new_reply_handler( $action = '' ) { 
    438438                /** Spam Check ********************************************************/
    439439
    440440                // If reply or topic are spam, officially spam this reply
    441                 } elseif ( bbp_is_topic_spam( $topic_id ) || ( $reply_data['post_status'] === bbp_get_spam_status_id() ) ) {
     441                } elseif ( bbp_is_topic_spam( $topic_id ) || ( bbp_get_spam_status_id() === $reply_data['post_status'] ) ) {
    442442                        add_post_meta( $reply_id, '_bbp_spam_meta_status', bbp_get_public_status_id() );
    443443
    444444                        // Only add to pre-spammed array if topic is spam
    function bbp_edit_reply_handler( $action = '' ) { 
    579579        $forum_id = bbp_get_topic_forum_id( $topic_id );
    580580
    581581        // Forum exists
    582         if ( ! empty( $forum_id ) && ( $forum_id !== bbp_get_reply_forum_id( $reply_id ) ) ) {
     582        if ( ! empty( $forum_id ) && ( bbp_get_reply_forum_id( $reply_id ) !== $forum_id ) ) {
    583583
    584584                // Forum is a category
    585585                if ( bbp_is_forum_category( $forum_id ) ) {
  • src/includes/replies/template.php

    diff --git src/includes/replies/template.php src/includes/replies/template.php
    index 0d12854d..f95dd95b 100644
    function bbp_get_reply( $reply, $output = OBJECT, $filter = 'raw' ) { 
    366366        }
    367367
    368368        // Bail if not correct post type
    369         if ( $reply->post_type !== bbp_get_reply_post_type() ) {
     369        if ( bbp_get_reply_post_type() !== $reply->post_type ) {
    370370                return null;
    371371        }
    372372
    function bbp_get_reply( $reply, $output = OBJECT, $filter = 'raw' ) { 
    374374        $retval = $reply;
    375375
    376376        // Array A
    377         if ( $output === ARRAY_A ) {
     377        if ( ARRAY_A === $output ) {
    378378                $retval = get_object_vars( $reply );
    379379
    380380        // Array N
    381         } elseif ( $output === ARRAY_N ) {
     381        } elseif ( ARRAY_N === $output ) {
    382382                $retval = array_values( get_object_vars( $reply ) );
    383383        }
    384384
  • src/includes/topics/functions.php

    diff --git src/includes/topics/functions.php src/includes/topics/functions.php
    index 823b6acf..0e241bb8 100644
    function bbp_new_topic_handler( $action = '' ) { 
    342342                /** Close Check *******************************************************/
    343343
    344344                // If the topic is closed, close it properly
    345                 if ( ( get_post_field( 'post_status', $topic_id ) === bbp_get_closed_status_id() ) || ( $topic_data['post_status'] === bbp_get_closed_status_id() ) ) {
     345                if ( ( get_post_field( 'post_status', $topic_id ) === bbp_get_closed_status_id() ) || bbp_get_closed_status_id() === ( $topic_data['post_status'] ) ) {
    346346
    347347                        // Close the topic
    348348                        bbp_close_topic( $topic_id );
    function bbp_new_topic_handler( $action = '' ) { 
    352352
    353353                // If the forum is trash, or the topic_status is switched to
    354354                // trash, trash the topic properly
    355                 if ( ( get_post_field( 'post_status', $forum_id ) === bbp_get_trash_status_id() ) || ( $topic_data['post_status'] === bbp_get_trash_status_id() ) ) {
     355                if ( ( get_post_field( 'post_status', $forum_id ) === bbp_get_trash_status_id() ) || bbp_get_trash_status_id() === ( $topic_data['post_status'] ) ) {
    356356
    357357                        // Trash the topic
    358358                        wp_trash_post( $topic_id );
    function bbp_new_topic_handler( $action = '' ) { 
    364364                /** Spam Check ********************************************************/
    365365
    366366                // If the topic is spam, officially spam this topic
    367                 if ( $topic_data['post_status'] === bbp_get_spam_status_id() ) {
     367                if ( bbp_get_spam_status_id() === $topic_data['post_status'] ) {
    368368                        add_post_meta( $topic_id, '_bbp_spam_meta_status', bbp_get_public_status_id() );
    369369
    370370                        // Force view=all
  • src/includes/topics/template.php

    diff --git src/includes/topics/template.php src/includes/topics/template.php
    index 19db3504..c4edafb6 100644
    function bbp_get_topic( $topic, $output = OBJECT, $filter = 'raw' ) { 
    522522        }
    523523
    524524        // Bail if not correct post type
    525         if ( $topic->post_type !== bbp_get_topic_post_type() ) {
     525        if ( bbp_get_topic_post_type() !== $topic->post_type ) {
    526526                return null;
    527527        }
    528528
    function bbp_get_topic( $topic, $output = OBJECT, $filter = 'raw' ) { 
    530530        $retval = $topic;
    531531
    532532        // Array A
    533         if ( $output === ARRAY_A ) {
     533        if ( ARRAY_A === $output ) {
    534534                $retval = get_object_vars( $topic );
    535535
    536536        // Array N
    537         } elseif ( $output === ARRAY_N ) {
     537        } elseif ( ARRAY_N === $output ) {
    538538                $retval = array_values( get_object_vars( $topic ) );
    539539        }
    540540
  • src/includes/users/template.php

    diff --git src/includes/users/template.php src/includes/users/template.php
    index 965c4318..65b1e8a1 100644
    class BBP_User_Query extends WP_User_Query { 
    100100                $this->in_the_loop = true;
    101101
    102102                // loop has just started
    103                 if ( $this->current_user === -1 ) {
     103                if ( -1 === $this->current_user ) {
    104104
    105105                        /**
    106106                         * Fires once the loop is started.