Skip to content

Commit 6158035

Browse files
committed
Optimize function calls for PHP 7 based on zend_try_compile_special_func
1 parent b730624 commit 6158035

19 files changed

Lines changed: 46 additions & 46 deletions

src/AbstractGithubObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function __construct(Registry $options = null, BaseHttp $client = null)
8585
$this->options = $options ?: new Registry;
8686
$this->client = $client ?: new Http($this->options);
8787

88-
$this->package = get_class($this);
88+
$this->package = \get_class($this);
8989
$this->package = substr($this->package, strrpos($this->package, '\\') + 1);
9090
}
9191

src/AbstractPackage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(Registry $options = null, BaseHttp $client = null)
3030
{
3131
parent::__construct($options, $client);
3232

33-
$this->package = get_class($this);
33+
$this->package = \get_class($this);
3434
$this->package = substr($this->package, strrpos($this->package, '\\') + 1);
3535
}
3636

src/Package/Activity/Starring.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function getRepositories($user = '', $sort = 'created', $direction = 'des
5959
$allowedSort = array('created', 'updated');
6060
$allowedDir = array('asc', 'desc');
6161

62-
if (!in_array($sort, $allowedSort))
62+
if (!\in_array($sort, $allowedSort))
6363
{
6464
throw new \InvalidArgumentException(
6565
sprintf(
@@ -69,7 +69,7 @@ public function getRepositories($user = '', $sort = 'created', $direction = 'des
6969
);
7070
}
7171

72-
if (!in_array($direction, $allowedDir))
72+
if (!\in_array($direction, $allowedDir))
7373
{
7474
throw new \InvalidArgumentException(
7575
sprintf(

src/Package/Issues.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function create($user, $repo, $title, $body = null, $assignee = null, $mi
6464
'body' => $body
6565
);
6666

67-
if (is_string($assignee) && !empty($assignees))
67+
if (\is_string($assignee) && !empty($assignees))
6868
{
6969
throw new \UnexpectedValueException('You cannot pass both assignee and assignees. Only one may be provided.');
7070
}
@@ -73,7 +73,7 @@ public function create($user, $repo, $title, $body = null, $assignee = null, $mi
7373
{
7474
$data['assignees'] = array_values($assignees);
7575
}
76-
elseif (is_string($assignee))
76+
elseif (\is_string($assignee))
7777
{
7878
$data['assignee'] = $assignee;
7979
}

src/Package/Issues/Comments.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function getRepositoryList($owner, $repo, $sort = 'created', $direction =
7474
// Build the request path.
7575
$path = '/repos/' . $owner . '/' . $repo . '/issues/comments';
7676

77-
if (false == in_array($sort, array('created', 'updated')))
77+
if (false == \in_array($sort, array('created', 'updated')))
7878
{
7979
throw new \UnexpectedValueException(
8080
sprintf(
@@ -83,7 +83,7 @@ public function getRepositoryList($owner, $repo, $sort = 'created', $direction =
8383
);
8484
}
8585

86-
if (false == in_array($direction, array('asc', 'desc')))
86+
if (false == \in_array($direction, array('asc', 'desc')))
8787
{
8888
throw new \UnexpectedValueException(
8989
sprintf(

src/Package/Issues/Milestones.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,17 @@ public function create($user, $repo, $title, $state = null, $description = null,
9797
'title' => $title
9898
);
9999

100-
if (!is_null($state))
100+
if (!\is_null($state))
101101
{
102102
$data['state'] = $state;
103103
}
104104

105-
if (!is_null($description))
105+
if (!\is_null($description))
106106
{
107107
$data['description'] = $description;
108108
}
109109

110-
if (!is_null($dueOn))
110+
if (!\is_null($dueOn))
111111
{
112112
$data['due_on'] = $dueOn;
113113
}
@@ -143,22 +143,22 @@ public function edit($user, $repo, $milestoneId, $title = null, $state = null, $
143143
// Build the request data.
144144
$data = array();
145145

146-
if (!is_null($title))
146+
if (!\is_null($title))
147147
{
148148
$data['title'] = $title;
149149
}
150150

151-
if (!is_null($state))
151+
if (!\is_null($state))
152152
{
153153
$data['state'] = $state;
154154
}
155155

156-
if (!is_null($description))
156+
if (!\is_null($description))
157157
{
158158
$data['description'] = $description;
159159
}
160160

161-
if (!is_null($dueOn))
161+
if (!\is_null($dueOn))
162162
{
163163
$data['due_on'] = $dueOn;
164164
}

src/Package/Markdown.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function render($text, $mode = 'gfm', $context = null)
3939
$validModes = array('gfm', 'markdown');
4040

4141
// Make sure the scope is valid
42-
if (!in_array($mode, $validModes))
42+
if (!\in_array($mode, $validModes))
4343
{
4444
throw new \InvalidArgumentException(sprintf('The %s mode is not valid. Valid modes are "gfm" or "markdown".', $mode));
4545
}

src/Package/Orgs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function edit($org, $billingEmail = '', $company = '', $email = '', $loca
9090

9191
$data = array();
9292

93-
$fArgs = func_get_args();
93+
$fArgs = \func_get_args();
9494

9595
foreach ($args as $i => $arg)
9696
{

src/Package/Orgs/Hooks.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function create($org, $url, $contentType = 'form', $secret = null, $insec
8585
// Build the request path.
8686
$path = "/orgs/$org/hooks";
8787

88-
if (false == in_array($contentType, array('form', 'json')))
88+
if (false == \in_array($contentType, array('form', 'json')))
8989
{
9090
throw new \UnexpectedValueException('Content type must be either "form" or "json".');
9191
}
@@ -112,7 +112,7 @@ public function create($org, $url, $contentType = 'form', $secret = null, $insec
112112
// Check to ensure all events are in the allowed list
113113
foreach ($events as $event)
114114
{
115-
if (!in_array($event, $this->hookEvents))
115+
if (!\in_array($event, $this->hookEvents))
116116
{
117117
throw new \RuntimeException('Your events array contains an unauthorized event.');
118118
}
@@ -157,7 +157,7 @@ public function edit($org, $url, $contentType = null, $secret = null, $insecureS
157157

158158
if ($contentType)
159159
{
160-
if (false == in_array($contentType, array('form', 'json')))
160+
if (false == \in_array($contentType, array('form', 'json')))
161161
{
162162
throw new \UnexpectedValueException('Content type must be either "form" or "json".');
163163
}
@@ -189,7 +189,7 @@ public function edit($org, $url, $contentType = null, $secret = null, $insecureS
189189
// Check to ensure all events are in the allowed list
190190
foreach ($events as $event)
191191
{
192-
if (!in_array($event, $this->hookEvents))
192+
if (!\in_array($event, $this->hookEvents))
193193
{
194194
throw new \RuntimeException('Your events array contains an unauthorized event.');
195195
}

src/Package/Orgs/Members.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public function updateMembership($org, $user, $role = 'member')
270270
{
271271
$allowedRoles = array('member', 'admin');
272272

273-
if (!in_array($role, $allowedRoles))
273+
if (!\in_array($role, $allowedRoles))
274274
{
275275
throw new \InvalidArgumentException(sprintf("The user's role must be: %s", implode(', ', $allowedRoles)));
276276
}

0 commit comments

Comments
 (0)