DamImpr commented on code in PR #9431:
URL: https://github.com/apache/netbeans/pull/9431#discussion_r3414863159
##########
php/php.editor/src/org/netbeans/modules/php/editor/codegen/SinglePropertyMethodCreator.java:
##########
@@ -191,6 +191,9 @@ public String create(Property property) {
}
private String getReturnType() {
+ if (cgsInfo.isFluentSetter() &&
cgsInfo.getPhpVersion().hasStaticReturnType()) {
Review Comment:
@tmysik I have analysed the entire `SinglePropertyMethodCreator` class
mentioned. The logic is such that “return $this” (or “self”, if the property is
static) is always injected into fluent setters. My modification implements the
same logic, adding only a check for PHP version >= 8.0.
Since the code already contains the logic whereby all fluent setters return
$this, the return type will always be the actual type of the instance. In PHP
>= 8.0, the static keyword represents the standard that indicates the actual
type of the instance of the called method, which you can verify at this link.
https://wiki.php.net/rfc/static_return_type
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists