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

Error - Call to an undefined method object::something(); #2874

Closed
ankitpp opened this issue Jan 20, 2020 · 2 comments
Closed

Error - Call to an undefined method object::something(); #2874

ankitpp opened this issue Jan 20, 2020 · 2 comments

Comments

@ankitpp
Copy link

ankitpp commented Jan 20, 2020

In this particular instance method was called after Instantiating an object from child class. Child class extends parent class but error was still thrown.

Parent
abstract class Duhh
{
public function something(){
Definition of Function in parent
}
}

Child
class DuhhChild extends Duhh
{

}

Use of Method In Some Controller that throws PHP Stan Error - Call to an undefined method object::something();

use DuhhChild;
class SomeController extends random
{
$something = new DuhhChild;
$something->something()
}

inorder to work around this error simple define a docBlock that explains that variable as an Instance of Child Class above the variable that you are using to Instantiate the object. Example;

use DuhhChild;
class SomeController extends random
{
/** @var DuhhChild $something */
$something = new DuhhChild;
$something->something()
}

@ondrejmirtes
Copy link
Member

Hi, please reproduce the problem on phpstan.org (keep to the Bug report issue template), otherwise I can't help you.

@lock
Copy link

lock bot commented Feb 28, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants