mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
Bump dependencies
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpDocumentor\Reflection\Assets;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Formatter;
|
||||
use phpDocumentor\Reflection\FqsenResolver;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Factory\StaticMethod;
|
||||
|
||||
final class CustomParam implements Tag, StaticMethod
|
||||
{
|
||||
public $myParam;
|
||||
public $fqsenResolver;
|
||||
|
||||
public function getName() : string
|
||||
{
|
||||
return 'spy';
|
||||
}
|
||||
|
||||
public static function create($body, FqsenResolver $fqsenResolver = null, ?string $myParam = null)
|
||||
{
|
||||
$tag = new self();
|
||||
$tag->fqsenResolver = $fqsenResolver;
|
||||
$tag->myParam = $myParam;
|
||||
|
||||
return $tag;
|
||||
}
|
||||
|
||||
public function render(?Formatter $formatter = null) : string
|
||||
{
|
||||
return $this->getName();
|
||||
}
|
||||
|
||||
public function __toString() : string
|
||||
{
|
||||
return $this->getName();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpDocumentor\Reflection\Assets;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Formatter;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter;
|
||||
use phpDocumentor\Reflection\FqsenResolver;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Factory\StaticMethod;
|
||||
|
||||
final class CustomServiceClass implements Tag, StaticMethod
|
||||
{
|
||||
public $formatter;
|
||||
|
||||
public function getName() : string
|
||||
{
|
||||
return 'spy';
|
||||
}
|
||||
|
||||
public static function create($body, PassthroughFormatter $formatter = null)
|
||||
{
|
||||
$tag = new self();
|
||||
$tag->formatter = $formatter;
|
||||
|
||||
return $tag;
|
||||
}
|
||||
|
||||
public function render(?Formatter $formatter = null) : string
|
||||
{
|
||||
return $this->getName();
|
||||
}
|
||||
|
||||
public function __toString() : string
|
||||
{
|
||||
return $this->getName();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpDocumentor\Reflection\Assets;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Formatter;
|
||||
use phpDocumentor\Reflection\FqsenResolver;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Factory\StaticMethod;
|
||||
|
||||
final class CustomServiceInterface implements Tag, StaticMethod
|
||||
{
|
||||
public $formatter;
|
||||
|
||||
public function getName() : string
|
||||
{
|
||||
return 'spy';
|
||||
}
|
||||
|
||||
public static function create($body, Formatter $formatter = null)
|
||||
{
|
||||
$tag = new self();
|
||||
$tag->formatter = $formatter;
|
||||
|
||||
return $tag;
|
||||
}
|
||||
|
||||
public function render(?Formatter $formatter = null) : string
|
||||
{
|
||||
return $this->getName();
|
||||
}
|
||||
|
||||
public function __toString() : string
|
||||
{
|
||||
return $this->getName();
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,9 @@ namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Mockery as m;
|
||||
use phpDocumentor\Reflection\Assets\CustomParam;
|
||||
use phpDocumentor\Reflection\Assets\CustomServiceClass;
|
||||
use phpDocumentor\Reflection\Assets\CustomServiceInterface;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Author;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Formatter;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter;
|
||||
@@ -169,13 +172,13 @@ class StandardTagFactoryTest extends TestCase
|
||||
{
|
||||
$resolver = m::mock(FqsenResolver::class);
|
||||
$tagFactory = new StandardTagFactory($resolver);
|
||||
$tagFactory->addParameter('myParam', 'myValue');
|
||||
$tagFactory->registerTagHandler('spy', CustomParam::class);
|
||||
|
||||
$this->assertAttributeSame(
|
||||
[FqsenResolver::class => $resolver, 'myParam' => 'myValue'],
|
||||
'serviceLocator',
|
||||
$tagFactory
|
||||
);
|
||||
$tagFactory->addParameter('myParam', 'myValue');
|
||||
$spy = $tagFactory->create('@spy');
|
||||
|
||||
$this->assertSame($resolver, $spy->fqsenResolver);
|
||||
$this->assertSame('myValue', $spy->myParam);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,12 +193,11 @@ class StandardTagFactoryTest extends TestCase
|
||||
$resolver = m::mock(FqsenResolver::class);
|
||||
$tagFactory = new StandardTagFactory($resolver);
|
||||
$tagFactory->addService($service);
|
||||
$tagFactory->registerTagHandler('spy', CustomServiceClass::class);
|
||||
|
||||
$this->assertAttributeSame(
|
||||
[FqsenResolver::class => $resolver, PassthroughFormatter::class => $service],
|
||||
'serviceLocator',
|
||||
$tagFactory
|
||||
);
|
||||
$spy = $tagFactory->create('@spy');
|
||||
|
||||
$this->assertSame($service, $spy->formatter);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,12 +213,11 @@ class StandardTagFactoryTest extends TestCase
|
||||
$resolver = m::mock(FqsenResolver::class);
|
||||
$tagFactory = new StandardTagFactory($resolver);
|
||||
$tagFactory->addService($service, $interfaceName);
|
||||
$tagFactory->registerTagHandler('spy', CustomServiceInterface::class);
|
||||
|
||||
$this->assertAttributeSame(
|
||||
[FqsenResolver::class => $resolver, $interfaceName => $service],
|
||||
'serviceLocator',
|
||||
$tagFactory
|
||||
);
|
||||
$spy = $tagFactory->create('@spy');
|
||||
|
||||
$this->assertSame($service, $spy->formatter);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user