Last active
August 29, 2015 13:58
-
-
Save vonglasow/10021599 to your computer and use it in GitHub Desktop.
traits properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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).