-
-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP 8.0: Review parameter names used in sniffs #1239
Comments
Related upstream PRs:
|
This was referenced Oct 26, 2022
This was referenced Oct 26, 2022
This was referenced Dec 6, 2022
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are a number of sniffs which mention parameter names in the error/warning message.
As part of the preparations for PHP 8 and named parameters in function calls, a lot of parameters for PHP native functions have been renamed to more descriptive names.
As it is, the online PHP documentation has not been updated with the new names yet, though it is expected that this will happen around the release date.
To find the renamed parameters, for now, the only source would be the commits: https://github.com/php/php-src/search?q=parameter+names&type=commits and looking at the
stub
files in the source.The code in existing sniffs referencing parameter names needs to be updated to use the parameter name as per PHP 8 to prevent confusing people if they use named parameters.
If there is no PR open to update the PHP docs for the renamed parameter, it is recommended to also open a PR for that: https://github.com/php/doc-en/pullsEdit: this will be handled for all docs via a script: https://github.com/php/php-tasks/issues/26#issuecomment-731939804Task list (not necessarily complete):
To do/to review:
Sniff
PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue
(@jrfnl)PHPCompatibility.InitialValue.NewConstantScalarExpressions
(@jrfnl)PHPCompatibility.ParameterValues.NewAssertCustomException
PHPCompatibility.ParameterValues.RemovedAssertStringAssertion
PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder
PHPCompatibility.ParameterValues.RemovedMbstringModifiers
Changes prepped:
Pulled
HashAlgorithmsTrait
- PR New/RemovedHashAlgorithms: add support for named parameters #1394PHPCompatibility.FunctionUse.NewFunctionParameters
- PR NewFunctionParameters: add support for named parameters + bug fix #1432PHPCompatibility.FunctionUse.RemovedFunctionParameters
- PR RemovedFunctionParameters: add support for named parameters #1433PHPCompatibility.FunctionUse.OptionalToRequiredFunctionParameters
- PR OptionalToRequiredFunctionParameters: add support for named parameters + bug fix #1430PHPCompatibility.FunctionUse.RequiredToOptionalFunctionParameters
- PR RequiredToOptionalFunctionParameters: add support for named parameters #1431PHPCompatibility.IniDirectives.NewIniDirectives
- PR NewIniDirectives: add support for named parameters #1392PHPCompatibility.IniDirectives.RemovedIniDirectives
- PR RemovedIniDirectives: add support for named parameters #1393PHPCompatibility.InitialValue.NewConstantArrayUsingDefine
- PR NewConstantArraysUsingDefine: add tests with named parameters #1369PHPCompatibility.Keywords.ForbiddenNames
- PR ForbiddenNames: add support for named parameters #1405PHPCompatibility.ParameterValues.ChangedIntToBoolParamType
- PR ChangedIntToBoolParamType: add support for named parameters #1370PHPCompatibility.ParameterValues.ChangedObStartEraseFlags
- PR ChangedObStartEraseFlags: add support for named parameters #1371PHPCompatibility.ParameterValues.ForbiddenGetClassNull
- PR ForbiddenGetClassNull: add support for named parameters #1372PHPCompatibility.ParameterValues.ForbiddenSessionModuleNameUser
- PR ForbiddenSessionModuleNameUser: add support for named parameters #1373PHPCompatibility.ParameterValues.ForbiddenStripTagsSelfClosingXHTML
- PR ForbiddenStripTagsSelfClosingXHTML: add support for named parameters #1374PHPCompatibility.ParameterValues.NewArrayReduceInitialType
- PR NewArrayReduceInitialType: add support for named parameters #1375PHPCompatibility.ParameterValues.NewFopenModes
- PR NewFopenModes: add support for named parameters #1376PHPCompatibility.ParameterValues.NewHashAlgorithms
- PR New/RemovedHashAlgorithms: add support for named parameters #1394PHPCompatibility.ParameterValues.NewHTMLEntitiesEncodingDefault
- PR NewHTMLEntitiesEncodingDefault: add support for named parameters #1377PHPCompatibility.ParameterValues.NewIconvMbstringCharsetDefault
- PR NewIconvMbstringCharsetDefault: add support for named parameters #1385PHPCompatibility.ParameterValues.NewIDNVariantDefault
- PR NewIDNVariantDefault: add support for named parameters #1378PHPCompatibility.ParameterValues.NewNegativeStringOffset
- PR NewNegativeStringOffset: add support for named parameters #1379PHPCompatibility.ParameterValues.NewNumberFormatMultibyteSeparators
- PR NewNumberFormatMultibyteSeparators: add support for named parameters #1380PHPCompatibility.ParameterValues.NewPackFormat
- PR NewPackFormat: add support for named parameters #1381PHPCompatibility.ParameterValues.NewPasswordAlgoConstantValues
- PR NewPasswordAlgoConstantValues: add support for named parameters #1382PHPCompatibility.ParameterValues.NewPCREModifiers
- PR NewPCREModifiers: add support for named parameters #1396PHPCompatibility.ParameterValues.NewProcOpenCmdArray
- PR NewProcOpenCmdArray: add support for named parameters #1383PHPCompatibility.ParameterValues.NewStripTagsAllowableTagsArray
- PR NewStripTagsAllowableTagsArray: add support for named parameters #1384PHPCompatibility.ParameterValues.RemovedGetDefinedFunctionsExcludeDisabledFalse
- PR RemovedGetDefinedFunctionsExcludeDisabledFalse: add support for named parameters #1386PHPCompatibility.ParameterValues.RemovedHashAlgorithm
- PR New/RemovedHashAlgorithms: add support for named parameters #1394PHPCompatibility.ParameterValues.RemovedIconvEncoding
- PR RemovedIconvEncoding: add support for named parameters #1387PHPCompatibility.ParameterValues.RemovedMbStrrposEncodingThirdParam
- PR RemovedMbStrrposEncodingThirdParam: add support for named parameters #1388PHPCompatibility.ParameterValues.RemovedNonCryptoHash
- PR RemovedNonCryptoHash: add support for named parameters #1389PHPCompatibility.ParameterValues.RemovedPCREModifiers
- PR RemovedPCREModifiers: add support for named parameters #1395PHPCompatibility.ParameterValues.RemovedSetlocaleString
- PR RemovedSetlocaleString: add support for named parameters #1390PHPCompatibility.ParameterValues.RemovedSplAutoloadRegisterThrowFalse
- PR RemovedSplAutoloadRegisterThrowFalse: add support for named parameters #1391Regarding sniff names
The names of the
ParameterValues
sniffs often contain a parameter name in the actual sniff name too and sometimes also in the error code.I'd like to propose to leave the sniff name/
error codesalone to minimize BC-breaks as changing those can invalidate rulesets and inline ignore annotations.If needs be, a note can be added to the class docblock annotating that the name of the parameter has changed.
Edit: For those sniffs which have modular error codes which include the parameter name, the error code will change and this should be noted in the changelog as a BC break. Sniff names will still not be changed.
The text was updated successfully, but these errors were encountered: