Skip to content

Commit ab969af

Browse files
authored
Merge pull request #670 from phpDocumentor/fix/async-asymmetric
Rename Async to Asymmetric
2 parents 8b40078 + cd6e375 commit ab969af

File tree

8 files changed

+33
-32
lines changed

8 files changed

+33
-32
lines changed

src/phpDocumentor/Reflection/Php/AsyncVisibility.php renamed to src/phpDocumentor/Reflection/Php/AsymmetricVisibility.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace phpDocumentor\Reflection\Php;
66

77
/** @api */
8-
final class AsyncVisibility extends Visibility
8+
final class AsymmetricVisibility extends Visibility
99
{
1010
public function __construct(
1111
private Visibility $readVisibility,

src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use phpDocumentor\Reflection\DocBlockFactoryInterface;
88
use phpDocumentor\Reflection\Fqsen;
99
use phpDocumentor\Reflection\Location;
10-
use phpDocumentor\Reflection\Php\AsyncVisibility;
10+
use phpDocumentor\Reflection\Php\AsymmetricVisibility;
1111
use phpDocumentor\Reflection\Php\Factory\Reducer\Reducer;
1212
use phpDocumentor\Reflection\Php\Property as PropertyElement;
1313
use phpDocumentor\Reflection\Php\PropertyHook;
@@ -159,11 +159,11 @@ public function build(ContextStack $context): PropertyElement
159159
}
160160

161161
/**
162-
* Returns true when current property has async accessors.
162+
* Returns true when current property has asymmetric accessors.
163163
*
164164
* This method will always return false when your phpparser version is < 5.2
165165
*/
166-
private function isAsync(Param|PropertyIterator $node): bool
166+
private function isAsymmetric(Param|PropertyIterator $node): bool
167167
{
168168
if (method_exists($node, 'isPrivateSet') === false) {
169169
return false;
@@ -174,7 +174,7 @@ private function isAsync(Param|PropertyIterator $node): bool
174174

175175
private function buildVisibility(Param|PropertyIterator $node): Visibility
176176
{
177-
if ($this->isAsync($node) === false) {
177+
if ($this->isAsymmetric($node) === false) {
178178
return $this->buildReadVisibility($node);
179179
}
180180

@@ -185,7 +185,7 @@ private function buildVisibility(Param|PropertyIterator $node): Visibility
185185
return $readVisibility;
186186
}
187187

188-
return new AsyncVisibility(
188+
return new AsymmetricVisibility(
189189
$readVisibility,
190190
$writeVisibility,
191191
);
@@ -266,7 +266,7 @@ private function buildHook(PropertyHookNode $hook, ContextStack $context, Visibi
266266

267267
private function buildHookVisibility(string $hookName, Visibility $propertyVisibility): Visibility
268268
{
269-
if ($propertyVisibility instanceof AsyncVisibility === false) {
269+
if ($propertyVisibility instanceof AsymmetricVisibility === false) {
270270
return $propertyVisibility;
271271
}
272272

src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ public function isPublic(): bool
5454
}
5555

5656
/**
57-
* Returns async accessor value for current property.
57+
* Returns asymmetric accessor value for current property.
5858
*
5959
* This method will return the same value as {@see self::isPublic()} when your phpparser version is < 5.2
6060
*/
6161
public function isPublicSet(): bool
6262
{
63-
if ($this->isAsync() === false) {
63+
if ($this->isAsymmetric() === false) {
6464
return $this->isPublic();
6565
}
6666

@@ -76,13 +76,13 @@ public function isProtected(): bool
7676
}
7777

7878
/**
79-
* Returns async accessor value for current property.
79+
* Returns asymetric accessor value for current property.
8080
*
8181
* This method will return the same value as {@see self::isProtected()} when your phpparser version is < 5.2
8282
*/
8383
public function isProtectedSet(): bool
8484
{
85-
if ($this->isAsync() === false) {
85+
if ($this->isAsymmetric() === false) {
8686
return $this->isProtected();
8787
}
8888

@@ -98,25 +98,25 @@ public function isPrivate(): bool
9898
}
9999

100100
/**
101-
* Returns async accessor value for current property.
101+
* Returns asymetric accessor value for current property.
102102
*
103103
* This method will return the same value as {@see self::isPrivate()} when your phpparser version is < 5.2
104104
*/
105105
public function isPrivateSet(): bool
106106
{
107-
if ($this->isAsync() === false) {
107+
if ($this->isAsymmetric() === false) {
108108
return $this->isPrivate();
109109
}
110110

111111
return $this->property->isPrivateSet();
112112
}
113113

114114
/**
115-
* Returns true when current property has async accessors.
115+
* Returns true when current property has asymetric accessors.
116116
*
117117
* This method will always return false when your phpparser version is < 5.2
118118
*/
119-
public function isAsync(): bool
119+
public function isAsymmetric(): bool
120120
{
121121
if (method_exists($this->property, 'isPrivateSet') === false) {
122122
return false;

tests/integration/AsyncAccessorTest.php renamed to tests/integration/AsymmetricAccessorTest.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,42 @@
1111

1212
/** @coversNothing */
1313
#[RequiresPackage('nikic/php-parser', '>= 5.2')]
14-
final class AsyncAccessorTest extends TestCase
14+
final class AsymmetricAccessorTest extends TestCase
1515
{
16-
public function testAsyncAccessor(): void
16+
public function testAsymmetricAccessor(): void
1717
{
18-
$file = __DIR__ . '/data/PHP84/AsyncAccessor.php';
18+
$file = __DIR__ . '/data/PHP84/AsymmetricAccessor.php';
1919
$projectFactory = ProjectFactory::createInstance();
2020
$project = $projectFactory->create('My project', [new LocalFile($file)]);
2121

22-
$class = $project->getFiles()[$file]->getClasses()['\AsyncAccessor'];
22+
$class = $project->getFiles()[$file]->getClasses()['\AsymmetricAccessor'];
2323

2424
self::assertEquals(
2525
'public',
26-
$class->getProperties()['\AsyncAccessor::$pizza']->getVisibility()->getReadVisibility(),
26+
$class->getProperties()['\AsymmetricAccessor::$pizza']->getVisibility()->getReadVisibility(),
2727
);
2828
self::assertEquals(
2929
'private',
30-
$class->getProperties()['\AsyncAccessor::$pizza']->getVisibility()->getWriteVisibility(),
30+
$class->getProperties()['\AsymmetricAccessor::$pizza']->getVisibility()->getWriteVisibility(),
3131
);
3232
}
3333

3434
public function testAsyncPropertyPromotion(): void
3535
{
36-
$file = __DIR__ . '/data/PHP84/AsyncPropertyPromotion.php';
36+
$file = __DIR__ . '/data/PHP84/AsymmetricPropertyPromotion.php';
3737
$projectFactory = ProjectFactory::createInstance();
3838
$project = $projectFactory->create('My project', [new LocalFile($file)]);
3939

40-
$class = $project->getFiles()[$file]->getClasses()['\AsyncPropertyPromotion'];
40+
41+
$class = $project->getFiles()[$file]->getClasses()['\AsymmetricPropertyPromotion'];
4142

4243
self::assertEquals(
4344
'public',
44-
$class->getProperties()['\AsyncPropertyPromotion::$pizza']->getVisibility()->getReadVisibility(),
45+
$class->getProperties()['\AsymmetricPropertyPromotion::$pizza']->getVisibility()->getReadVisibility(),
4546
);
4647
self::assertEquals(
4748
'protected',
48-
$class->getProperties()['\AsyncPropertyPromotion::$pizza']->getVisibility()->getWriteVisibility(),
49+
$class->getProperties()['\AsymmetricPropertyPromotion::$pizza']->getVisibility()->getWriteVisibility(),
4950
);
5051
}
5152
}

tests/integration/PropertyHookTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use phpDocumentor\Reflection\File\LocalFile;
1010
use phpDocumentor\Reflection\Location;
1111
use phpDocumentor\Reflection\Php\Argument;
12-
use phpDocumentor\Reflection\Php\AsyncVisibility;
12+
use phpDocumentor\Reflection\Php\AsymmetricVisibility;
1313
use phpDocumentor\Reflection\Php\Attribute;
1414
use phpDocumentor\Reflection\Php\ProjectFactory;
1515
use phpDocumentor\Reflection\Php\PropertyHook;
@@ -24,7 +24,7 @@
2424
#[CoversNothing]
2525
final class PropertyHookTest extends TestCase
2626
{
27-
public function testPropertyHookWithDocblocks()
27+
public function testPropertyHookWithDocblocks(): void
2828
{
2929
$file = __DIR__ . '/data/PHP84/PropertyHook.php';
3030
$projectFactory = ProjectFactory::createInstance();
@@ -56,9 +56,9 @@ public function testPropertyHookWithDocblocks()
5656
$this->assertSame('Not sure this works, but it gets', $hooks[0]->getDocBlock()->getSummary());
5757
}
5858

59-
public function testPropertyHookAsync()
59+
public function testPropertyHookAsymmetric(): void
6060
{
61-
$file = __DIR__ . '/data/PHP84/PropertyHookAsync.php';
61+
$file = __DIR__ . '/data/PHP84/PropertyHookAsymmetric.php';
6262
$projectFactory = ProjectFactory::createInstance();
6363
$project = $projectFactory->create('My project', [new LocalFile($file)]);
6464

@@ -67,7 +67,7 @@ public function testPropertyHookAsync()
6767

6868

6969
$this->assertEquals(
70-
new AsyncVisibility(
70+
new AsymmetricVisibility(
7171
new Visibility(Visibility::PUBLIC_),
7272
new Visibility(Visibility::PRIVATE_)
7373
),

tests/integration/data/PHP84/AsyncAccessor.php renamed to tests/integration/data/PHP84/AsymmetricAccessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
class AsyncAccessor
5+
class AsymmetricAccessor
66
{
77
private(set) \Pizza $pizza;
88
}

tests/integration/data/PHP84/AsyncPropertyPromotion.php renamed to tests/integration/data/PHP84/AsymmetricPropertyPromotion.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
class AsyncPropertyPromotion
5+
class AsymmetricPropertyPromotion
66
{
77
public function __construct(
88
protected(set) Pizza $pizza,

0 commit comments

Comments
 (0)