<?php
trait Singleton {
public static function getInstance() { ... }
}
class A {
use Singleton;
// ...
}
class B extends ArrayObject {
use Singleton;
// ...
}
// Singleton method is now available for both classes
A::getInstance();
B::getInstance();