De hecho es de la misma forma, pero puedes aprovechar el método mágico __toString(), revisa lo siguiente:
    
Código PHP:
Ver originalclass B
{
    private $_texto;
 
    public function devuelveTexto()
    {
        return $this->_texto;
    }
 
    public function __toString()
   {
        return $this->_texto;
    }
} 
 
class A
{
    private $_colB;
 
    public function addB(B $b)
    {
        $this->_colB[] = $b;
    }
 
    public function verificar($textoAVerificar)
    {
        foreach( $this->_colB as $B) {
               if ($B == $textoAVerificar) {
                      $encontrado = true;
               }
        }
    }
}
  
Saludos.