困惑 - 调用方法调用方法的对象

I often see code like this:

X::y()->z();

Is this a static object calling a method y, the result of y returning an object, and this object then calling a method called z?

Thank you.

The static object is not calling y, but the method y is called on a class, statically. Aside from that, you're correct.

It could look like this:

class X {
  public static function y(){
    return new self();
  }

  public function z(){

  }
}

You are calling a static method y() on an object X and then you are calling z() method on the resulting object returned from y()

It may or may not be a static method call. If the call is made from inside an instantiated class and X is a parent of that class, then that call may be non-static.

One thing is for sure: X::y() returns an object.