Skip to content

Commit 52723f0

Browse files
committed
Add aliases for Context class because newer phpunit versions have a global Context class
1 parent 332c96d commit 52723f0

22 files changed

+65
-68
lines changed

src/DocBlock.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
namespace phpDocumentor\Reflection;
1414

1515
use phpDocumentor\Reflection\DocBlock\Tag;
16-
use phpDocumentor\Reflection\Types\Context;
1716
use Webmozart\Assert\Assert;
1817

1918
final class DocBlock
@@ -27,7 +26,7 @@ final class DocBlock
2726
/** @var Tag[] An array containing all the tags in this docblock; except inline. */
2827
private $tags = array();
2928

30-
/** @var Context Information about the context of this DocBlock. */
29+
/** @var Types\Context Information about the context of this DocBlock. */
3130
private $context = null;
3231

3332
/** @var Location Information about the location of this DocBlock. */
@@ -43,7 +42,7 @@ final class DocBlock
4342
* @param string $summary
4443
* @param DocBlock\Description $description
4544
* @param DocBlock\Tag[] $tags
46-
* @param Context $context The context in which the DocBlock occurs.
45+
* @param Types\Context $context The context in which the DocBlock occurs.
4746
* @param Location $location The location within the file that this DocBlock occurs in.
4847
* @param bool $isTemplateStart
4948
* @param bool $isTemplateEnd
@@ -52,7 +51,7 @@ public function __construct(
5251
$summary = '',
5352
DocBlock\Description $description = null,
5453
array $tags = [],
55-
Context $context = null,
54+
Types\Context $context = null,
5655
Location $location = null,
5756
$isTemplateStart = false,
5857
$isTemplateEnd = false
@@ -95,7 +94,7 @@ public function getDescription()
9594
/**
9695
* Returns the current context.
9796
*
98-
* @return Context
97+
* @return Types\Context
9998
*/
10099
public function getContext()
101100
{

src/DocBlock/DescriptionFactory.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace phpDocumentor\Reflection\DocBlock;
1414

15-
use phpDocumentor\Reflection\Types\Context;
15+
use phpDocumentor\Reflection\Types\Context as TypeContext;
1616

1717
/**
1818
* Creates a new Description object given a body of text.
@@ -50,11 +50,11 @@ public function __construct(TagFactory $tagFactory)
5050
* Returns the parsed text of this description.
5151
*
5252
* @param string $contents
53-
* @param Context $context
53+
* @param TypeContext $context
5454
*
5555
* @return Description
5656
*/
57-
public function create($contents, Context $context = null)
57+
public function create($contents, TypeContext $context = null)
5858
{
5959
list($text, $tags) = $this->parse($this->lex($contents), $context);
6060

@@ -112,11 +112,11 @@ private function lex($contents)
112112
* Parses the stream of tokens in to a new set of tokens containing Tags.
113113
*
114114
* @param string[] $tokens
115-
* @param Context $context
115+
* @param TypeContext $context
116116
*
117117
* @return string[]|Tag[]
118118
*/
119-
private function parse($tokens, Context $context)
119+
private function parse($tokens, TypeContext $context)
120120
{
121121
$count = count($tokens);
122122
$tagCount = 0;

src/DocBlock/StandardTagFactory.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use phpDocumentor\Reflection\DocBlock\Tags\Factory\StaticMethod;
1616
use phpDocumentor\Reflection\DocBlock\Tags\Generic;
1717
use phpDocumentor\Reflection\FqsenResolver;
18-
use phpDocumentor\Reflection\Types\Context;
18+
use phpDocumentor\Reflection\Types\Context as TypeContext;
1919
use Webmozart\Assert\Assert;
2020

2121
/**
@@ -105,10 +105,10 @@ public function __construct(FqsenResolver $fqsenResolver, array $tagHandlers = n
105105
/**
106106
* {@inheritDoc}
107107
*/
108-
public function create($tagLine, Context $context = null)
108+
public function create($tagLine, TypeContext $context = null)
109109
{
110110
if (! $context) {
111-
$context = new Context('');
111+
$context = new TypeContext('');
112112
}
113113

114114
list($tagName, $tagBody) = $this->extractTagParts($tagLine);
@@ -180,11 +180,11 @@ private function extractTagParts($tagLine)
180180
*
181181
* @param string $body
182182
* @param string $name
183-
* @param Context $context
183+
* @param TypeContext $context
184184
*
185185
* @return Tag|null
186186
*/
187-
private function createTag($body, $name, Context $context)
187+
private function createTag($body, $name, TypeContext $context)
188188
{
189189
$handlerClassName = $this->findHandlerClassName($name, $context);
190190
$arguments = $this->getArgumentsForParametersFromWiring(
@@ -200,11 +200,11 @@ private function createTag($body, $name, Context $context)
200200
* Determines the Fully Qualified Class Name of the Factory or Tag (containing a Factory Method `create`).
201201
*
202202
* @param string $tagName
203-
* @param Context $context
203+
* @param TypeContext $context
204204
*
205205
* @return string
206206
*/
207-
private function findHandlerClassName($tagName, Context $context)
207+
private function findHandlerClassName($tagName, TypeContext $context)
208208
{
209209
$handlerClassName = Generic::class;
210210
if (isset($this->tagHandlerMappings[$tagName])) {
@@ -273,20 +273,20 @@ private function fetchParametersForHandlerFactoryMethod($handlerClassName)
273273
* Returns a copy of this class' Service Locator with added dynamic parameters, such as the tag's name, body and
274274
* Context.
275275
*
276-
* @param Context $context The Context (namespace and aliasses) that may be passed and is used to resolve FQSENs.
277-
* @param string $tagName The name of the tag that may be passed onto the factory method of the Tag class.
278-
* @param string $tagBody The body of the tag that may be passed onto the factory method of the Tag class.
276+
* @param TypeContext $context The Context (namespace and aliasses) that may be passed and is used to resolve FQSENs.
277+
* @param string $tagName The name of the tag that may be passed onto the factory method of the Tag class.
278+
* @param string $tagBody The body of the tag that may be passed onto the factory method of the Tag class.
279279
*
280280
* @return mixed[]
281281
*/
282-
private function getServiceLocatorWithDynamicParameters(Context $context, $tagName, $tagBody)
282+
private function getServiceLocatorWithDynamicParameters(TypeContext $context, $tagName, $tagBody)
283283
{
284284
$locator = array_merge(
285285
$this->serviceLocator,
286286
[
287-
'name' => $tagName,
288-
'body' => $tagBody,
289-
Context::class => $context
287+
'name' => $tagName,
288+
'body' => $tagBody,
289+
TypeContext::class => $context
290290
]
291291
);
292292

src/DocBlock/TagFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace phpDocumentor\Reflection\DocBlock;
1414

15-
use phpDocumentor\Reflection\Types\Context;
15+
use phpDocumentor\Reflection\Types\Context as TypeContext;
1616

1717
interface TagFactory
1818
{
@@ -61,13 +61,13 @@ public function addService($service);
6161
* Factory method responsible for instantiating the correct sub type.
6262
*
6363
* @param string $tagLine The text for this tag, including description.
64-
* @param Context $context
64+
* @param TypeContext $context
6565
*
6666
* @throws \InvalidArgumentException if an invalid tag line was presented.
6767
*
6868
* @return Tag A new tag object.
6969
*/
70-
public function create($tagLine, Context $context = null);
70+
public function create($tagLine, TypeContext $context = null);
7171

7272
/**
7373
* Registers a handler for tags.

src/DocBlock/Tags/Covers.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
1616
use phpDocumentor\Reflection\Fqsen;
1717
use phpDocumentor\Reflection\DocBlock\Description;
18-
use phpDocumentor\Reflection\Types\Context;
18+
use phpDocumentor\Reflection\Types\Context as TypeContext;
1919
use phpDocumentor\Reflection\FqsenResolver;
2020
use Webmozart\Assert\Assert;
2121

@@ -48,7 +48,7 @@ public static function create(
4848
$body,
4949
DescriptionFactory $descriptionFactory = null,
5050
FqsenResolver $resolver = null,
51-
Context $context = null
51+
TypeContext $context = null
5252
)
5353
{
5454
Assert::string($body);

src/DocBlock/Tags/Deprecated.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace phpDocumentor\Reflection\DocBlock\Tags;
1414

15-
use phpDocumentor\Reflection\Types\Context;
15+
use phpDocumentor\Reflection\Types\Context as TypeContext;
1616
use phpDocumentor\Reflection\DocBlock\Description;
1717
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
1818
use Webmozart\Assert\Assert;
@@ -54,7 +54,7 @@ public function __construct($version = null, Description $description = null)
5454
/**
5555
* @return static
5656
*/
57-
public static function create($body, DescriptionFactory $descriptionFactory = null, Context $context = null)
57+
public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null)
5858
{
5959
Assert::nullOrString($body);
6060
if (empty($body)) {

src/DocBlock/Tags/Generic.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use phpDocumentor\Reflection\DocBlock\Description;
1616
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
1717
use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
18-
use phpDocumentor\Reflection\Types\Context;
18+
use phpDocumentor\Reflection\Types\Context as TypeContext;
1919
use Webmozart\Assert\Assert;
2020

2121
/**
@@ -43,15 +43,15 @@ public function __construct($name, Description $description = null)
4343
* @param string $body
4444
* @param string $name
4545
* @param DescriptionFactory $descriptionFactory
46-
* @param Context $context
46+
* @param TypeContext $context
4747
*
4848
* @return static
4949
*/
5050
public static function create(
5151
$body,
5252
$name = '',
5353
DescriptionFactory $descriptionFactory = null,
54-
Context $context = null
54+
TypeContext $context = null
5555
) {
5656
Assert::string($body);
5757
Assert::stringNotEmpty($name);

src/DocBlock/Tags/Link.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
use phpDocumentor\Reflection\DocBlock\Description;
1616
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
17-
use phpDocumentor\Reflection\Types\Context;
17+
use phpDocumentor\Reflection\Types\Context as TypeContext;
1818
use Webmozart\Assert\Assert;
1919

2020
/**
@@ -44,7 +44,7 @@ public function __construct($link, Description $description = null)
4444
/**
4545
* {@inheritdoc}
4646
*/
47-
public static function create($body, DescriptionFactory $descriptionFactory = null, Context $context = null)
47+
public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null)
4848
{
4949
Assert::string($body);
5050
Assert::notNull($descriptionFactory);

src/DocBlock/Tags/Method.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
1717
use phpDocumentor\Reflection\Type;
1818
use phpDocumentor\Reflection\TypeResolver;
19-
use phpDocumentor\Reflection\Types\Context;
19+
use phpDocumentor\Reflection\Types\Context as TypeContext;
2020
use phpDocumentor\Reflection\Types\Void;
2121
use Webmozart\Assert\Assert;
2222

@@ -67,7 +67,7 @@ public static function create(
6767
$body,
6868
TypeResolver $typeResolver = null,
6969
DescriptionFactory $descriptionFactory = null,
70-
Context $context = null
70+
TypeContext $context = null
7171
) {
7272
Assert::stringNotEmpty($body);
7373
Assert::allNotNull([ $typeResolver, $descriptionFactory ]);

src/DocBlock/Tags/Param.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
1717
use phpDocumentor\Reflection\Type;
1818
use phpDocumentor\Reflection\TypeResolver;
19-
use phpDocumentor\Reflection\Types\Context;
19+
use phpDocumentor\Reflection\Types\Context as TypeContext;
2020
use Webmozart\Assert\Assert;
2121

2222
/**
@@ -60,9 +60,8 @@ public static function create(
6060
$body,
6161
TypeResolver $typeResolver = null,
6262
DescriptionFactory $descriptionFactory = null,
63-
Context $context = null
64-
)
65-
{
63+
TypeContext $context = null
64+
) {
6665
Assert::stringNotEmpty($body);
6766
Assert::allNotNull([$typeResolver, $descriptionFactory]);
6867

0 commit comments

Comments
 (0)