Change string indexing from {0} to [0] (deprecated in PHP 7.4)

This commit is contained in:
Lőrinczy, Zsigmond
2019-11-09 20:46:53 +01:00
committed by Frédéric Guillot
parent 6c08225f76
commit 35602c0880
8 changed files with 9 additions and 9 deletions

View File

@@ -94,7 +94,7 @@ class Csv
{ {
if (! empty($value)) { if (! empty($value)) {
$value = trim(strtolower($value)); $value = trim(strtolower($value));
return $value === '1' || $value{0} === 't' || $value{0} === 'y' ? 1 : 0; return $value === '1' || $value[0] === 't' || $value[0] === 'y' ? 1 : 0;
} }
return 0; return 0;

View File

@@ -100,7 +100,7 @@ class Route extends Base
$params = array(); $params = array();
for ($i = 0; $i < $count; $i++) { for ($i = 0; $i < $count; $i++) {
if ($route['items'][$i]{0} === ':') { if ($route['items'][$i][0] === ':') {
$params[substr($route['items'][$i], 1)] = $items[$i]; $params[substr($route['items'][$i], 1)] = $items[$i];
} elseif ($route['items'][$i] !== $items[$i]) { } elseif ($route['items'][$i] !== $items[$i]) {
break; break;
@@ -177,7 +177,7 @@ class Route extends Base
$params = array(); $params = array();
foreach ($items as $item) { foreach ($items as $item) {
if ($item !== '' && $item{0} === ':') { if ($item !== '' && $item[0] === ':') {
$params[substr($item, 1)] = true; $params[substr($item, 1)] = true;
} }
} }

View File

@@ -86,7 +86,7 @@ class Router extends Base
$path = substr($path, 0, - strlen($this->request->getQueryString()) - 1); $path = substr($path, 0, - strlen($this->request->getQueryString()) - 1);
} }
if ($path !== '' && $path{0} === '/') { if ($path !== '' && $path[0] === '/') {
$path = substr($path, 1); $path = substr($path, 1);
} }

View File

@@ -32,7 +32,7 @@ class TaskTitleFilter extends BaseFilter implements FilterInterface
*/ */
public function apply() public function apply()
{ {
if (ctype_digit($this->value) || (strlen($this->value) > 1 && $this->value{0} === '#' && ctype_digit(substr($this->value, 1)))) { if (ctype_digit($this->value) || (strlen($this->value) > 1 && $this->value[0] === '#' && ctype_digit(substr($this->value, 1)))) {
$this->query->beginOr(); $this->query->beginOr();
$this->query->eq(TaskModel::TABLE.'.id', str_replace('#', '', $this->value)); $this->query->eq(TaskModel::TABLE.'.id', str_replace('#', '', $this->value));
$this->query->ilike(TaskModel::TABLE.'.title', '%'.$this->value.'%'); $this->query->ilike(TaskModel::TABLE.'.title', '%'.$this->value.'%');

View File

@@ -37,7 +37,7 @@ class ProjectActivityEventFormatter extends BaseFormatter implements FormatterIn
*/ */
protected function unserializeEvent($data) protected function unserializeEvent($data)
{ {
if ($data{0} === 'a') { if ($data[0] === 'a') {
return unserialize($data); return unserialize($data);
} }

View File

@@ -461,7 +461,7 @@ function version_99(PDO $pdo)
$row['action_name'] = '\Kanboard\Action\TaskCloseColumn'; $row['action_name'] = '\Kanboard\Action\TaskCloseColumn';
} elseif ($row['action_name'] === 'TaskLogMoveAnotherColumn') { } elseif ($row['action_name'] === 'TaskLogMoveAnotherColumn') {
$row['action_name'] = '\Kanboard\Action\CommentCreationMoveTaskColumn'; $row['action_name'] = '\Kanboard\Action\CommentCreationMoveTaskColumn';
} elseif ($row['action_name']{0} !== '\\') { } elseif ($row['action_name'][0] !== '\\') {
$row['action_name'] = '\Kanboard\Action\\'.$row['action_name']; $row['action_name'] = '\Kanboard\Action\\'.$row['action_name'];
} }

View File

@@ -353,7 +353,7 @@ function version_79(PDO $pdo)
$row['action_name'] = '\Kanboard\Action\TaskCloseColumn'; $row['action_name'] = '\Kanboard\Action\TaskCloseColumn';
} elseif ($row['action_name'] === 'TaskLogMoveAnotherColumn') { } elseif ($row['action_name'] === 'TaskLogMoveAnotherColumn') {
$row['action_name'] = '\Kanboard\Action\CommentCreationMoveTaskColumn'; $row['action_name'] = '\Kanboard\Action\CommentCreationMoveTaskColumn';
} elseif ($row['action_name']{0} !== '\\') { } elseif ($row['action_name'][0] !== '\\') {
$row['action_name'] = '\Kanboard\Action\\'.$row['action_name']; $row['action_name'] = '\Kanboard\Action\\'.$row['action_name'];
} }

View File

@@ -324,7 +324,7 @@ function version_92(PDO $pdo)
$row['action_name'] = '\Kanboard\Action\TaskCloseColumn'; $row['action_name'] = '\Kanboard\Action\TaskCloseColumn';
} elseif ($row['action_name'] === 'TaskLogMoveAnotherColumn') { } elseif ($row['action_name'] === 'TaskLogMoveAnotherColumn') {
$row['action_name'] = '\Kanboard\Action\CommentCreationMoveTaskColumn'; $row['action_name'] = '\Kanboard\Action\CommentCreationMoveTaskColumn';
} elseif ($row['action_name']{0} !== '\\') { } elseif ($row['action_name'][0] !== '\\') {
$row['action_name'] = '\Kanboard\Action\\'.$row['action_name']; $row['action_name'] = '\Kanboard\Action\\'.$row['action_name'];
} }