public function shortenClasses($classesToFix, Configuration $config)
    {
        $cumulativeOffset = 0;

        /** @var FoundClass $c */
        foreach ($classesToFix as $c) {
            $replacement = [];

            if (in_array($c->name, $this->ignoredClassNames)) {
                if ($c->name == $this->originalClassname) {
                    $replacement = [[T_STATIC, "static", 2]];
                } else {
                    continue;
                }
            }

            if (!$replacement) {
                $resolvedClass = $this->resolveClass($c);
                $alias = $config->replace($this->originalUse->getAliasForClassname($resolvedClass));
                Logger::trace("Resolved class %s to %s", array($resolvedClass->classname, $alias));
                $replacement = array(array(308, $alias, 2));
            }

            $offset = $c->from;
            $length = $c->to - $c->from + 1;

            array_splice($this->tokens, $offset + $cumulativeOffset, $length, $replacement);

            $cumulativeOffset -= $length - 1;
        }
    }
public function shortenClasses($classesToFix, Configuration $config)
    {
        $cumulativeOffset = 0;

        /** @var FoundClass $c */
        foreach ($classesToFix as $c) {
            $replacement = [];

            if (in_array($c->name, $this->ignoredClassNames)) {
                if ($c->name == $this->originalClassname) {
                    $replacement = [[T_STATIC, "static", 2]];
                } else {
                    continue;
                }
            }

            if (!$replacement) {
                $resolvedClass = $this->resolveClass($c);
                $alias = $config->replace($this->originalUse->getAliasForClassname($resolvedClass));
                Logger::trace("Resolved class %s to %s", array($resolvedClass->classname, $alias));
                $replacement = array(array(308, $alias, 2));
            }

            $offset = $c->from;
            $length = $c->to - $c->from + 1;

            array_splice($this->tokens, $offset + $cumulativeOffset, $length, $replacement);

            $cumulativeOffset -= $length - 1;
        }
    }
public function shortenClasses ( $ classesToFix , Configuration $ config ) { $ cumulativeOffset = 0 ; /** @var FoundClass $c */ foreach ( $ classesToFix as $ c ) { $ replacement = [ ] ; if ( in_array ( $ c -> name , $ this -> ignoredClassNames ) ) { if ( $ c -> name == $ this -> originalClassname ) { $ replacement = [ [ T_STATIC , "static" , 2 ] ] ; } else { continue ; } } if ( ! $ replacement ) { $ resolvedClass = $ this -> resolveClass ( $ c ) ; $ alias = $ config -> replace ( $ this -> originalUse -> getAliasForClassname ( $ resolvedClass ) ) ; Logger :: trace ( "Resolved class %s to %s" , array ( $ resolvedClass -> classname , $ alias ) ) ; $ replacement = array ( array ( 308 , $ alias , 2 ) ) ; } $ offset = $ c -> from ; $ length = $ c -> to - $ c -> from + 1 ; array_splice ( $ this -> tokens , $ offset + $ cumulativeOffset , $ length , $ replacement ) ; $ cumulativeOffset -= $ length - 1 ; } }
fixClasses replaces all classnames with the shortest version of a class name possible

@param $classesToFix
@param $config
fixClasses replaces all classnames with the shortest version of a class name possible