Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions build/ClientAnnotator.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,33 @@ class ClientAnnotator
{
/** @var ReflectionClass */
private $reflection;

/** @var ReflectionClass|null */
private $reflectionInterface;

/** @var string */
private $endpoint;

/** @var string[] */
private $versions;

/** @var array */
private $methods;

/** @var array */
private $aliases;


public function __construct($clientClassName)
{
$this->reflection = new ReflectionClass($clientClassName);
$this->reflectionInterface = null;
// Check if client has an interface
$interfaceName = $clientClassName . 'Interface';
if (interface_exists($interfaceName)) {
$this->reflectionInterface = new ReflectionClass($interfaceName);
}

$this->aliases = \Aws\load_compiled_json(__DIR__ . '/../src/data/aliases.json');
}

Expand All @@ -36,6 +50,17 @@ public function updateApiMethodAnnotations()
'/^\* @method (\\\\Aws\\\\Result|\\\\GuzzleHttp\\\\Promise\\\\Promise) /'
);

if ($this->reflectionInterface !== null) {
$interfaceUpdater = new ClassAnnotationUpdater(
$this->reflectionInterface,
$this->getMethodAnnotations(),
$this->getDefaultDocComment(),
'/^\* @method (\\\\Aws\\\\Result|\\\\GuzzleHttp\\\\Promise\\\\Promise) /'
);

return $interfaceUpdater->update() && $updater->update();
}

return $updater->update();
}

Expand Down