Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autocomplete does not work for a static method in parent class #3

Merged
merged 1 commit into from Apr 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions TestEnvironment/demo-static-parent-issue/Callbacks.js
@@ -0,0 +1,15 @@
//noinspection JSUnusedGlobalSymbols
/**
* @type{com.ptby.dynamicreturntypeplugin.scripting.api.ExecutingScriptApi}
*/
var api;

//noinspection JSUnusedGlobalSymbols
function info(returnTypeNameSpace, returnTypeClass)
{
var out = returnTypeNameSpace + "\\" + returnTypeClass;

api.writeToEventLog('We got: ' + out);

return out;
}
@@ -0,0 +1,19 @@
<?php
class DataProviderWithStaticFactory
{
/**
* @return \FooEntity
*/
public function returnData()
{
return new FooEntity();
}

/**
* @return \DataProviderWithStaticFactory
*/
public static function getDataProvider()
{
return new self();
}
}
22 changes: 22 additions & 0 deletions TestEnvironment/demo-static-parent-issue/MyClass.php
@@ -0,0 +1,22 @@
<?php
class MyClass extends ParentClass
{

public function load()
{
$dataProvider = DataProviderWithStaticFactory::getDataProvider();
$entity = $dataProvider->returnData();

$refreshedEntity = self::refreshEntity($entity);
$refreshedEntity->entityMethod(); // auto-complete does not work for this
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pbyrne84 just to be sure - this PR is not another repro-case for previous issue, but rather an example of a different (but related) issue with static / parent calls

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try the upload now.

The one I did before was limited to 1 level on method calls. I enabled
multiple levels of method call . The parameter internally is really read as
DataProviderWithStaticFactory::getDataProvider()->returnData() . Have fun
anyway.

.

On 26 April 2016 at 15:22, Martin Hujer notifications@github.com wrote:

In TestEnvironment/demo-static-parent-issue/MyClass.php
#3 (comment)
:

@@ -0,0 +1,22 @@
+<?php
+class MyClass extends ParentClass
+{
+

  • public function load()
  • {
  •   $dataProvider = DataProviderWithStaticFactory::getDataProvider();
    
  •   $entity = $dataProvider->returnData();
    
  •   $refreshedEntity = self::refreshEntity($entity);
    
  •   $refreshedEntity->entityMethod(); // auto-complete does not work for this
    

@pbyrne84 https://github.com/pbyrne84 just to be sure - this PR is not
another repro-case for previous issue, but rather an example of a different
(but related) issue with static / parent calls


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/pbyrne84/DynamicReturnTypePluginTestEnvironment/pull/3/files/efd40e1691b3bebe9b67e300f84147ef8feab975#r61094013

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're awesome! 🎉

}
}

class FooEntity
{

public function entityMethod()
{

}
}
13 changes: 13 additions & 0 deletions TestEnvironment/demo-static-parent-issue/ParentClass.php
@@ -0,0 +1,13 @@
<?php
class ParentClass
{

/**
* @param object $entity
* @return object
*/
public static function refreshEntity($entity)
{
return $entity;
}
}
@@ -0,0 +1,10 @@
{
"methodCalls": [
{
"class": "\\ParentClass",
"method": "refreshEntity",
"position": 0,
"fileReturnTypeReplacementCall": ["Callbacks.js", "info"]
}
]
}