Releases: magento/magento-coding-standard
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 catch
construction #21 in #77 by @larsroettig - Implemented sniff that checks that
@deprecated
tag is explained #131 in #134 by @udovicic
Improvements
- Added check for the use of
helpers
inMagento2.Templates.ThisInTemplate
sniff 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 phpcbf
in #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
phrase
and__
keyword by removing redundant rule and using generic one #75 in #127 by @konarshankar07
v4 Release
New Rules
Improvements
- Enhanced documentation for
ThisInTemplate
rule #108 in #119 by @diazwatson
Fixes
- Fixed
ThrowCatch
false 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
LiteralNamespacesSniff
by removing class exists checks and adding exclude patterns #9 in #89 by @ldusan84 htmlspecialchars
is added to the list of discouraged functions in #96 by @davemacaulay- Removed
Squiz.Commenting.ClassComment
from the ruleset since it does not cover all Magento cases #106 - Added excludes for
phtml
files #112
Fixes
2.0.0
New Rules
Magento2.Classes.DiscouragedDependencies
detects explicit request of proxies and interceptors in constructors. #18 -> #59 by @maderlockMagento2.Performance.ForeachArrayMerge
detectsarray_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
EmptyCheckSniff
since there is no performance impact; - added more excludes for
*/Test/*
files; - removed
Squiz.Commenting.FunctionCommentThrowTag
because it doesn't work with@inheritdoc
tags.
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.