Skip to content

Commit

Permalink
Removed usage of each() (unavailable in php8).
Browse files Browse the repository at this point in the history
I replaced it with key() and current().
  • Loading branch information
InFog committed Jan 2, 2021
1 parent 6483123 commit a3a3063
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions PHPCtags.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,16 @@ private function render($structure)
if (in_array('s', $this->mOptions['fields']) && !empty($struct['scope'])) {
// $scope, $type, $name are current scope variables
$scope = array_pop($struct['scope']);
list($type, $name) = each($scope);
$type = key($scope);
$name = current($scope);
switch ($type) {
case 'class':
// n_* stuffs are namespace related scope variables
// current > class > namespace
$n_scope = array_pop($struct['scope']);
if(!empty($n_scope)) {
list($n_type, $n_name) = each($n_scope);
$n_type = key($n_scope);
$n_name = current($n_scope);
$s_str = 'class:' . $n_name . '\\' . $name;
} else {
$s_str = 'class:' . $name;
Expand All @@ -340,10 +342,12 @@ private function render($structure)
// c_* stuffs are class related scope variables
// current > method > class > namespace
$c_scope = array_pop($struct['scope']);
list($c_type, $c_name) = each($c_scope);
$c_type = key($c_scope);
$c_name = current($c_scope);
$n_scope = array_pop($struct['scope']);
if(!empty($n_scope)) {
list($n_type, $n_name) = each($n_scope);
$n_type = key($n_scope);
$n_name = current($n_scope);
$s_str = 'method:' . $n_name . '\\' . $c_name . '::' . $name;
} else {
$s_str = 'method:' . $c_name . '::' . $name;
Expand Down

0 comments on commit a3a3063

Please sign in to comment.