Skip to content

Commit

Permalink
Updating min language req to 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dcarbone committed Oct 15, 2017
1 parent 0f8cec3 commit ba1cb72
Show file tree
Hide file tree
Showing 59 changed files with 466 additions and 469 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"php-consul-api"
],
"require": {
"php": "^5.6 || ^7.0",
"php": "^7.0",
"guzzlehttp/guzzle": "~6",
"guzzlehttp/psr7": "~1"
},
Expand All @@ -26,7 +26,7 @@
}
},
"require-dev": {
"phpunit/phpunit": "^5.7 || ^6.0"
"phpunit/phpunit": "^6.0"
},
"autoload-dev": {
"psr-4": {
Expand Down
14 changes: 7 additions & 7 deletions src/ACL/ACLClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ACLClient extends AbstractClient {
* @type \DCarbone\PHPConsulAPI\Error|null error, if any
* )
*/
public function create(ACLEntry $acl, WriteOptions $options = null) {
public function create(ACLEntry $acl, WriteOptions $options = null): array {
$r = new Request('PUT', 'v1/acl/create', $this->config, $acl);
$r->setWriteOptions($options);

Expand Down Expand Up @@ -63,7 +63,7 @@ public function create(ACLEntry $acl, WriteOptions $options = null) {
* @type \DCarbone\PHPConsulAPI\Error|null error, if any
* )
*/
public function update(ACLEntry $acl, WriteOptions $options = null) {
public function update(ACLEntry $acl, WriteOptions $options = null): array {
$r = new Request('PUT', 'v1/acl/update', $this->config, $acl);
$r->setWriteOptions($options);

Expand All @@ -84,7 +84,7 @@ public function update(ACLEntry $acl, WriteOptions $options = null) {
* @type \DCarbone\PHPConsulAPI\Error|null error, if any
* )
*/
public function destroy($id, WriteOptions $options = null) {
public function destroy(string $id, WriteOptions $options = null): array {
$r = new Request('PUT', sprintf('v1/acl/destroy/%s', $id), $this->config);
$r->setWriteOptions($options);

Expand All @@ -106,7 +106,7 @@ public function destroy($id, WriteOptions $options = null) {
* @type \DCarbone\PHPConsulAPI\Error|null error, if any
* )
*/
public function cloneACL($id, WriteOptions $options = null) {
public function clone(string $id, WriteOptions $options = null): array {
$r = new Request('PUT', sprintf('v1/acl/clone/%s', $id), $this->config);
$r->setWriteOptions($options);

Expand Down Expand Up @@ -135,7 +135,7 @@ public function cloneACL($id, WriteOptions $options = null) {
* @type \DCarbone\PHPConsulAPI\Error|null error, if any
* )
*/
public function info($id, QueryOptions $options = null) {
public function info(string $id, QueryOptions $options = null): array {
$r = new Request('GET', sprintf('v1/acl/info/%s', $id), $this->config);
$r->setQueryOptions($options);

Expand Down Expand Up @@ -168,7 +168,7 @@ public function info($id, QueryOptions $options = null) {
* @type \DCarbone\PHPConsulAPI\Error|null error, if any
* )
*/
public function listACLs(QueryOptions $options = null) {
public function list(QueryOptions $options = null): array {
$r = new Request('GET', 'v1/acl/list', $this->config);
$r->setQueryOptions($options);

Expand Down Expand Up @@ -201,7 +201,7 @@ public function listACLs(QueryOptions $options = null) {
* @type \DCarbone\PHPConsulAPI\Error
* )
*/
public function replication(QueryOptions $options = null) {
public function replication(QueryOptions $options = null): array {
$r = new Request('GET', '/v1/acl/replication', $this->config);
$r->setQueryOptions($options);

Expand Down
24 changes: 12 additions & 12 deletions src/ACL/ACLEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,84 +39,84 @@ class ACLEntry extends AbstractModel {
/**
* @return int
*/
public function getCreateIndex() {
public function getCreateIndex(): int {
return $this->CreateIndex;
}

/**
* @param int $CreateIndex
*/
public function setCreateIndex($CreateIndex) {
public function setCreateIndex(int $CreateIndex): void {
$this->CreateIndex = $CreateIndex;
}

/**
* @return int
*/
public function getModifyIndex() {
public function getModifyIndex(): int {
return $this->ModifyIndex;
}

/**
* @param int $ModifyIndex
*/
public function setModifyIndex($ModifyIndex) {
public function setModifyIndex(int $ModifyIndex): void {
$this->ModifyIndex = $ModifyIndex;
}

/**
* @return string
*/
public function getID() {
public function getID(): string {
return $this->ID;
}

/**
* @param string $ID
*/
public function setID($ID) {
public function setID(string $ID): void {
$this->ID = $ID;
}

/**
* @return string
*/
public function getName() {
public function getName(): string {
return $this->Name;
}

/**
* @param string $Name
*/
public function setName($Name) {
public function setName(string $Name): void {
$this->Name = $Name;
}

/**
* @return string
*/
public function getType() {
public function getType(): string {
return $this->Type;
}

/**
* @param string $Type
*/
public function setType($Type) {
public function setType(string $Type): void {
$this->Type = $Type;
}

/**
* @return string
*/
public function getRules() {
public function getRules(): string {
return $this->Rules;
}

/**
* @param string $Rules
*/
public function setRules($Rules) {
public function setRules(string $Rules): void {
$this->Rules = $Rules;
}
}
12 changes: 6 additions & 6 deletions src/ACL/ACLReplicationStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,42 +39,42 @@ class ACLReplicationStatus extends AbstractModel {
/**
* @return bool
*/
public function isEnabled() {
public function isEnabled(): bool {
return $this->Enabled;
}

/**
* @return bool
*/
public function isRunning() {
public function isRunning(): bool {
return $this->Running;
}

/**
* @return string
*/
public function getSourceDatacenter() {
public function getSourceDatacenter(): string {
return $this->SourceDatacenter;
}

/**
* @return int
*/
public function getReplicatedIndex() {
public function getReplicatedIndex(): int {
return $this->ReplicatedIndex;
}

/**
* @return null|string
*/
public function getLastSuccess() {
public function getLastSuccess(): ?string {
return $this->LastSuccess;
}

/**
* @return null|string
*/
public function getLastError() {
public function getLastError(): ?string {
return $this->LastError;
}
}
20 changes: 10 additions & 10 deletions src/AbstractClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(Config $config) {
/**
* @return \DCarbone\PHPConsulAPI\Config
*/
public function getConfig() {
public function getConfig(): Config {
return $this->config;
}

Expand All @@ -54,7 +54,7 @@ public function getConfig() {
* @type \DCarbone\PHPConsulAPI\Error|null error, if any
* )
*/
protected function requireOK(array $r) {
protected function requireOK(array $r): array {
// If a previous error occurred, just return as-is.
if (null !== $r[2]) {
return $r;
Expand Down Expand Up @@ -103,7 +103,7 @@ protected function requireOK(array $r) {
* @type \DCarbone\PHPConsulAPI\Error|null any seen errors
* )
*/
protected function doRequest(Request $r) {
protected function doRequest(Request $r): array {
$rt = microtime(true);
$response = null;
$err = null;
Expand Down Expand Up @@ -132,11 +132,11 @@ protected function doRequest(Request $r) {

/**
* @param int $duration
* @param ResponseInterface $response
* @param UriInterface $uri
* @return QueryMeta
* @param \Psr\Http\Message\ResponseInterface $response
* @param \Psr\Http\Message\UriInterface $uri
* @return \DCarbone\PHPConsulAPI\QueryMeta
*/
protected function buildQueryMeta($duration, ResponseInterface $response, UriInterface $uri) {
protected function buildQueryMeta(int $duration, ResponseInterface $response, UriInterface $uri): QueryMeta {
$qm = new QueryMeta();

$qm->RequestTime = $duration;
Expand Down Expand Up @@ -167,9 +167,9 @@ protected function buildQueryMeta($duration, ResponseInterface $response, UriInt

/**
* @param int $duration
* @return WriteMeta
* @return \DCarbone\PHPConsulAPI\WriteMeta
*/
protected function buildWriteMeta($duration) {
protected function buildWriteMeta(int $duration): WriteMeta {
$wm = new WriteMeta();
$wm->RequestTime = $duration;

Expand All @@ -183,7 +183,7 @@ protected function buildWriteMeta($duration) {
* @type \DCarbone\PHPConsulAPI\Error|null error, if any
* )
*/
protected function decodeBody(StreamInterface $body) {
protected function decodeBody(StreamInterface $body): array {
$data = @json_decode((string)$body, true);

if (JSON_ERROR_NONE === json_last_error()) {
Expand Down
Loading

0 comments on commit ba1cb72

Please sign in to comment.