private function fixParent(Tokens $tokens, $classStart, $classEnd)
    {
        // check calls to the parent constructor
        foreach ($tokens->findGivenKind(T_EXTENDS) as $index => $token) {
            $parentIndex = $tokens->getNextMeaningfulToken($index);
            $parentClass = $tokens[$parentIndex]->getContent();

            // using parent::ParentClassName() or ParentClassName::ParentClassName()
            $parentSeq = $tokens->findSequence([
                [T_STRING],
                [T_DOUBLE_COLON],
                [T_STRING, $parentClass],
                '(',
            ], $classStart, $classEnd, [2 => false]);

            if (null !== $parentSeq) {
                // we only need indexes
                $parentSeq = array_keys($parentSeq);

                // match either of the possibilities
                if ($tokens[$parentSeq[0]]->equalsAny([[T_STRING, 'parent'], [T_STRING, $parentClass]], false)) {
                    // replace with parent::__construct
                    $tokens[$parentSeq[0]] = new Token([T_STRING, 'parent']);
                    $tokens[$parentSeq[2]] = new Token([T_STRING, '__construct']);
                }
            }

            // using $this->ParentClassName()
            $parentSeq = $tokens->findSequence([
                [T_VARIABLE, '$this'],
                [T_OBJECT_OPERATOR],
                [T_STRING, $parentClass],
                '(',
            ], $classStart, $classEnd, [2 => false]);

            if (null !== $parentSeq) {
                // we only need indexes
                $parentSeq = array_keys($parentSeq);

                // replace call with parent::__construct()
                $tokens[$parentSeq[0]] = new Token([
                    T_STRING,
                    'parent',
                ]);
                $tokens[$parentSeq[1]] = new Token([
                    T_DOUBLE_COLON,
                    '::',
                ]);
                $tokens[$parentSeq[2]] = new Token([T_STRING, '__construct']);
            }
        }
    }