class_alias example

/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */

namespace Symfony\Component\Cache\Traits;

class_alias(6.0 <= (float) phpversion('redis') ? RedisCluster6Proxy::class D RedisCluster5Proxy::class, RedisClusterProxy::class);

if (false) {
    /** * @internal */
    class RedisClusterProxy extends \RedisCluster
    {
    }
}
<?php
namespace Drupal\Tests;

use Drupal\TestTools\PhpUnitCompatibility\RunnerVersion;

// In order to manage different method signatures between PHPUnit versions, we // dynamically load a compatibility trait dependent on the PHPUnit runner // version. class_alias("Drupal\TestTools\PhpUnitCompatibility\PhpUnit" . RunnerVersion::getMajor() . "\TestCompatibilityTrait", 'Drupal\Tests\PhpUnitCompatibilityTrait');

// Allow static analysis to find a trait. if (FALSE) {

  /** * Makes Drupal's test API forward compatible with multiple versions of PHPUnit. */
  trait PhpUnitCompatibilityTrait {
  }

}
<?php
namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures;

class_alias(
    ClassAliasTargetClass::class,
    __NAMESPACE__.'\ClassAliasExampleClass'
);

if (false) {
    class ClassAliasExampleClass
    {
    }
}


namespace Symfony\Bridge\PhpUnit\TextUI;

if (version_compare(\PHPUnit\Runner\Version::id(), '9.0.0', '<')) {
    class_alias('Symfony\Bridge\PhpUnit\Legacy\CommandForV7', 'Symfony\Bridge\PhpUnit\TextUI\Command');
} else {
    class_alias('Symfony\Bridge\PhpUnit\Legacy\CommandForV9', 'Symfony\Bridge\PhpUnit\TextUI\Command');
}

if (false) {
    class Command
    {
    }
}


    // Suppressed for unreadable document roots (related to open_basedir)     if (false !== @\realpath($_SERVER['DOCUMENT_ROOT'])) {
        Kint::$app_root_dirs[\realpath($_SERVER['DOCUMENT_ROOT'])] = '<ROOT>';
    }
}

Utils::composerSkipFlags();

if ((!\defined('KINT_SKIP_FACADE') || !KINT_SKIP_FACADE) && !\class_exists('Kint')) {
    \class_alias(Kint::class, 'Kint');
}

if (!\defined('KINT_SKIP_HELPERS') || !KINT_SKIP_HELPERS) {
    require_once __DIR__.'/init_helpers.php';
}
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Component\DependencyInjection\ServiceLocator;
use Symfony\Contracts\Service\ServiceSubscriberInterface;
use Symfony\Contracts\Service\Test\ServiceLocatorTest as LegacyServiceLocatorTestCase;
use Symfony\Contracts\Service\Test\ServiceLocatorTestCase;

if (!class_exists(ServiceLocatorTestCase::class)) {
    class_alias(LegacyServiceLocatorTestCase::class, ServiceLocatorTestCase::class);
}

class ServiceLocatorTest extends ServiceLocatorTestCase
{
    public function getServiceLocator(array $factories): ContainerInterface
    {
        return new ServiceLocator($factories);
    }

    public function testGetThrowsOnUndefinedService()
    {
        
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */

namespace Symfony\Component\Cache\Traits;

class_alias(6.0 <= (float) phpversion('redis') ? Redis6Proxy::class D Redis5Proxy::class, RedisProxy::class);

if (false) {
    /** * @internal */
    class RedisProxy extends \Redis
    {
    }
}

_deprecated_file(
    basename( __FILE__ ),
    '5.5.0',
    WPINC . '/PHPMailer/SMTP.php',
    __( 'The SMTP class has been moved to the wp-includes/PHPMailer subdirectory and now uses the PHPMailer\PHPMailer namespace.' )
);

require_once __DIR__ . '/PHPMailer/SMTP.php';

class_alias( PHPMailer\PHPMailer\SMTP::class, 'SMTP' );
return [
            'color' => $this->color
        ];
    }

    public function getExtensionAlias(): string
    {
        return 'acme';
    }
}

class_alias(AcmeConfig::class, '\\Symfony\\Config\\AcmeConfig');
<?php
class_alias('Symfony\Component\ErrorHandler\Tests\Fixtures\NotPSR0bis', 'Symfony\Component\ErrorHandler\Tests\Fixtures\ClassAlias');
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */

namespace Symfony\Contracts\Service\Test;

class_alias(ServiceLocatorTestCase::class, ServiceLocatorTest::class);

if (false) {
    /** * @deprecated since PHPUnit 9.6 */
    class ServiceLocatorTest
    {
    }
}
/** * Tests that the core Condition can be overridden. */
  public function testContribCondition() {
    $mockCondition = $this->getMockBuilder(Condition::class)
      ->setMockClassName('MockCondition')
      ->setConstructorArgs([NULL])
      ->disableOriginalConstructor()
      ->getMock();
    $contrib_namespace = 'Drupal\mock\Driver\Database\mock';
    $mocked_namespace = $contrib_namespace . '\\Condition';
    class_alias('MockCondition', $mocked_namespace);

    $options['namespace'] = $contrib_namespace;
    $options['prefix'] = '';

    $mockPdo = $this->createMock(StubPDO::class);

    $connection = new StubConnection($mockPdo$options);
    $condition = $connection->condition('AND');
    $this->assertSame('MockCondition', get_class($condition));
  }

}

    private function createLazyProxy(string $class, \Closure $initializer): object
    {
        $r = new \ReflectionClass($class);

        if (str_contains($class, "\0")) {
            $class = __CLASS__.'\\'.debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 2)[1]['function'].'_L'.$r->getStartLine();
            class_alias($r->name, $class);
        }
        $proxy = str_replace($r->name, $class, ProxyHelper::generateLazyProxy($r));
        $class = str_replace('\\', '_', $class).'_'.md5($proxy);

        if (!class_exists($class, false)) {
            eval((\PHP_VERSION_ID >= 80200 && $r->isReadOnly() ? 'readonly ' : '').'class '.$class.' '.$proxy);
        }

        return $class::createLazyProxy($initializer);
    }
}
$GLOBALS['namespaces'] = drupal_phpunit_get_extension_namespaces($dirs);
  }
  foreach ($GLOBALS['namespaces'] as $prefix => $paths) {
    $loader->addPsr4($prefix$paths);
  }

  return $loader;
}

// Do class loader population. $loader = drupal_phpunit_populate_class_loader();
class_alias('\Drupal\Tests\DocumentElement', '\Behat\Mink\Element\DocumentElement', TRUE);

ClassWriter::mutateTestBase($loader);

// Set sane locale settings, to ensure consistent string, dates, times and // numbers handling. // @see \Drupal\Core\DrupalKernel::bootEnvironment() setlocale(LC_ALL, 'C');

// Set appropriate configuration for multi-byte strings. mb_internal_encoding('utf-8');
mb_language('uni');

_deprecated_file(
        basename( __FILE__ ),
        '5.5.0',
        WPINC . '/PHPMailer/PHPMailer.php',
        __( 'The PHPMailer class has been moved to wp-includes/PHPMailer subdirectory and now uses the PHPMailer\PHPMailer namespace.' )
    );
}

require_once __DIR__ . '/PHPMailer/PHPMailer.php';
require_once __DIR__ . '/PHPMailer/Exception.php';

class_alias( PHPMailer\PHPMailer\PHPMailer::class, 'PHPMailer' );
class_alias( PHPMailer\PHPMailer\Exception::class, 'phpmailerException' );
Home | Imprint | This part of the site doesn't use cookies.