You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Titum (Jira)" <ji...@apache.org> on 2021/09/14 13:48:00 UTC

[jira] [Comment Edited] (NETBEANS-6002) make "@return static[]" works

    [ https://issues.apache.org/jira/browse/NETBEANS-6002?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17414947#comment-17414947 ] 

Titum edited comment on NETBEANS-6002 at 9/14/21, 1:47 PM:
-----------------------------------------------------------

 
{code:java}
Class myDatabaseModel
{

/**
 * Select an object
 * @return static
 */

 public static function selectWhere($value, $column) {
    $sql = "select * from mytable where $column = `$value` LIMIT 1";
    $myObject = sqlResponseToObject($sql);
    return $myObject;
 }
 
/**
 * Select a list of objects
 * @return static[]
 */
 public static function selectList($value, $column) {
    $sql = "select * from mytable where $column = `$value`";
    $myObjects = sqlResponseToObjectArray($sql);
    return $myObjects; 
 }
 
}
Class MyObject extends myDatabaseModel 
{
}
// A single object is well known as MyObject object by autocompletion
$myObject = MyObject::selectWhere(123, 'identifier');
echo $myObject->identifier;
// An array of objects is not recognized as a list of MyObject objects by autocompletion
$myObjectList = MyObject::selectList('word', 'tag');
echo $myObjectList[0]->identifier;
{code}
 

 


was (Author: titum):
 
{code:java}
Class myDatabaseModel
{

/**
 * Select an object
 * @return static
 */

 public static function selectWhere($value, $column) {
    $sql = "select * from mytable where $column = `$value` LIMIT 1";
    $myObject = sqlResponseToObject($sql);
    return $myObject;
 }
 
/**
 * Select a list of objects
 * @return static[]
 */
 public static function selectList($value, $column) {
    $sql = "select * from mytable where $column = `$value`";
    $myObjects = sqlResponseToObjectArray($sql);
    return $myObjects; 
 }
 
}
Class MyObject extends myDatabaseModel 
{
}
// A single object is well known as MyObject object by autocompletion
$myObject = MyObject::selectWhere(123, 'identifier');
echo $myObject->identifier;
// An array of objects is not recognized as a list of MyObject objects by autocompletion
$myObjectList = MyObject::selectList('word', 'tag');
echo $myObject->identifier;
{code}
 

 

> make "@return static[]" works
> -----------------------------
>
>                 Key: NETBEANS-6002
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-6002
>             Project: NetBeans
>          Issue Type: Improvement
>          Components: php - Editor
>    Affects Versions: 12.4
>            Reporter: Titum
>            Priority: Trivial
>
> The "@return static" statement in PHPDoc works well, the autocompletion uses the Class of the returned object.
> But "@return static[]" not allows the autocompletion to understand it is an array of the static object



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists