4.0.0beta1 #1091
Closed
jrfnl
announced in
Announcements
4.0.0beta1
#1091
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Added
extend="true"on an property tag for setting an array value could already extend a property value set elsewhere in an (inluded) ruleset.Tokens::NAME_TOKENScontaining an array with the tokens used for identifier names. #3041Generic.WhiteSpace.GotoTargetSpacingto enforce no space between the label of agototarget and the colon following it. #1026-d option[=value]or via the ruleset with<ini name=...>. #416Changed
PEARtoPSR12.phpcsas well asphpcbfwill now exit with exit code 0 if no issues were found/remain after fixing. #184ignore_non_auto_fixable_on_exitconfig flag to1.--report-filefunctionality remains untouched.--extensionscommand line argument no longer accepts the tokenizer along with the extension. [#2448][sq-2448].modulefiles as PHP files using--extensions=module/php.--extensions=module.<config>directives will be applied based on the nesting level of the ruleset. #2197<config>directive set in an included ruleset from the "root" ruleset.<config>directives set in the "root" ruleset will always "win" over directives in included rulesets.<arg>directives will be applied based on the nesting level of the ruleset. #2395, #2597, #2602<arg>directive set in an included ruleset from the "root" ruleset.<arg>directives set in the "root" ruleset will always "win" over directives in included rulesets.--sniffsCLI argument is used. #98File::getDeclarationName()method will no longer acceptT_ANON_CLASSorT_CLOSUREtokens. #3766RuntimeExceptionwill be thrown if these tokens are passed.File::getDeclarationName()method will now always return a string (or throw an Exception). #1007nullif the name could not be determined, like during live coding.Now it will return an empty string in those situations.
File::getMemberProperties()method will no longer add warnings about possible parse errors. #2455Internal.ParseError.InterfaceHasMemberVarand theInternal.ParseError.EnumHasMemberVarerror codes have been removed.RuntimeExceptionfor properties declared in enums (parse error).Generic.PHP.Syntaxsniff or a dedicated linter instead.Squiz.Classes.ValidClassName.NotCamelCapshas been changed toSquiz.Classes.ValidClassName.NotPascalCase. #2046ClassNameand notclassName.Squiz.PHP.Heredoc.NotAllowedhas been replaced bySquiz.PHP.Heredoc.HeredocNotAllowedandSquiz.PHP.Heredoc.NowdocNotAllowed. #2318PSR12.Files.FileHeadersniff now has more modular error codes to allow for more selectively applying the rules. #2729 #3453PSR12.Files.FileHeader.SpacingAfterBlockerror code is replaced by:PSR12.Files.FileHeader.SpacingAfterTagBlockPSR12.Files.FileHeader.SpacingAfterDocblockBlockPSR12.Files.FileHeader.SpacingAfterDeclareBlockPSR12.Files.FileHeader.SpacingAfterNamespaceBlockPSR12.Files.FileHeader.SpacingAfterUseBlockPSR12.Files.FileHeader.SpacingAfterUseFunctionBlockPSR12.Files.FileHeader.SpacingAfterUseConstBlockPSR12.Files.FileHeader.SpacingInsideBlockerror code is replaced by:PSR12.Files.FileHeader.SpacingInsideUseBlockPSR12.Files.FileHeader.SpacingInsideUseFunctionBlockPSR12.Files.FileHeader.SpacingInsideUseConstBlockSquiz.Commenting.VariableComment.TagNotAllowedhas been replaced by a dynamicSquiz.Commenting.VariableComment.[TagName]TagNotAllowederror code. #1039@linktags in property docblocks, exclude theSquiz.Commenting.VariableComment.LinkTagNotAllowederror code.External sniffs which extend one of these sniffs may need adjustment if they want to retain the old behaviour.
T_STRINGandT_NS_SEPARATOR.T_NAME_FULLY_QUALIFIED,T_NAME_RELATIVE, andT_NAME_QUALIFIEDinstead.T_STRINGandT_NS_SEPARATORtokens to look for namespaced names will need to be modified.Tokens::FUNCTION_NAME_TOKENS/Tokens::$functionNameTokensarray now includes the identifier name tokens.parenthesis_owner,parenthesis_openerandparenthesis_closerarray indexes.statickeyword when preceded byinstanceofwill now be tokenized (again) asT_STATIC. #22T_STRING.T_OPEN_TAGtokens will no longer contain any whitespace. #593T_WHITESPACEtoken.T_GOTO_LABELtokens will no longer include the colon following it. #185T_GOTO_COLON.gotostatement will now be tokenized asT_STRINGto prevent confusing sniffs. #185T_DOC_COMMENT_*tokens now have thecomment_openerandcomment_closerindexes set. #484Tokens::FUNCTION_NAME_TOKENS/Tokens::$functionNameTokensarray now includes theT_ANON_CLASStoken. #47trueandfalsewill now always be set to a boolean value, independently of the case in which the value was provided.nullwill now be set to an actualnullvalue. Previously, the sniff property would have been set to string'null'.PHP_CodeSniffer\Config::setConfigData()method is no longer static. #2675private)Config::$overriddenDefaultsproperty is also no longer static.PHP_CodeSniffer\Config::setSettings()method is now avoidmethod. #1001DummyFile::setErrorCounts()method has changed and now expects the following parameters:$errorCount, $warningCount, $fixableErrorCount, $fixableWarningCount, $fixedErrorCount, $fixedWarningCount. #1079Generatorclasses will now throw aPHP_CodeSniffer\Exceptions\GeneratorExceptionwhen encountering errors in the documentation XML. #1072PHP_CodeSniffer\Generators\HTML::STYLESHEET,PHP_CodeSniffer\Util\Timing::MINUTE_IN_MSandPHP_CodeSniffer\Util\Timing::SECOND_IN_MSclass constants are no longerpublic. #1051PHP_CodeSniffer\Util\Timingclass is nowfinaland marked as an internal class. #1074PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTestwithPHP_CodeSniffer\Tests\Standards\AbstractSniffTestCase.PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTestwithPHP_CodeSniffer\Tests\Core\AbstractMethodTestCase.AbstractSniffTestCasefor which no test case files (.incfiles) can be found, will now be marked as "incomplete". #998inc) which would be changed by the sniff under test if running the fixer, are now required to be accompanied by a*.fixedfile. #300Deprecated
Tokensclass. Use the corresponding class constants on the Tokens class instead. #500PHP_CodeSniffer\Util\Common::$allowedTypes. UsePHP_CodeSniffer\Util\Common::ALLOWED_TYPESinstead. #1043PHP_CodeSniffer\Tokenizers\PHP::$tstringContexts. UsePHP_CodeSniffer\Tokenizers\PHP::T_STRING_CONTEXTSinstead. #1043PHP_CodeSniffer\Sniffs\AbstractVariableSniff::$phpReservedVars. UsePHP_CodeSniffer\Sniffs\AbstractVariableSniff::PHP_RESERVED_VARSinstead. #1043PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff::$magicMethods. UsePHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff::MAGIC_METHODSinstead. #1043PHP_CodeSniffer\Standards\PSR1\Sniffs\Methods\CamelCapsMethodNameSniffclass which extends theCamelCapsFunctionNameSniff.PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff::$methodsDoubleUnderscore. UsePHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff::DOUBLE_UNDERSCORE_METHODSinstead. #1043PHP_CodeSniffer\Standards\PSR1\Sniffs\Methods\CamelCapsMethodNameSniffclass which extends theCamelCapsFunctionNameSniff.PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff::$magicFunctions. UsePHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff::MAGIC_FUNCTIONSinstead. #1043PHP_CodeSniffer\Standards\PSR1\Sniffs\Methods\CamelCapsMethodNameSniffclass which extends theCamelCapsFunctionNameSniff.PHP_CodeSniffer\Standards\Generic\Sniffs\Files\ByteOrderMarkSniff::$bomDefinitions. UsePHP_CodeSniffer\Standards\Generic\Sniffs\Files\ByteOrderMarkSniff::BOM_DEFINITIONSinstead. #1043PHP_CodeSniffer\Standards\Generic\Sniffs\Files\InlineHTMLSniff::$bomDefinitions. UsePHP_CodeSniffer\Standards\Generic\Sniffs\Files\InlineHTMLSniff::BOM_DEFINITIONSinstead. #1043PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\CharacterBeforePHPOpeningTagSniff::$bomDefinitions. UsePHP_CodeSniffer\Standards\Generic\Sniffs\PHP\CharacterBeforePHPOpeningTagSniff::BOM_DEFINITIONSinstead. #1043PHP_CodeSniffer\Standards\Generic\Sniffs\VersionControl\SubversionPropertiesSniff::$properties. UsePHP_CodeSniffer\Standards\Generic\Sniffs\VersionControl\SubversionPropertiesSniff::REQUIRED_PROPERTIESinstead. #1043PHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting\FileCommentSniff::$tags. UsePHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting\FileCommentSniff::EXPECTED_TAGSinstead. #1043PHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting\ClassCommentSniffclass which extends theFileCommentSniff.PHP_CodeSniffer\Standards\PEAR\Sniffs\NamingConventions\ValidFunctionNameSniff::$magicMethods. UsePHP_CodeSniffer\Standards\PEAR\Sniffs\NamingConventions\ValidFunctionNameSniff::MAGIC_METHODSinstead. #1043PHP_CodeSniffer\Standards\Squiz\Sniffs\NamingConventions\ValidFunctionNameSniffclass which extends the PEARValidFunctionNameSniff.PHP_CodeSniffer\Standards\PEAR\Sniffs\NamingConventions\ValidFunctionNameSniff::$magicFunctions. UsePHP_CodeSniffer\Standards\PEAR\Sniffs\NamingConventions\ValidFunctionNameSniff::MAGIC_FUNCTIONSinstead. #1043PHP_CodeSniffer\Standards\Squiz\Sniffs\NamingConventions\ValidFunctionNameSniffclass which extends the PEARValidFunctionNameSniff.PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\DisallowSizeFunctionsInLoopsSniff::$forbiddenFunctions. UsePHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\DisallowSizeFunctionsInLoopsSniff::FORBIDDEN_FUNCTIONSinstead. #1043PHP_CodeSniffer\Util\Standards::printInstalledStandards(). Useecho PHP_CodeSniffer\Util\Standards::prepareInstalledStandardsForDisplay()instead. #1054PHP_CodeSniffer\Config::printConfigData(). Useecho PHP_CodeSniffer\Config::prepareConfigDataForDisplay()instead. #1055Reporter::$totalFixableandReporter::$totalFixedproperties. #1079(Reporter::$totalFixableErrors + Reporter::$totalFixableWarnings)and(Reporter::$totalFixedErrors + Reporter::$totalFixedWarnings)instead.Removed
PHP_CodeSniffer\Sniffs\Sniffinterface. See [4.0 | Deprecate and remove support for Sniffs not implementing the PHPCSSniffinterface #694].@codingStandardannotation syntax has been removed. #1954phpcs:or@phpcs:syntax instead@codingStandardsIgnoreFilewithphpcs:ignoreFile@codingStandardsIgnoreStartwithphpcs:disable@codingStandardsIgnoreEndwithphpcs:enable@codingStandardsIgnoreLinewithphpcs:ignore@codingStandardsChangeSettingwithphpcs:setruleset.xmlarray property string-based syntax has been removed. #1983print=>echo,create_function=>nullelementtag withkeyandvalueattributes<element key="print" value="echo">T_ARRAY_HINTtoken. #1997T_RETURN_TYPEtoken. #1997Generic.Debug.ClosureLintersniff. [#2448][sq-2448]Generic.Debug.CSSLintsniff. [#2448][sq-2448]Generic.Debug.ESLintsniff. [#2448][sq-2448]Generic.Debug.JSHintsniff. [#2448][sq-2448]Generic.Formatting.NoSpaceAfterCastsniff. #2234Generic.Formatting.SpaceAfterCastsniff instead with the$spacingproperty set to0.Generic.Functions.CallTimePassByReferencesniff. [4.0 |Generic.Functions.CallTimePassByReference: remove sniff #921]MySourcestandard, and all sniffs within. [#2471][sq-2471]Squiz.Classes.DuplicatePropertysniff. [#2448][sq-2448]Squiz.CSScategory, and all sniffs within. [#2448][sq-2448]Squiz.Debug.JavaScriptLintsniff. [#2448][sq-2448]Squiz.Debug.JSLintsniff. [#2448][sq-2448]Squiz.Objects.DisallowObjectStringIndexsniff. [#2448][sq-2448]Squiz.Objects.ObjectMemberCommentsniff. [#2448][sq-2448]Squiz.WhiteSpace.LanguageConstructSpacingsniff. #1953Generic.WhiteSpace.LanguageConstructSpacingsniff instead.Squiz.WhiteSpace.PropertyLabelSpacingsniff. [#2448][sq-2448]Zend.Debug.CodeAnalyzersniff. #58errorproperty of sniffGeneric.Strings.UnnecessaryStringConcat. See #2823ruleset.xmlor[.]phpcs.xml[.dist]file:errorproperty of sniffGeneric.Formatting.MultipleStatementAlignment. See #2823Generic.Formatting.MultipleStatementAlignment.IncorrectWarningerror code has been removed.Generic.Formatting.MultipleStatementAlignment.Incorrecterror code instead.Generic.Formatting.MultipleStatementAlignment.NotSameWarningerror code has been removed.Generic.Formatting.MultipleStatementAlignment.NotSameerror code instead.ruleset.xmlor[.]phpcs.xml[.dist]file:$ignoreCommentsparameter for theAbstractPatternSniff::__construct()method.$settingsparameter format. #3629auto_detect_line_endingsini setting. [#3394][sq-3394]\rline endings.PHP_CodeSniffer\Filters\ExactMatch::getBlacklist()andPHP_CodeSniffer\Filters\ExactMatch::getWhitelist()methods. See #199.ExactMatch::getDisallowedFiles()andExactMatch::getAllowedFiles()methods.PHP_CodeSniffer\Generators\[HTML|Markdown|Text]::print*()methods. See [Generators: don't print documentation title if there are no docs #755].PHP_CodeSniffer\Reporter::$startTimeproperty. #1064Fixed
T_STRINGif there was whitespace and/or comments between the label and colon.parenthesis_*keys.Other
Calling all testers!
Please help by testing the beta release and reporting any issues you run into.
Upgrade guides for both ruleset maintainers/end-users, as well as for sniff developers and integrators, have been published to the Wiki to help smooth the transition.
All patches courtesy of Greg Sherwood (@gsherwood) and Juliette Reinders Folmer (@jrfnl).
Special thanks go out to Dan Wallis (@fredden) and Rodrigo Primo (@rodrigoprimo) for their reviews and feedback.
Statistics
Closed: 51 issues
Merged: 95 pull requests
Follow @phpcs on Mastodon or @PHP_CodeSniffer on X to stay informed.
Please consider funding the PHP_CodeSniffer project. If you already do so: thank you!
This discussion was created from the release 4.0.0beta1.
Beta Was this translation helpful? Give feedback.
All reactions