Closed
Description
Rule
If a method uses system resources (such as files, sockets, streams, etc), the code MUST be wrapped with a try block and the corresponding finally block. In the finally sections, all resources SHOULD be properly released.
Reason
Source: Magento Technical Guidelines.
Implementation
- Subscribe to
T_STRING
token. - Prepare the list of build in PHP functions that use resources or alternatively functions prefixes (
stream_
,socket_
, etc) - Check if token content is
in_array
of system functions. - Raise a warning if no outer
try
statement detected.
Metadata
Metadata
Assignees
Labels
New rule is acceptedNew rule is acceptedNew feature implementationNew feature implementationThe issue or PR is on hold.The issue or PR is on hold.The rule is based on Magento Technical GuidelinesThe rule is based on Magento Technical Guidelines