Skip to content

Commit cf6dfcf

Browse files
committed
Fix deprecations
1 parent 6d4d8ca commit cf6dfcf

File tree

7 files changed

+17
-10
lines changed

7 files changed

+17
-10
lines changed

src/CodeGenerator/src/Generator/ClientGenerator.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use AsyncAws\Core\Configuration;
1717
use AsyncAws\Core\Exception\UnsupportedRegion;
1818
use Nette\PhpGenerator\ClassType;
19+
use Nette\PhpGenerator\Visibility;
1920

2021
/**
2122
* Generate API client.
@@ -252,7 +253,7 @@ public function getVersion() {
252253

253254
$classBuilder->addMethod('getEndpointMetadata')
254255
->setReturnType('array')
255-
->setVisibility(ClassType::VISIBILITY_PROTECTED)
256+
->setVisibility(Visibility::Protected)
256257
->setBody(strtr($body, ['"$region"' => '$region']))
257258
->addParameter('region')
258259
->setType('string')
@@ -287,7 +288,7 @@ public function getVersion() {
287288
$errorFactoryBase = basename(str_replace('\\', '/', $errorFactory));
288289
$classBuilder->addMethod('getAwsErrorFactory')
289290
->setReturnType(AwsErrorFactoryInterface::class)
290-
->setVisibility(ClassType::VISIBILITY_PROTECTED)
291+
->setVisibility(Visibility::Protected)
291292
->setBody("return new $errorFactoryBase();")
292293
;
293294

src/CodeGenerator/src/Generator/EnumGenerator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use AsyncAws\CodeGenerator\Generator\Naming\NamespaceRegistry;
1010
use AsyncAws\CodeGenerator\Generator\PhpGenerator\ClassRegistry;
1111
use Nette\PhpGenerator\ClassType;
12+
use Nette\PhpGenerator\Visibility;
1213

1314
/**
1415
* Generate Enum shapeused by Input and Result classes.
@@ -64,7 +65,7 @@ public function generate(Shape $shape): ClassName
6465
ksort($consts);
6566
$availableConsts = [];
6667
foreach ($consts as $constName => $constValue) {
67-
$classBuilder->addConstant($constName, $constValue)->setVisibility(ClassType::VISIBILITY_PUBLIC);
68+
$classBuilder->addConstant($constName, $constValue)->setVisibility(Visibility::Public);
6869
$availableConsts[] = 'self::' . $constName . ' => true';
6970
}
7071
$classBuilder->addMethod('exists')

src/CodeGenerator/src/Generator/OperationGenerator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use AsyncAws\Core\Result;
1616
use Nette\PhpGenerator\ClassType;
1717
use Nette\PhpGenerator\Method;
18+
use Nette\PhpGenerator\Visibility;
1819

1920
/**
2021
* Generate API client methods and result classes.
@@ -156,7 +157,7 @@ public function generate(Operation $operation): void
156157

157158
if ($operation->isEndpointOperation()) {
158159
$classBuilder->addMethod('discoverEndpoints')
159-
->setVisibility(ClassType::VISIBILITY_PROTECTED)
160+
->setVisibility(Visibility::Protected)
160161
->setReturnType('array')
161162
->setBody(strtr('
162163
return $this->METHOD($region ? ["@region" => $region] : [])->getEndpoints();

src/CodeGenerator/src/Generator/ResponseParser/RestJsonParser.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use AsyncAws\CodeGenerator\Generator\Naming\NamespaceRegistry;
1919
use Nette\PhpGenerator\ClassType;
2020
use Nette\PhpGenerator\Method;
21+
use Nette\PhpGenerator\Visibility;
2122

2223
/**
2324
* @author Tobias Nyholm <[email protected]>
@@ -433,7 +434,7 @@ private function parseResponseMap(MapShape $shape, string $input, bool $required
433434
private function createPopulateMethod(string $functionName, string $body, Shape $shape): Method
434435
{
435436
$method = new Method($functionName);
436-
$method->setVisibility(ClassType::VISIBILITY_PRIVATE)
437+
$method->setVisibility(Visibility::Private)
437438
->setBody($body)
438439
->addParameter('json')
439440
->setType('array')

src/CodeGenerator/src/Generator/ResponseParser/RestXmlParser.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use AsyncAws\CodeGenerator\Generator\Naming\NamespaceRegistry;
1919
use Nette\PhpGenerator\ClassType;
2020
use Nette\PhpGenerator\Method;
21+
use Nette\PhpGenerator\Visibility;
2122

2223
/**
2324
* @author Jérémy Derussé <[email protected]>
@@ -384,7 +385,7 @@ private function parseXmlResponseMap(MapShape $shape, string $input, bool $requi
384385
private function createPopulateMethod(string $functionName, string $body, Shape $shape): Method
385386
{
386387
$method = new Method($functionName);
387-
$method->setVisibility(ClassType::VISIBILITY_PRIVATE)
388+
$method->setVisibility(Visibility::Private)
388389
->setReturnType('array')
389390
->setBody($body)
390391
->addParameter('xml')

src/CodeGenerator/src/Generator/TestGenerator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use AsyncAws\Core\Test\Http\SimpleMockedResponse;
2121
use AsyncAws\Core\Test\TestCase;
2222
use Nette\PhpGenerator\ClassType;
23+
use Nette\PhpGenerator\Visibility;
2324
use PHPUnit\Framework\TestCase as PHPUnitTestCase;
2425
use Psr\Log\NullLogger;
2526
use Symfony\Component\HttpClient\MockHttpClient;
@@ -404,7 +405,7 @@ private function createClientTestClass(ClassName $testClassName, Operation $oper
404405

405406
$classBuilder->setExtends(TestCase::class);
406407
$classBuilder->addMethod('getClient')
407-
->setVisibility(ClassType::VISIBILITY_PRIVATE)
408+
->setVisibility(Visibility::Private)
408409
->setReturnType($clientClassName->getFqdn())
409410
->setBody(strtr('
410411
MARKER

src/CodeGenerator/src/Generator/WaiterGenerator.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use AsyncAws\Core\Result;
2424
use AsyncAws\Core\Waiter as WaiterResult;
2525
use Nette\PhpGenerator\ClassType;
26+
use Nette\PhpGenerator\Visibility;
2627
use Symfony\Contracts\HttpClient\ResponseInterface;
2728

2829
/**
@@ -143,9 +144,9 @@ private function generateWaiterResult(Waiter $waiter): ClassName
143144
$classBuilder = $this->classRegistry->register($className->getFqdn());
144145

145146
$classBuilder->addConstant('WAIT_TIMEOUT', (float) ($waiter->getMaxAttempts() * $waiter->getDelay()))
146-
->setVisibility(ClassType::VISIBILITY_PROTECTED);
147+
->setVisibility(Visibility::Protected);
147148
$classBuilder->addConstant('WAIT_DELAY', (float) $waiter->getDelay())
148-
->setVisibility(ClassType::VISIBILITY_PROTECTED);
149+
->setVisibility(Visibility::Protected);
149150

150151
$classBuilder->addUse(WaiterResult::class);
151152
$classBuilder->addUse(Result::class);
@@ -162,7 +163,7 @@ private function generateWaiterResult(Waiter $waiter): ClassName
162163

163164
$classBuilder->addMethod('refreshState')
164165
->setReturnType(WaiterResult::class)
165-
->setVisibility(ClassType::VISIBILITY_PROTECTED)
166+
->setVisibility(Visibility::Protected)
166167
->setBody(strtr('
167168
if (!$this->awsClient instanceOf CLIENT_CLASSNAME) {
168169
throw new InvalidArgument(\'missing client injected in waiter result\');

0 commit comments

Comments
 (0)