Skip to content

Commit 0201fac

Browse files
authored
Prevent aliasing self class in use statements (#1830)
1 parent d11b2c3 commit 0201fac

File tree

9 files changed

+22
-13
lines changed

9 files changed

+22
-13
lines changed

src/CodeGenerator/src/Generator/PhpGenerator/ClassBuilder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ public function getClassName(): ClassName
5050

5151
public function addUse(string $name): self
5252
{
53+
if ($name === $this->className->getFqdn()) {
54+
return $this;
55+
}
56+
5357
$this->namespace->addUse($name);
5458

5559
return $this;

src/Service/DynamoDb/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
- AWS api-change: This change adds support for global tables with multi-Region strong consistency (in preview). The UpdateTable API now supports a new attribute MultiRegionConsistency to set consistency when creating global tables. The DescribeTable output now optionally includes the MultiRegionConsistency attribute.
88

9+
### Changed
10+
11+
- Avoid usage of `alias` when use statement refers to self
12+
913
## 3.3.1
1014

1115
### Changed

src/Service/DynamoDb/src/ValueObject/AttributeValue.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace AsyncAws\DynamoDb\ValueObject;
44

5-
use AsyncAws\DynamoDb\ValueObject\AttributeValue as AttributeValue1;
6-
75
/**
86
* Represents the data for an attribute.
97
*
@@ -133,8 +131,8 @@ public function __construct(array $input)
133131
$this->ss = $input['SS'] ?? null;
134132
$this->ns = $input['NS'] ?? null;
135133
$this->bs = $input['BS'] ?? null;
136-
$this->m = isset($input['M']) ? array_map([AttributeValue1::class, 'create'], $input['M']) : null;
137-
$this->l = isset($input['L']) ? array_map([AttributeValue1::class, 'create'], $input['L']) : null;
134+
$this->m = isset($input['M']) ? array_map([AttributeValue::class, 'create'], $input['M']) : null;
135+
$this->l = isset($input['L']) ? array_map([AttributeValue::class, 'create'], $input['L']) : null;
138136
$this->null = $input['NULL'] ?? null;
139137
$this->bool = $input['BOOL'] ?? null;
140138
}

src/Service/RdsDataService/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## NOT RELEASED
44

5+
### Changed
6+
7+
- Avoid usage of `alias` when use statement refers to self
8+
59
## 2.2.0
610

711
### Added

src/Service/RdsDataService/src/ValueObject/ArrayValue.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace AsyncAws\RdsDataService\ValueObject;
44

5-
use AsyncAws\RdsDataService\ValueObject\ArrayValue as ArrayValue1;
6-
75
/**
86
* Contains an array.
97
*/
@@ -59,7 +57,7 @@ public function __construct(array $input)
5957
$this->longValues = $input['longValues'] ?? null;
6058
$this->doubleValues = $input['doubleValues'] ?? null;
6159
$this->stringValues = $input['stringValues'] ?? null;
62-
$this->arrayValues = isset($input['arrayValues']) ? array_map([ArrayValue1::class, 'create'], $input['arrayValues']) : null;
60+
$this->arrayValues = isset($input['arrayValues']) ? array_map([ArrayValue::class, 'create'], $input['arrayValues']) : null;
6361
}
6462

6563
/**

src/Service/S3/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
### Changed
1111

12+
- Avoid usage of `alias` when use statement refers to self
1213
- AWS enhancement: Documentation updates.
1314

1415
## 2.6.0

src/Service/S3/src/ValueObject/EventBridgeConfiguration.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
namespace AsyncAws\S3\ValueObject;
44

5-
use AsyncAws\S3\ValueObject\EventBridgeConfiguration as EventBridgeConfiguration1;
6-
75
/**
86
* A container for specifying the configuration for Amazon EventBridge.
97
*/
108
final class EventBridgeConfiguration
119
{
1210
/**
13-
* @param array|EventBridgeConfiguration1 $input
11+
* @param array|EventBridgeConfiguration $input
1412
*/
1513
public static function create($input): self
1614
{

src/Service/TimestreamQuery/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## NOT RELEASED
44

5+
### Changed
6+
7+
- Avoid usage of `alias` when use statement refers to self
8+
59
## 2.1.0
610

711
### Added

src/Service/TimestreamQuery/src/ValueObject/Datum.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace AsyncAws\TimestreamQuery\ValueObject;
44

5-
use AsyncAws\TimestreamQuery\ValueObject\Datum as Datum1;
6-
75
/**
86
* Datum represents a single data point in a query result.
97
*/
@@ -57,7 +55,7 @@ public function __construct(array $input)
5755
{
5856
$this->scalarValue = $input['ScalarValue'] ?? null;
5957
$this->timeSeriesValue = isset($input['TimeSeriesValue']) ? array_map([TimeSeriesDataPoint::class, 'create'], $input['TimeSeriesValue']) : null;
60-
$this->arrayValue = isset($input['ArrayValue']) ? array_map([Datum1::class, 'create'], $input['ArrayValue']) : null;
58+
$this->arrayValue = isset($input['ArrayValue']) ? array_map([Datum::class, 'create'], $input['ArrayValue']) : null;
6159
$this->rowValue = isset($input['RowValue']) ? Row::create($input['RowValue']) : null;
6260
$this->nullValue = $input['NullValue'] ?? null;
6361
}

0 commit comments

Comments
 (0)