You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
989 B
41 lines
989 B
<?php declare(strict_types=1);
|
|
/*
|
|
* This file is part of PHPUnit.
|
|
*
|
|
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
namespace PHPUnit\Metadata\Parser;
|
|
|
|
/**
|
|
* Attribute and annotation information is static within a single PHP process.
|
|
* It is therefore okay to use a Singleton registry here.
|
|
*
|
|
* @internal This class is not covered by the backward compatibility promise for PHPUnit
|
|
*/
|
|
final class Registry
|
|
{
|
|
private static ?Parser $instance = null;
|
|
|
|
public static function parser(): Parser
|
|
{
|
|
return self::$instance ?? self::$instance = self::build();
|
|
}
|
|
|
|
private function __construct()
|
|
{
|
|
}
|
|
|
|
private static function build(): Parser
|
|
{
|
|
return new CachingParser(
|
|
new ParserChain(
|
|
new AttributeParser,
|
|
new AnnotationParser,
|
|
),
|
|
);
|
|
}
|
|
}
|