Skip to content

Instantly share code, notes, and snippets.

@hkulekci
Last active May 15, 2019 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkulekci/e449bb452e62ac7105c27f70fb4ede6c to your computer and use it in GitHub Desktop.
Save hkulekci/e449bb452e62ac7105c27f70fb4ede6c to your computer and use it in GitHub Desktop.
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