4.0.0beta1 #1091
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
-
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_TOKENS
containing an array with the tokens used for identifier names. #3041Generic.WhiteSpace.GotoTargetSpacing
to enforce no space between the label of agoto
target and the colon following it. #1026-d option[=value]
or via the ruleset with<ini name=...>
. #416Changed
PEAR
toPSR12
.phpcs
as well asphpcbf
will now exit with exit code 0 if no issues were found/remain after fixing. #184ignore_non_auto_fixable_on_exit
config flag to1
.--report-file
functionality remains untouched.--extensions
command line argument no longer accepts the tokenizer along with the extension. [#2448][sq-2448].module
files 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.--sniffs
CLI argument is used. #98File::getDeclarationName()
method will no longer acceptT_ANON_CLASS
orT_CLOSURE
tokens. #3766RuntimeException
will be thrown if these tokens are passed.File::getDeclarationName()
method will now always return a string (or throw an Exception). #1007null
if 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.InterfaceHasMemberVar
and theInternal.ParseError.EnumHasMemberVar
error codes have been removed.RuntimeException
for properties declared in enums (parse error).Generic.PHP.Syntax
sniff or a dedicated linter instead.Squiz.Classes.ValidClassName.NotCamelCaps
has been changed toSquiz.Classes.ValidClassName.NotPascalCase
. #2046ClassName
and notclassName
.Squiz.PHP.Heredoc.NotAllowed
has been replaced bySquiz.PHP.Heredoc.HeredocNotAllowed
andSquiz.PHP.Heredoc.NowdocNotAllowed
. #2318PSR12.Files.FileHeader
sniff now has more modular error codes to allow for more selectively applying the rules. #2729 #3453PSR12.Files.FileHeader.SpacingAfterBlock
error code is replaced by:PSR12.Files.FileHeader.SpacingAfterTagBlock
PSR12.Files.FileHeader.SpacingAfterDocblockBlock
PSR12.Files.FileHeader.SpacingAfterDeclareBlock
PSR12.Files.FileHeader.SpacingAfterNamespaceBlock
PSR12.Files.FileHeader.SpacingAfterUseBlock
PSR12.Files.FileHeader.SpacingAfterUseFunctionBlock
PSR12.Files.FileHeader.SpacingAfterUseConstBlock
PSR12.Files.FileHeader.SpacingInsideBlock
error code is replaced by:PSR12.Files.FileHeader.SpacingInsideUseBlock
PSR12.Files.FileHeader.SpacingInsideUseFunctionBlock
PSR12.Files.FileHeader.SpacingInsideUseConstBlock
Squiz.Commenting.VariableComment.TagNotAllowed
has been replaced by a dynamicSquiz.Commenting.VariableComment.[TagName]TagNotAllowed
error code. #1039@link
tags in property docblocks, exclude theSquiz.Commenting.VariableComment.LinkTagNotAllowed
error code.External sniffs which extend one of these sniffs may need adjustment if they want to retain the old behaviour.
T_STRING
andT_NS_SEPARATOR
.T_NAME_FULLY_QUALIFIED
,T_NAME_RELATIVE
, andT_NAME_QUALIFIED
instead.T_STRING
andT_NS_SEPARATOR
tokens to look for namespaced names will need to be modified.Tokens::FUNCTION_NAME_TOKENS
/Tokens::$functionNameTokens
array now includes the identifier name tokens.parenthesis_owner
,parenthesis_opener
andparenthesis_closer
array indexes.static
keyword when preceded byinstanceof
will now be tokenized (again) asT_STATIC
. #22T_STRING
.T_OPEN_TAG
tokens will no longer contain any whitespace. #593T_WHITESPACE
token.T_GOTO_LABEL
tokens will no longer include the colon following it. #185T_GOTO_COLON
.goto
statement will now be tokenized asT_STRING
to prevent confusing sniffs. #185T_DOC_COMMENT_*
tokens now have thecomment_opener
andcomment_closer
indexes set. #484Tokens::FUNCTION_NAME_TOKENS
/Tokens::$functionNameTokens
array now includes theT_ANON_CLASS
token. #47true
andfalse
will now always be set to a boolean value, independently of the case in which the value was provided.null
will now be set to an actualnull
value. Previously, the sniff property would have been set to string'null'
.PHP_CodeSniffer\Config::setConfigData()
method is no longer static. #2675private
)Config::$overriddenDefaults
property is also no longer static.PHP_CodeSniffer\Config::setSettings()
method is now avoid
method. #1001DummyFile::setErrorCounts()
method has changed and now expects the following parameters:$errorCount, $warningCount, $fixableErrorCount, $fixableWarningCount, $fixedErrorCount, $fixedWarningCount
. #1079Generator
classes will now throw aPHP_CodeSniffer\Exceptions\GeneratorException
when encountering errors in the documentation XML. #1072PHP_CodeSniffer\Generators\HTML::STYLESHEET
,PHP_CodeSniffer\Util\Timing::MINUTE_IN_MS
andPHP_CodeSniffer\Util\Timing::SECOND_IN_MS
class constants are no longerpublic
. #1051PHP_CodeSniffer\Util\Timing
class is nowfinal
and marked as an internal class. #1074PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest
withPHP_CodeSniffer\Tests\Standards\AbstractSniffTestCase
.PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTest
withPHP_CodeSniffer\Tests\Core\AbstractMethodTestCase
.AbstractSniffTestCase
for which no test case files (.inc
files) 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*.fixed
file. #300Deprecated
Tokens
class. Use the corresponding class constants on the Tokens class instead. #500PHP_CodeSniffer\Util\Common::$allowedTypes
. UsePHP_CodeSniffer\Util\Common::ALLOWED_TYPES
instead. #1043PHP_CodeSniffer\Tokenizers\PHP::$tstringContexts
. UsePHP_CodeSniffer\Tokenizers\PHP::T_STRING_CONTEXTS
instead. #1043PHP_CodeSniffer\Sniffs\AbstractVariableSniff::$phpReservedVars
. UsePHP_CodeSniffer\Sniffs\AbstractVariableSniff::PHP_RESERVED_VARS
instead. #1043PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff::$magicMethods
. UsePHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff::MAGIC_METHODS
instead. #1043PHP_CodeSniffer\Standards\PSR1\Sniffs\Methods\CamelCapsMethodNameSniff
class which extends theCamelCapsFunctionNameSniff
.PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff::$methodsDoubleUnderscore
. UsePHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff::DOUBLE_UNDERSCORE_METHODS
instead. #1043PHP_CodeSniffer\Standards\PSR1\Sniffs\Methods\CamelCapsMethodNameSniff
class which extends theCamelCapsFunctionNameSniff
.PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff::$magicFunctions
. UsePHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff::MAGIC_FUNCTIONS
instead. #1043PHP_CodeSniffer\Standards\PSR1\Sniffs\Methods\CamelCapsMethodNameSniff
class which extends theCamelCapsFunctionNameSniff
.PHP_CodeSniffer\Standards\Generic\Sniffs\Files\ByteOrderMarkSniff::$bomDefinitions
. UsePHP_CodeSniffer\Standards\Generic\Sniffs\Files\ByteOrderMarkSniff::BOM_DEFINITIONS
instead. #1043PHP_CodeSniffer\Standards\Generic\Sniffs\Files\InlineHTMLSniff::$bomDefinitions
. UsePHP_CodeSniffer\Standards\Generic\Sniffs\Files\InlineHTMLSniff::BOM_DEFINITIONS
instead. #1043PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\CharacterBeforePHPOpeningTagSniff::$bomDefinitions
. UsePHP_CodeSniffer\Standards\Generic\Sniffs\PHP\CharacterBeforePHPOpeningTagSniff::BOM_DEFINITIONS
instead. #1043PHP_CodeSniffer\Standards\Generic\Sniffs\VersionControl\SubversionPropertiesSniff::$properties
. UsePHP_CodeSniffer\Standards\Generic\Sniffs\VersionControl\SubversionPropertiesSniff::REQUIRED_PROPERTIES
instead. #1043PHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting\FileCommentSniff::$tags
. UsePHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting\FileCommentSniff::EXPECTED_TAGS
instead. #1043PHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting\ClassCommentSniff
class which extends theFileCommentSniff
.PHP_CodeSniffer\Standards\PEAR\Sniffs\NamingConventions\ValidFunctionNameSniff::$magicMethods
. UsePHP_CodeSniffer\Standards\PEAR\Sniffs\NamingConventions\ValidFunctionNameSniff::MAGIC_METHODS
instead. #1043PHP_CodeSniffer\Standards\Squiz\Sniffs\NamingConventions\ValidFunctionNameSniff
class which extends the PEARValidFunctionNameSniff
.PHP_CodeSniffer\Standards\PEAR\Sniffs\NamingConventions\ValidFunctionNameSniff::$magicFunctions
. UsePHP_CodeSniffer\Standards\PEAR\Sniffs\NamingConventions\ValidFunctionNameSniff::MAGIC_FUNCTIONS
instead. #1043PHP_CodeSniffer\Standards\Squiz\Sniffs\NamingConventions\ValidFunctionNameSniff
class which extends the PEARValidFunctionNameSniff
.PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\DisallowSizeFunctionsInLoopsSniff::$forbiddenFunctions
. UsePHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\DisallowSizeFunctionsInLoopsSniff::FORBIDDEN_FUNCTIONS
instead. #1043PHP_CodeSniffer\Util\Standards::printInstalledStandards()
. Useecho PHP_CodeSniffer\Util\Standards::prepareInstalledStandardsForDisplay()
instead. #1054PHP_CodeSniffer\Config::printConfigData()
. Useecho PHP_CodeSniffer\Config::prepareConfigDataForDisplay()
instead. #1055Reporter::$totalFixable
andReporter::$totalFixed
properties. #1079(Reporter::$totalFixableErrors + Reporter::$totalFixableWarnings)
and(Reporter::$totalFixedErrors + Reporter::$totalFixedWarnings)
instead.Removed
PHP_CodeSniffer\Sniffs\Sniff
interface. See [4.0 | Deprecate and remove support for Sniffs not implementing the PHPCSSniff
interface #694].@codingStandard
annotation syntax has been removed. #1954phpcs:
or@phpcs:
syntax instead@codingStandardsIgnoreFile
withphpcs:ignoreFile
@codingStandardsIgnoreStart
withphpcs:disable
@codingStandardsIgnoreEnd
withphpcs:enable
@codingStandardsIgnoreLine
withphpcs:ignore
@codingStandardsChangeSetting
withphpcs:set
ruleset.xml
array property string-based syntax has been removed. #1983print=>echo,create_function=>null
element
tag withkey
andvalue
attributes<element key="print" value="echo">
T_ARRAY_HINT
token. #1997T_RETURN_TYPE
token. #1997Generic.Debug.ClosureLinter
sniff. [#2448][sq-2448]Generic.Debug.CSSLint
sniff. [#2448][sq-2448]Generic.Debug.ESLint
sniff. [#2448][sq-2448]Generic.Debug.JSHint
sniff. [#2448][sq-2448]Generic.Formatting.NoSpaceAfterCast
sniff. #2234Generic.Formatting.SpaceAfterCast
sniff instead with the$spacing
property set to0
.Generic.Functions.CallTimePassByReference
sniff. [4.0 |Generic.Functions.CallTimePassByReference
: remove sniff #921]MySource
standard, and all sniffs within. [#2471][sq-2471]Squiz.Classes.DuplicateProperty
sniff. [#2448][sq-2448]Squiz.CSS
category, and all sniffs within. [#2448][sq-2448]Squiz.Debug.JavaScriptLint
sniff. [#2448][sq-2448]Squiz.Debug.JSLint
sniff. [#2448][sq-2448]Squiz.Objects.DisallowObjectStringIndex
sniff. [#2448][sq-2448]Squiz.Objects.ObjectMemberComment
sniff. [#2448][sq-2448]Squiz.WhiteSpace.LanguageConstructSpacing
sniff. #1953Generic.WhiteSpace.LanguageConstructSpacing
sniff instead.Squiz.WhiteSpace.PropertyLabelSpacing
sniff. [#2448][sq-2448]Zend.Debug.CodeAnalyzer
sniff. #58error
property of sniffGeneric.Strings.UnnecessaryStringConcat
. See #2823ruleset.xml
or[.]phpcs.xml[.dist]
file:error
property of sniffGeneric.Formatting.MultipleStatementAlignment
. See #2823Generic.Formatting.MultipleStatementAlignment.IncorrectWarning
error code has been removed.Generic.Formatting.MultipleStatementAlignment.Incorrect
error code instead.Generic.Formatting.MultipleStatementAlignment.NotSameWarning
error code has been removed.Generic.Formatting.MultipleStatementAlignment.NotSame
error code instead.ruleset.xml
or[.]phpcs.xml[.dist]
file:$ignoreComments
parameter for theAbstractPatternSniff::__construct()
method.$settings
parameter format. #3629auto_detect_line_endings
ini setting. [#3394][sq-3394]\r
line 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::$startTime
property. #1064Fixed
T_STRING
if 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