Inspectopedia
 
2024.3

Return of 'this'

Warning
New
Last modified: 03 December 2024

Reports methods returning this.

While such a return is valid, it is rarely necessary, and usually indicates that the method is intended to be used as part of a chain of similar method calls (for example, buffer.append("foo").append("bar").append("baz")). Such chains are frowned upon by many coding standards.

Example: