Skip to content

Instantly share code, notes, and snippets.

@vonglasow
Last active August 29, 2015 13:58
Show Gist options
  • Save vonglasow/10021599 to your computer and use it in GitHub Desktop.
Save vonglasow/10021599 to your computer and use it in GitHub Desktop.
traits properties
<?php
trait a {
public function getConfig()
{
return $this->world . '/config.php';
}
}
class B {
public $world = __DIR__;
use a;
}
$b = new B;
var_dump($b->getConfig());
@mageekguy
Copy link

Surtout qu'en fait ma première implémentation était de la merde (j'ai repiqué du code pour aller vite, et j'ai été trop vite pour le nettoyer…), donc @jubianchi, ta remarque par rapport au getBasePath() était donc pertinente (j'ai mis à jour le code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment