PHP 7.4/8.4 | ✨ New PHPCompatibility.ParameterValues.RemovedProprietaryCSVEscaping sniff
#1787
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PHP 7.4 | New
PHPCompatibility.ParameterValues.RemovedProprietaryCSVEscapingsniffThis adds a new sniff to detect code subject to this change.
The one thing I'm not 100% sure about, is whether this should be an
erroror awarning.In PHP 7.3 and lower, passing an empty string as
$escapetofputcsv()andfgetcsv()would result in a PHP warning: "Warning: fputcsv(): escape must be a character", not in a fatal error, but as the resulting CSV data can be significantly different - which could break imports/exports, I've elected to make it an error for PHPCompatibility anyway.Refs:
PHP 8.4 | ParameterValues/RemovedProprietaryCSVEscaping: detect new deprecation
This commit updates the
PHPCompatibility.ParameterValues.RemovedProprietaryCSVEscapingsniff to start flagging code affected by this next step in the plan to "kill csv escaping".Note: the changelog entry isn't very clear and the implementation is different from the implementation proposed via the RFC.
In practice, it now comes down to: passing any value to the
$escapeparameter is okay.Not passing the parameter, i.e. relying on the default value for the
$escapeparameter will now trigger a deprecation notice.Also see: https://3v4l.org/lsjvA/rfc#vgit.master
Refs:
Related to #1731