Created
November 27, 2016 12:08
-
-
Save gorkamu/e2485407891179d4d658da8dd92bec3d to your computer and use it in GitHub Desktop.
Ejemplo del cambio de visibilidad de un método desde un trait
This file contains hidden or 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 HolaMundo { | |
public function decirHola() { | |
echo 'Hola Mundo!'; | |
} | |
} | |
// Cambiamos visibilidad de decirHola | |
class MiClase1 { | |
use HolaMundo { decirHola as protected; } | |
} | |
// Método alias con visibilidad cambiada | |
// La visibilidad de decirHola no cambia | |
class MiClase2 { | |
use HolaMundo { decirHola as private miPrivadoHola; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment