Releases: magento/magento-coding-standard
Version 8
Fixes
- Fixed ImportsFromTestNamespace from lock on group use with trailing comma @fsw
- Moved abstract unit test to autoload-dev @sivaschenko
- Unit test coverage and fixes for HTML, annotation and less sniffs @eliseacornejo
Version 7
New Rules
- Added sniff to ensure correct usage of getChildHtml and getChildChildHtml AbstractBlock methods @eliseacornejo
- Annotation, Html and Less sniffs has been moved from the magento/magento2 repo @loginesta
Fixes
- Avoid infinite loop when Parse Error occurs @fredden
- Fix TypeError for phpcs->addWarning() @fredden
- Fixed HtmlDirectiveSniff @asheem-patro
- Add test coverage for HtmlBindingSniff @ihor-sviziev
- Moved parameter and variable tokenizers from the magento/magento2 repo @edspc
Infrastructure and updates
- Github Actions are now used to validate pull requests @ihor-sviziev
- All dependencies have been updated to the latest versions. The package is now PHP 8 compatible. @andrewbess @drpayyne
Version 6
New Rules
- Added sniff to prohibit imports from Magento\Tests namespace outside of tests in #149 by @konarshankar07
- Added sniff to discourage the use of Resource class from Model class (i.e. getResource()->load($object)) in #189 by @milindsingh
Improvements
- squizlabs/php_codesniffer dependency version updated from ^3.4 to ^3.5 for PHP 7.4 compatibility
- Discouraged functions list was updated to include all the aliases of the existing discouraged functions in #179 by @andrewbess
- Modified deprecated validator to allow missing the comment if see tag is set in #181 by @sinisa86
Fixes
v5 Release
New Rules
- Implemented GraphQL sniffs magento/architecture#269 in #141 by @jean-bernard-valentaten
- Implemented sniff for classes and interfaces PHPDoc formatting #105 in #124 by @udovicic
- Implemented sniff that verifies that system resources processing is wrapped with
try catchconstruction #21 in #77 by @larsroettig - Implemented sniff that checks that
@deprecatedtag is explained #131 in #134 by @udovicic
Improvements
- Added check for the use of
helpersinMagento2.Templates.ThisInTemplatesniff and updated documentation with recommendation #121 in #122 @diazwatson - Added alternatives for discouraged functions #102 in #123 by @diazwatson
- No longer require a space before a colon for control structures using the alternative syntax #118 in #132 by @hostep
- Add excludes for test files
<exclude-pattern>*/tests/*</exclude-pattern>#136 in #138 by @konarshankar07 - Improved documentation with
How to use phpcbfin #150 by @lfluvisotto
Fixes
- Fixed issue with false-positive
Empty FUNCTION statement detected for around plugins#95 in #126 by @konarshankar07 - Fixed issue in line length sniff for
phraseand__keyword by removing redundant rule and using generic one #75 in #127 by @konarshankar07
v4 Release
New Rules
Improvements
- Enhanced documentation for
ThisInTemplaterule #108 in #119 by @diazwatson
Fixes
- Fixed
ThrowCatchfalse positive findings #93 in #120 by @larsroettig
v3 Release
Versioning
Starting from the current release new versioning strategy will be used. One release line will be supported based on incremental approach despite introduced changes and single number sequence-based version identifier will be incremented every release.
Please refer to the wiki page and magento/architecture#136 thread for more details.
New Rules
- Increased the severity level to 10 for
InsecureFunctionSniff#104
Improvements
- Improved
LiteralNamespacesSniffby removing class exists checks and adding exclude patterns #9 in #89 by @ldusan84 htmlspecialcharsis added to the list of discouraged functions in #96 by @davemacaulay- Removed
Squiz.Commenting.ClassCommentfrom the ruleset since it does not cover all Magento cases #106 - Added excludes for
phtmlfiles #112
Fixes
2.0.0
New Rules
Magento2.Classes.DiscouragedDependenciesdetects explicit request of proxies and interceptors in constructors. #18 -> #59 by @maderlockMagento2.Performance.ForeachArrayMergedetectsarray_merge(...)usage in a loop. #20 -> #72 by @larsroettig
Improvements
- PHP CodeSniffer dependency
^3.4#84 -> #85 by @sergeynezbritskiy
Fixes
*/Fixtures/*exclude for rules that do not apply to test files.
Documentation
- Documentation with code examples for Magento2.Performance.ForeachArrayMerge.
1.0.2
- added test files excludes for specific rules:
Magento2.Security.IncludeFile,Magento2.Security.Supergloba,Magento2.SQL.RawQuery,Magento2.Exceptions.DirectThrow,Magento2.Functions.DiscouragedFunction,Magento2.Functions.StaticFunction,Magento2.CodeAnalysis.EmptyBlock,Squiz.Functions.GlobalFunction,Squiz.PHP.GlobalKeyword,PSR1.Files.SideEffects-> fixed #80.
1.0.1
- removed
EmptyCheckSniffsince there is no performance impact; - added more excludes for
*/Test/*files; - removed
Squiz.Commenting.FunctionCommentThrowTagbecause it doesn't work with@inheritdoctags.
1.0.0
🚀 Initial release of Magento Coding Standard - the result of MEQP and Magento 2 core rules consolidation.
Magento Coding Standard covers:
• PSR2 compliance
• the use of insecure functions
• unescaped output
• the use of deprecated PHP functions
• PHP code syntax
• naming convention
• the use of PHP superglobals
• empty code blocks
• improper exception handling
• raw SQL queries
and many other general PHP and Magento 2 specific code issues.