Question from the PHP8 test

Implement the abstract method of the Trait in the class.

Easy

What is the correct implementation of the abstract method of the Trait?

trait MyTrait {
    abstract private function neededByTheTrait(): string;
 
    public function doSomething() {
        return strlen($this->neededByTheTrait());
    }
}
Author: W3D TeamStatus: PublishedQuestion passed 947 times
Edit
1
Community EvaluationsNo one has reviewed this question yet, be the first!