Inconsistent Array Declaration

This PR normalises the declaration of arrays throughout the project, and adds
this to the php-cs-fixer rules.

I've chosen "short" by default, but happy to change the PR to use "long" if
preferred.
This commit is contained in:
Anthony Sterling
2017-10-02 09:05:05 +01:00
parent 49ed1c9e8f
commit cebeae15a3
5 changed files with 9 additions and 8 deletions

View File

@@ -9,6 +9,7 @@ return PhpCsFixer\Config::create()
->setUsingCache(false) ->setUsingCache(false)
->setRules([ ->setRules([
'@PSR2' => true, '@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
]) ])
->setFinder($finder) ->setFinder($finder)
; ;

View File

@@ -37,7 +37,7 @@ class Guzzle implements Adapter
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function get(String $uri, array $query = array(), array $headers = array()): ResponseInterface public function get(String $uri, array $query = [], array $headers = []): ResponseInterface
{ {
$response = $this->client->get($uri, ['query' => $query, 'headers' => $headers]); $response = $this->client->get($uri, ['query' => $query, 'headers' => $headers]);
@@ -48,7 +48,7 @@ class Guzzle implements Adapter
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function post(String $uri, array $headers = array(), array $body = array()): ResponseInterface public function post(String $uri, array $headers = [], array $body = []): ResponseInterface
{ {
$response = $this->client->post( $response = $this->client->post(
$uri, $uri,
@@ -65,7 +65,7 @@ class Guzzle implements Adapter
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function put(String $uri, array $headers = array(), array $body = array()): ResponseInterface public function put(String $uri, array $headers = [], array $body = []): ResponseInterface
{ {
$jsonBody = json_encode($body); $jsonBody = json_encode($body);
@@ -84,7 +84,7 @@ class Guzzle implements Adapter
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function patch(String $uri, array $headers = array(), array $body = array()): ResponseInterface public function patch(String $uri, array $headers = [], array $body = []): ResponseInterface
{ {
$jsonBody = json_encode($body); $jsonBody = json_encode($body);
@@ -103,7 +103,7 @@ class Guzzle implements Adapter
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function delete(String $uri, array $headers = array(), array $body = array()): ResponseInterface public function delete(String $uri, array $headers = [], array $body = []): ResponseInterface
{ {
$response = $this->client->delete( $response = $this->client->delete(
$uri, $uri,

View File

@@ -10,7 +10,7 @@ namespace Cloudflare\API\Configurations;
class PageRulesActions implements Configurations class PageRulesActions implements Configurations
{ {
private $configs = array(); private $configs = [];
public function setAlwaysOnline(bool $active) public function setAlwaysOnline(bool $active)
{ {

View File

@@ -10,7 +10,7 @@ namespace Cloudflare\API\Configurations;
class UARules implements Configurations class UARules implements Configurations
{ {
private $configs = array(); private $configs = [];
public function addUA(string $value) public function addUA(string $value)
{ {

View File

@@ -10,7 +10,7 @@ namespace Cloudflare\API\Configurations;
class ZoneLockdown implements Configurations class ZoneLockdown implements Configurations
{ {
private $configs = array(); private $configs = [];
public function addIP(string $value) public function addIP(string $value)
{ {