You can pass $this as class for the ReflectionClass. __CLASS__ won't help if you extend the original class, because it is a magic constant based on the file itself.
<?php
class Example {
const TYPE_A = 1;
const TYPE_B = 'hello';
public function getConstants()
{
$reflectionClass = new ReflectionClass($this);
return $reflectionClass->getConstants();
}
}
$example = new Example();
var_dump($example->getConstants());
// Result:
array ( size = 2)
'TYPE_A' => int 1
'TYPE_B' => (string) 'hello'