Skip to content

Instantly share code, notes, and snippets.

@hkulekci
Last active May 15, 2019 09:24
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Name Trait Method to Override
<?php
trait A {
public static function dispatch()
{
var_dump(func_get_args());
return new static(...func_get_args());
}
}
class B {
use A {
dispatch as traitDispatch;
}
public static function dispatch()
{
return self::traitDispatch(...func_get_args());
}
}
B::dispatch('A', 'B');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment