protected function retrieveDeclarationPlace(\ReflectionProperty $refProperty)
    {
        static $declarationCache = array();

        // Early return from the cache.
        $declaringClass = $refProperty->getDeclaringClass();
        $key = $refProperty->name . '::' . $declaringClass->name;
        if (isset($declarationCache[$key])) {
            return $declarationCache[$key];
        }

        // A class can not redeclare a property from a trait that it is using.
        // Hence, if one of the traits has the same property that we are
        // analysing, it is probably declared there.
        // Traits on the other hand can redeclare their properties.
        // I'm not sure how to get the actual declaration place, when dealing
        // with several layers of traits. We will not parse the source code
        // for an answer.
        $type = '<br />in class: ';
        if (method_exists($declaringClass, 'getTraits')) {
            foreach ($refProperty->getDeclaringClass()->getTraits() as $trait) {
                if ($trait->hasProperty($refProperty->name)) {
                    if (count($trait->getTraitNames()) > 0) {
                        // Multiple layers of traits!
                        return $declarationCache[$key] = '';
                    }
                    // From a trait.
                    $declaringClass = $trait;
                    $type = '<br />in trait: ';
                    break;
                }
            }
        }

        $filename = $declaringClass->getFileName();

        if (empty($filename) === true) {
            return $declarationCache[$key] = static::UNKNOWN_DECLARATION;
        }

        return $declarationCache[$key] = $this->pool->fileService
                ->filterFilePath($declaringClass->getFileName()) . $type . $declaringClass->name;
    }