Skip to content

Commit f3770d6

Browse files
committed
Use PHPCS 2.x
1 parent 78aabb3 commit f3770d6

20 files changed

+212
-174
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ before_script:
3636

3737
script:
3838
- vendor/bin/phpunit
39-
- if [ "$RUN_PHPCS" == "yes" ]; then vendor/bin/phpcs -p --report=full --extensions=php --standard=.travis/phpcs/Joomla/ruleset.xml src/; fi;
39+
- if [ "$RUN_PHPCS" == "yes" ]; then vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards && vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml src/; fi;

.travis/phpcs/Joomla

Lines changed: 0 additions & 1 deletion
This file was deleted.

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"joomla/uri": "~1.0|~2.0"
1313
},
1414
"require-dev": {
15-
"phpunit/phpunit": "^4.8.35|^5.4.3|~6.0",
16-
"squizlabs/php_codesniffer": "1.*"
15+
"joomla/coding-standards": "~2.0@alpha",
16+
"phpunit/phpunit": "^4.8.35|^5.4.3|~6.0"
1717
},
1818
"autoload": {
1919
"psr-4": {

ruleset.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Joomla">
3+
4+
<arg name="report" value="full"/>
5+
<arg name="tab-width" value="4"/>
6+
<arg name="encoding" value="utf-8"/>
7+
<arg value="sp"/>
8+
<arg name="colors" />
9+
10+
<!-- Exclude folders not containing production code -->
11+
<exclude-pattern>*/.github/*</exclude-pattern>
12+
<exclude-pattern>*/.travis/*</exclude-pattern>
13+
14+
<!-- Exclude 3rd party libraries. -->
15+
<exclude-pattern>*/vendor/*</exclude-pattern>
16+
17+
<rule ref="Joomla">
18+
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
19+
<!-- Required due to converting to variable names matching GitHub API spec which are named in snake case -->
20+
<exclude name="Joomla.NamingConventions.ValidVariableName"/>
21+
</rule>
22+
23+
<rule ref="Joomla.Classes.InstantiateNewClasses">
24+
<properties>
25+
<property name="shortArraySyntax" value="true"/>
26+
</properties>
27+
</rule>
28+
</ruleset>

src/Package/Authorization.php

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -264,25 +264,24 @@ public function getRateLimit()
264264
/**
265265
* 1. Request authorization on GitHub.
266266
*
267-
* @param string $client_id The client ID you received from GitHub when you registered.
268-
* @param string $redirect_uri URL in your app where users will be sent after authorization.
269-
* @param string $scope Comma separated list of scopes.
270-
* @param string $state An unguessable random string. It is used to protect against
271-
* cross-site request forgery attacks.
267+
* @param string $clientId The client ID you received from GitHub when you registered.
268+
* @param string $redirectUri URL in your app where users will be sent after authorization.
269+
* @param string $scope Comma separated list of scopes.
270+
* @param string $state An unguessable random string. It is used to protect against cross-site request forgery attacks.
272271
*
273272
* @return string
274273
*
275274
* @since 1.0
276275
*/
277-
public function getAuthorizationLink($client_id, $redirect_uri = '', $scope = '', $state = '')
276+
public function getAuthorizationLink($clientId, $redirectUri = '', $scope = '', $state = '')
278277
{
279278
$uri = new Uri('https://github.com/login/oauth/authorize');
280279

281-
$uri->setVar('client_id', $client_id);
280+
$uri->setVar('client_id', $clientId);
282281

283-
if ($redirect_uri)
282+
if ($redirectUri)
284283
{
285-
$uri->setVar('redirect_uri', urlencode($redirect_uri));
284+
$uri->setVar('redirect_uri', urlencode($redirectUri));
286285
}
287286

288287
if ($scope)
@@ -301,30 +300,30 @@ public function getAuthorizationLink($client_id, $redirect_uri = '', $scope = ''
301300
/**
302301
* 2. Request the access token.
303302
*
304-
* @param string $client_id The client ID you received from GitHub when you registered.
305-
* @param string $client_secret The client secret you received from GitHub when you registered.
306-
* @param string $code The code you received as a response to Step 1.
307-
* @param string $redirect_uri URL in your app where users will be sent after authorization.
308-
* @param string $format The response format (json, xml, ).
303+
* @param string $clientId The client ID you received from GitHub when you registered.
304+
* @param string $clientSecret The client secret you received from GitHub when you registered.
305+
* @param string $code The code you received as a response to Step 1.
306+
* @param string $redirectUri URL in your app where users will be sent after authorization.
307+
* @param string $format The response format (json, xml, ).
309308
*
310309
* @return string
311310
*
312311
* @since 1.0
313312
* @throws \UnexpectedValueException
314313
*/
315-
public function requestToken($client_id, $client_secret, $code, $redirect_uri = '', $format = '')
314+
public function requestToken($clientId, $clientSecret, $code, $redirectUri = '', $format = '')
316315
{
317316
$uri = 'https://github.com/login/oauth/access_token';
318317

319318
$data = array(
320-
'client_id' => $client_id,
321-
'client_secret' => $client_secret,
319+
'client_id' => $clientId,
320+
'client_secret' => $clientSecret,
322321
'code' => $code
323322
);
324323

325-
if ($redirect_uri)
324+
if ($redirectUri)
326325
{
327-
$data['redirect_uri'] = $redirect_uri;
326+
$data['redirect_uri'] = $redirectUri;
328327
}
329328

330329
$headers = array();

src/Package/Data/Tags.php

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,35 +50,34 @@ public function get($owner, $repo, $sha)
5050
* and then create the refs/tags/[tag] reference. If you want to create a lightweight tag,
5151
* you simply have to create the reference - this call would be unnecessary.
5252
*
53-
* @param string $owner The name of the owner of the GitHub repository.
54-
* @param string $repo The name of the GitHub repository.
55-
* @param string $tag The tag string.
56-
* @param string $message The tag message.
57-
* @param string $object The SHA of the git object this is tagging.
58-
* @param string $type The type of the object we’re tagging. Normally this is a commit
59-
* but it can also be a tree or a blob.
60-
* @param string $tagger_name The name of the author of the tag.
61-
* @param string $tagger_email The email of the author of the tag.
62-
* @param string $tagger_date Timestamp of when this object was tagged.
53+
* @param string $owner The name of the owner of the GitHub repository.
54+
* @param string $repo The name of the GitHub repository.
55+
* @param string $tag The tag string.
56+
* @param string $message The tag message.
57+
* @param string $object The SHA of the git object this is tagging.
58+
* @param string $type The type of the object we’re tagging. Normally this is a commit but it can also be a tree or a blob.
59+
* @param string $taggerName The name of the author of the tag.
60+
* @param string $taggerEmail The email of the author of the tag.
61+
* @param string $taggerDate Timestamp of when this object was tagged.
6362
*
64-
* @since 1.0
63+
* @return object
6564
*
66-
* @return object
65+
* @since 1.0
6766
*/
68-
public function create($owner, $repo, $tag, $message, $object, $type, $tagger_name, $tagger_email, $tagger_date)
67+
public function create($owner, $repo, $tag, $message, $object, $type, $taggerName, $taggerEmail, $taggerDate)
6968
{
7069
// Build the request path.
7170
$path = '/repos/' . $owner . '/' . $repo . '/git/tags';
7271

7372
$data = array(
74-
'tag' => $tag,
75-
'message' => $message,
76-
'object' => $object,
77-
'type' => $type,
73+
'tag' => $tag,
74+
'message' => $message,
75+
'object' => $object,
76+
'type' => $type,
7877
'tagger' => array(
79-
'name' => $tagger_name,
80-
'email' => $tagger_email,
81-
'date' => $tagger_date
78+
'name' => $taggerName,
79+
'email' => $taggerEmail,
80+
'date' => $taggerDate
8281
)
8382
);
8483

src/Package/Data/Trees.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function getRecursively($owner, $repo, $sha)
6868
* modifying that tree are specified, it will overwrite the contents of that tree with the
6969
* new path contents and write a new tree out.
7070
*
71-
* Parameters fir the tree:
71+
* Parameters for the tree:
7272
*
7373
* tree.path
7474
* String of the file referenced in the tree
@@ -84,17 +84,16 @@ public function getRecursively($owner, $repo, $sha)
8484
* String of content you want this file to have - GitHub will write this blob out and use
8585
* that SHA for this entry. Use either this or tree.sha
8686
*
87-
* @param string $owner The name of the owner of the GitHub repository.
88-
* @param string $repo The name of the GitHub repository.
89-
* @param array $tree Array of Hash objects (of path, mode, type and sha) specifying
90-
* a tree structure
91-
* @param string $base_tree The SHA1 of the tree you want to update with new data.
87+
* @param string $owner The name of the owner of the GitHub repository.
88+
* @param string $repo The name of the GitHub repository.
89+
* @param array $tree Array of Hash objects (of path, mode, type and sha) specifying a tree structure
90+
* @param string $baseTree The SHA1 of the tree you want to update with new data.
9291
*
93-
* @since 1.0
92+
* @return object
9493
*
95-
* @return object
94+
* @since 1.0
9695
*/
97-
public function create($owner, $repo, $tree, $base_tree = '')
96+
public function create($owner, $repo, $tree, $baseTree = '')
9897
{
9998
// Build the request path.
10099
$path = '/repos/' . $owner . '/' . $repo . '/git/trees';
@@ -103,9 +102,9 @@ public function create($owner, $repo, $tree, $base_tree = '')
103102

104103
$data['tree'] = $tree;
105104

106-
if ($base_tree)
105+
if ($baseTree)
107106
{
108-
$data['base_tree'] = $base_tree;
107+
$data['base_tree'] = $baseTree;
109108
}
110109

111110
return $this->processResponse(

src/Package/Issues.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ class Issues extends AbstractPackage
4343
* @since 1.0
4444
* @throws \DomainException
4545
*/
46-
public function create($user, $repo, $title, $body = null, $assignee = null, $milestone = null, array $labels = array(), array $assignees = array())
46+
public function create($user, $repo, $title, $body = null, $assignee = null, $milestone = null, array $labels = array(),
47+
array $assignees = array()
48+
)
4749
{
4850
// Build the request path.
4951
$path = '/repos/' . $user . '/' . $repo . '/issues';
@@ -101,7 +103,9 @@ public function create($user, $repo, $title, $body = null, $assignee = null, $mi
101103
* @since 1.0
102104
* @throws \DomainException
103105
*/
104-
public function edit($user, $repo, $issueId, $state = null, $title = null, $body = null, $assignee = null, $milestone = null, array $labels = null)
106+
public function edit($user, $repo, $issueId, $state = null, $title = null, $body = null, $assignee = null, $milestone = null,
107+
array $labels = null
108+
)
105109
{
106110
// Build the request path.
107111
$path = '/repos/' . $user . '/' . $repo . '/issues/' . (int) $issueId;
@@ -197,7 +201,8 @@ public function get($user, $repo, $issueId)
197201
* @throws \DomainException
198202
*/
199203
public function getList($filter = null, $state = null, $labels = null, $sort = null,
200-
$direction = null, \DateTime $since = null, $page = 0, $limit = 0)
204+
$direction = null, \DateTime $since = null, $page = 0, $limit = 0
205+
)
201206
{
202207
// Build the request path.
203208
$path = '/issues';
@@ -260,7 +265,8 @@ public function getList($filter = null, $state = null, $labels = null, $sort = n
260265
* @throws \DomainException
261266
*/
262267
public function getListByRepository($user, $repo, $milestone = null, $state = null, $assignee = null, $mentioned = null, $labels = null,
263-
$sort = null, $direction = null, \DateTime $since = null, $page = 0, $limit = 0)
268+
$sort = null, $direction = null, \DateTime $since = null, $page = 0, $limit = 0
269+
)
264270
{
265271
// Build the request path.
266272
$path = '/repos/' . $user . '/' . $repo . '/issues';

src/Package/Issues/Events.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ class Events extends AbstractPackage
2626
/**
2727
* List events for an issue.
2828
*
29-
* @param string $owner The name of the owner of the GitHub repository.
30-
* @param string $repo The name of the GitHub repository.
31-
* @param integer $issue_number The issue number.
32-
* @param integer $page The page number from which to get items.
33-
* @param integer $limit The number of items on a page.
29+
* @param string $owner The name of the owner of the GitHub repository.
30+
* @param string $repo The name of the GitHub repository.
31+
* @param integer $issueNumber The issue number.
32+
* @param integer $page The page number from which to get items.
33+
* @param integer $limit The number of items on a page.
3434
*
3535
* @return object
3636
*/
37-
public function getList($owner, $repo, $issue_number, $page = 0, $limit = 0)
37+
public function getList($owner, $repo, $issueNumber, $page = 0, $limit = 0)
3838
{
3939
// Build the request path.
40-
$path = '/repos/' . $owner . '/' . $repo . '/issues/' . (int) $issue_number . '/events';
40+
$path = '/repos/' . $owner . '/' . $repo . '/issues/' . (int) $issueNumber . '/events';
4141

4242
// Send the request.
4343
return $this->processResponse(

0 commit comments

Comments
 (0)