scrutinizer-ci/scrutinizer

Arrays type annotations

Opened this issue · 3 comments

In https://scrutinizer-ci.com/docs/tools/php/php-analyzer/guides/annotating_code

array<T> or T[] should not assume keys are integers (lot of false positives in my case) or should allow typing like this T[string]

I see this call: $constant->getName(). Maybe the getName method of ReflectionConstant class says that it returns integer value and that's why this error is reported.

I may be wrong but I don't think so, I've a string typing in Reflection\Reflection::getName() (ReflectionConstant extends Reflection) :

    /**
     * Gets the fully qualified entity name (with the namespace).
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }