Created
March 3, 2012 11:45
-
-
Save suin/1965700 to your computer and use it in GitHub Desktop.
PHP5.4.0のtraitはfinalキーワードは無視されるっぽい。 ref: http://qiita.com/items/2971
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 Foo | |
{ | |
final public static function staticMethod() | |
{ | |
echo __METHOD__, PHP_EOL; | |
} | |
} | |
class Bar | |
{ | |
use Foo; | |
final public static function staticMethod() | |
{ | |
echo __METHOD__, PHP_EOL; | |
} | |
} | |
Bar::staticMethod(); |
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 -v | |
PHP 5.4.0 (cli) (built: Mar 3 2012 16:55:36) | |
Copyright (c) 1997-2012 The PHP Group | |
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies | |
with Xdebug v2.2.0-dev, Copyright (c) 2002-2012, by Derick Rethans | |
$ php Trait.php | |
Bar::staticMethod |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment