Skip to content

Commit c069569

Browse files
authored
Fix deprecations (#1934)
1 parent 2d98f6a commit c069569

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

src/Generator/ClientGenerator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use AsyncAws\Core\AwsError\XmlAwsErrorFactory;
1616
use AsyncAws\Core\Configuration;
1717
use AsyncAws\Core\Exception\UnsupportedRegion;
18-
use Nette\PhpGenerator\ClassType;
18+
use Nette\PhpGenerator\Visibility;
1919

2020
/**
2121
* Generate API client.
@@ -252,7 +252,7 @@ public function getVersion() {
252252

253253
$classBuilder->addMethod('getEndpointMetadata')
254254
->setReturnType('array')
255-
->setVisibility(ClassType::VISIBILITY_PROTECTED)
255+
->setVisibility(Visibility::Protected)
256256
->setBody(strtr($body, ['"$region"' => '$region']))
257257
->addParameter('region')
258258
->setType('string')
@@ -287,7 +287,7 @@ public function getVersion() {
287287
$errorFactoryBase = basename(str_replace('\\', '/', $errorFactory));
288288
$classBuilder->addMethod('getAwsErrorFactory')
289289
->setReturnType(AwsErrorFactoryInterface::class)
290-
->setVisibility(ClassType::VISIBILITY_PROTECTED)
290+
->setVisibility(Visibility::Protected)
291291
->setBody("return new $errorFactoryBase();")
292292
;
293293

src/Generator/EnumGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use AsyncAws\CodeGenerator\Generator\Naming\ClassName;
99
use AsyncAws\CodeGenerator\Generator\Naming\NamespaceRegistry;
1010
use AsyncAws\CodeGenerator\Generator\PhpGenerator\ClassRegistry;
11-
use Nette\PhpGenerator\ClassType;
11+
use Nette\PhpGenerator\Visibility;
1212

1313
/**
1414
* Generate Enum shapeused by Input and Result classes.
@@ -64,7 +64,7 @@ public function generate(Shape $shape): ClassName
6464
ksort($consts);
6565
$availableConsts = [];
6666
foreach ($consts as $constName => $constValue) {
67-
$classBuilder->addConstant($constName, $constValue)->setVisibility(ClassType::VISIBILITY_PUBLIC);
67+
$classBuilder->addConstant($constName, $constValue)->setVisibility(Visibility::Public);
6868
$availableConsts[] = 'self::' . $constName . ' => true';
6969
}
7070
$classBuilder->addMethod('exists')

src/Generator/OperationGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
use AsyncAws\CodeGenerator\Generator\PhpGenerator\ClassRegistry;
1414
use AsyncAws\Core\RequestContext;
1515
use AsyncAws\Core\Result;
16-
use Nette\PhpGenerator\ClassType;
1716
use Nette\PhpGenerator\Method;
17+
use Nette\PhpGenerator\Visibility;
1818

1919
/**
2020
* Generate API client methods and result classes.
@@ -156,7 +156,7 @@ public function generate(Operation $operation): void
156156

157157
if ($operation->isEndpointOperation()) {
158158
$classBuilder->addMethod('discoverEndpoints')
159-
->setVisibility(ClassType::VISIBILITY_PROTECTED)
159+
->setVisibility(Visibility::Protected)
160160
->setReturnType('array')
161161
->setBody(strtr('
162162
return $this->METHOD($region ? ["@region" => $region] : [])->getEndpoints();

src/Generator/ResponseParser/RestJsonParser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
use AsyncAws\CodeGenerator\Generator\GeneratorHelper;
1717
use AsyncAws\CodeGenerator\Generator\Naming\ClassName;
1818
use AsyncAws\CodeGenerator\Generator\Naming\NamespaceRegistry;
19-
use Nette\PhpGenerator\ClassType;
2019
use Nette\PhpGenerator\Method;
20+
use Nette\PhpGenerator\Visibility;
2121

2222
/**
2323
* @author Tobias Nyholm <[email protected]>
@@ -433,7 +433,7 @@ private function parseResponseMap(MapShape $shape, string $input, bool $required
433433
private function createPopulateMethod(string $functionName, string $body, Shape $shape): Method
434434
{
435435
$method = new Method($functionName);
436-
$method->setVisibility(ClassType::VISIBILITY_PRIVATE)
436+
$method->setVisibility(Visibility::Private)
437437
->setBody($body)
438438
->addParameter('json')
439439
->setType('array')

src/Generator/ResponseParser/RestXmlParser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
use AsyncAws\CodeGenerator\Generator\GeneratorHelper;
1717
use AsyncAws\CodeGenerator\Generator\Naming\ClassName;
1818
use AsyncAws\CodeGenerator\Generator\Naming\NamespaceRegistry;
19-
use Nette\PhpGenerator\ClassType;
2019
use Nette\PhpGenerator\Method;
20+
use Nette\PhpGenerator\Visibility;
2121

2222
/**
2323
* @author Jérémy Derussé <[email protected]>
@@ -384,7 +384,7 @@ private function parseXmlResponseMap(MapShape $shape, string $input, bool $requi
384384
private function createPopulateMethod(string $functionName, string $body, Shape $shape): Method
385385
{
386386
$method = new Method($functionName);
387-
$method->setVisibility(ClassType::VISIBILITY_PRIVATE)
387+
$method->setVisibility(Visibility::Private)
388388
->setReturnType('array')
389389
->setBody($body)
390390
->addParameter('xml')

src/Generator/TestGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use AsyncAws\Core\Response;
2020
use AsyncAws\Core\Test\Http\SimpleMockedResponse;
2121
use AsyncAws\Core\Test\TestCase;
22-
use Nette\PhpGenerator\ClassType;
22+
use Nette\PhpGenerator\Visibility;
2323
use PHPUnit\Framework\TestCase as PHPUnitTestCase;
2424
use Psr\Log\NullLogger;
2525
use Symfony\Component\HttpClient\MockHttpClient;
@@ -404,7 +404,7 @@ private function createClientTestClass(ClassName $testClassName, Operation $oper
404404

405405
$classBuilder->setExtends(TestCase::class);
406406
$classBuilder->addMethod('getClient')
407-
->setVisibility(ClassType::VISIBILITY_PRIVATE)
407+
->setVisibility(Visibility::Private)
408408
->setReturnType($clientClassName->getFqdn())
409409
->setBody(strtr('
410410
MARKER

src/Generator/WaiterGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
use AsyncAws\Core\Response;
2323
use AsyncAws\Core\Result;
2424
use AsyncAws\Core\Waiter as WaiterResult;
25-
use Nette\PhpGenerator\ClassType;
25+
use Nette\PhpGenerator\Visibility;
2626
use Symfony\Contracts\HttpClient\ResponseInterface;
2727

2828
/**
@@ -143,9 +143,9 @@ private function generateWaiterResult(Waiter $waiter): ClassName
143143
$classBuilder = $this->classRegistry->register($className->getFqdn());
144144

145145
$classBuilder->addConstant('WAIT_TIMEOUT', (float) ($waiter->getMaxAttempts() * $waiter->getDelay()))
146-
->setVisibility(ClassType::VISIBILITY_PROTECTED);
146+
->setVisibility(Visibility::Protected);
147147
$classBuilder->addConstant('WAIT_DELAY', (float) $waiter->getDelay())
148-
->setVisibility(ClassType::VISIBILITY_PROTECTED);
148+
->setVisibility(Visibility::Protected);
149149

150150
$classBuilder->addUse(WaiterResult::class);
151151
$classBuilder->addUse(Result::class);
@@ -162,7 +162,7 @@ private function generateWaiterResult(Waiter $waiter): ClassName
162162

163163
$classBuilder->addMethod('refreshState')
164164
->setReturnType(WaiterResult::class)
165-
->setVisibility(ClassType::VISIBILITY_PROTECTED)
165+
->setVisibility(Visibility::Protected)
166166
->setBody(strtr('
167167
if (!$this->awsClient instanceOf CLIENT_CLASSNAME) {
168168
throw new InvalidArgument(\'missing client injected in waiter result\');

0 commit comments

Comments
 (0)