From e30fc955f3a422555e5994b1e25b1dd34ef7b709 Mon Sep 17 00:00:00 2001 From: Lucas Michot Date: Thu, 2 Jul 2015 13:26:44 +0200 Subject: [PATCH 1/2] Add some style fixers --- .editorconfig | 13 +++++++++++++ .gitignore | 1 + .php_cs | 14 ++++++++++++++ .styleci.yml | 4 ++++ 4 files changed, 32 insertions(+) create mode 100644 .editorconfig create mode 100644 .php_cs create mode 100644 .styleci.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000000..ed1247ac692 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.yml] +indent_style = space +indent_size = 2 diff --git a/.gitignore b/.gitignore index fbeabd9bcd2..2c9d04ccd11 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.php_cs.cache phpunit.xml composer.lock composer.phar diff --git a/.php_cs b/.php_cs new file mode 100644 index 00000000000..28ec2062129 --- /dev/null +++ b/.php_cs @@ -0,0 +1,14 @@ +in(__DIR__); + +$fixers = array( + 'long_array_syntax', +); + +return Symfony\CS\Config\Config::create() + ->setUsingCache(true) + ->level(Symfony\CS\FixerInterface::PSR2_LEVEL) + ->fixers($fixers) + ->finder($finder); diff --git a/.styleci.yml b/.styleci.yml new file mode 100644 index 00000000000..e92503292bf --- /dev/null +++ b/.styleci.yml @@ -0,0 +1,4 @@ +preset: psr2 + +enabled: + - long_array_syntax From c297da1677996d59ccbe657aa90b2bc840679604 Mon Sep 17 00:00:00 2001 From: Lucas Michot Date: Thu, 2 Jul 2015 13:27:51 +0200 Subject: [PATCH 2/2] Fix code --- lib/Github/Api/ApiInterface.php | 1 - lib/Github/Api/Deployment.php | 21 ++++++++++--------- lib/Github/Api/Gist/Comments.php | 2 +- lib/Github/Api/Notification.php | 4 ++-- lib/Github/Api/Repository/Releases.php | 2 +- lib/Github/Api/Search.php | 1 - .../Tests/Api/Enterprise/UserAdminTest.php | 2 +- test/Github/Tests/Api/Gist/CommentsTest.php | 2 +- test/Github/Tests/Api/GistsTest.php | 2 +- 9 files changed, 18 insertions(+), 19 deletions(-) diff --git a/lib/Github/Api/ApiInterface.php b/lib/Github/Api/ApiInterface.php index 893f538e1ab..49d5167c29d 100644 --- a/lib/Github/Api/ApiInterface.php +++ b/lib/Github/Api/ApiInterface.php @@ -9,7 +9,6 @@ */ interface ApiInterface { - public function getPerPage(); public function setPerPage($perPage); diff --git a/lib/Github/Api/Deployment.php b/lib/Github/Api/Deployment.php index f8f3dbac953..c86e7a073ab 100644 --- a/lib/Github/Api/Deployment.php +++ b/lib/Github/Api/Deployment.php @@ -21,7 +21,7 @@ class Deployment extends AbstractApi * @return array the deployments requested */ public function all($username, $repository, array $params = array()) - { + { return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments', $params); } @@ -41,11 +41,11 @@ public function all($username, $repository, array $params = array()) */ public function create($username, $repository, array $params) { - if (!isset($params['ref'])) { - throw new MissingArgumentException(array('ref')); - } + if (!isset($params['ref'])) { + throw new MissingArgumentException(array('ref')); + } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments', $params); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments', $params); } /** @@ -64,10 +64,10 @@ public function create($username, $repository, array $params) */ public function updateStatus($username, $repository, $id, array $params) { - if (!isset($params['state'])) { - throw new MissingArgumentException(array('state')); - } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id).'/statuses', $params); + if (!isset($params['state'])) { + throw new MissingArgumentException(array('state')); + } + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id).'/statuses', $params); } /** @@ -78,7 +78,8 @@ public function updateStatus($username, $repository, $id, array $params) * @param int $id the deployment identifier * @return array the deployment statuses */ - public function getStatuses($username, $repository, $id) { + public function getStatuses($username, $repository, $id) + { return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id).'/statuses'); } } diff --git a/lib/Github/Api/Gist/Comments.php b/lib/Github/Api/Gist/Comments.php index 2d889650015..c0c5980aa3e 100644 --- a/lib/Github/Api/Gist/Comments.php +++ b/lib/Github/Api/Gist/Comments.php @@ -34,4 +34,4 @@ public function remove($gist, $comment) { return $this->delete('gists/'.rawurlencode($gist).'/comments/'.rawurlencode($comment)); } -} \ No newline at end of file +} diff --git a/lib/Github/Api/Notification.php b/lib/Github/Api/Notification.php index c351927ec5d..a2ed530ad28 100644 --- a/lib/Github/Api/Notification.php +++ b/lib/Github/Api/Notification.php @@ -32,7 +32,7 @@ public function all($includingRead = false, $participating = false, DateTime $si 'participating' => $participating ); - if($since !== null) { + if ($since !== null) { $parameters['since'] = $since->format(DateTime::ISO8601); } @@ -51,7 +51,7 @@ public function markRead(DateTime $since = null) { $parameters = array(); - if($since !== null) { + if ($since !== null) { $parameters['last_read_at'] = $since->format(DateTime::ISO8601); } diff --git a/lib/Github/Api/Repository/Releases.php b/lib/Github/Api/Repository/Releases.php index ec5bac4d4e5..94d130ef031 100644 --- a/lib/Github/Api/Repository/Releases.php +++ b/lib/Github/Api/Repository/Releases.php @@ -17,7 +17,7 @@ class Releases extends AbstractApi * * @param $username * @param $repository - * + * * @return array */ public function latest($username, $repository) diff --git a/lib/Github/Api/Search.php b/lib/Github/Api/Search.php index bd9f79110a3..cd55d5a1f94 100644 --- a/lib/Github/Api/Search.php +++ b/lib/Github/Api/Search.php @@ -16,7 +16,6 @@ */ class Search extends AbstractApi { - /** * Search repositories by filter (q). * diff --git a/test/Github/Tests/Api/Enterprise/UserAdminTest.php b/test/Github/Tests/Api/Enterprise/UserAdminTest.php index 42e6358bfff..34e6b6e910b 100644 --- a/test/Github/Tests/Api/Enterprise/UserAdminTest.php +++ b/test/Github/Tests/Api/Enterprise/UserAdminTest.php @@ -40,4 +40,4 @@ protected function getApiClass() { return 'Github\Api\Enterprise\UserAdmin'; } -} \ No newline at end of file +} diff --git a/test/Github/Tests/Api/Gist/CommentsTest.php b/test/Github/Tests/Api/Gist/CommentsTest.php index 77f3ca50faa..f44838c4c5a 100644 --- a/test/Github/Tests/Api/Gist/CommentsTest.php +++ b/test/Github/Tests/Api/Gist/CommentsTest.php @@ -91,4 +91,4 @@ protected function getApiClass() { return 'Github\Api\Gist\Comments'; } -} \ No newline at end of file +} diff --git a/test/Github/Tests/Api/GistsTest.php b/test/Github/Tests/Api/GistsTest.php index 77e6e132958..6a979c5ee19 100644 --- a/test/Github/Tests/Api/GistsTest.php +++ b/test/Github/Tests/Api/GistsTest.php @@ -242,4 +242,4 @@ protected function getApiClass() { return 'Github\Api\Gists'; } -} \ No newline at end of file +}