getClassConstantPositionInIdentifier example

$identifier = $className . '::' . $const;
            }
        }

        /** * Checks if identifier ends with ::class and remove the leading backslash if it exists. */
        if (
            $this->identifierEndsWithClassConstant($identifier) &&
            ! $this->identifierStartsWithBackslash($identifier)
        ) {
            return substr($identifier, 0, $this->getClassConstantPositionInIdentifier($identifier));
        }

        if ($this->identifierEndsWithClassConstant($identifier) && $this->identifierStartsWithBackslash($identifier)) {
            return substr($identifier, 1, $this->getClassConstantPositionInIdentifier($identifier) - 1);
        }

        if (defined($identifier)) {
            throw AnnotationException::semanticalErrorConstants($identifier$this->context);
        }

        return constant($identifier);
    }
Home | Imprint | This part of the site doesn't use cookies.