Visman 2019-10-11 19:32:26 +07:00
parent 2b3b016fac
commit ebdfe382d9
9 changed files with 15 additions and 15 deletions

View file

@ -94,7 +94,7 @@ class Container
$args[] = \is_numeric($k) ? $v : $this->resolve($v);
}
// Special case: reference to factory method
if ($class{0} == '@' && \strpos($class, ':') !== false) {
if ($class[0] == '@' && \strpos($class, ':') !== false) {
list($name, $method) = \explode(':', \substr($class, 1), 2);
$factory = $this->__get($name);
$service = $factory->$method(...$args);
@ -195,7 +195,7 @@ class Container
$value
);
}
} elseif (isset($value{0}) && $value{0} === '@') {
} elseif (isset($value[0]) && $value[0] === '@') {
return $this->__get(\substr($value, 1));
}
} elseif (\is_array($value)) {

View file

@ -68,7 +68,7 @@ class DBStatement extends PDOStatement
$bType = $this->types[$type];
$bValue = $this->db->getValue($key, $params);
if ($type{0} === 'a') {
if ($type[0] === 'a') {
if (! \is_array($bValue)) {
throw new PDOException("Expected array: key='{$key}'");
}

View file

@ -125,7 +125,7 @@ class File
$name = \trim(\preg_replace('%[^\w.-]+%', '-', $name), '-');
if (! isset($name{0})) {
if (! isset($name[0])) {
$name = (string) \time();
}

View file

@ -112,7 +112,7 @@ class Files
if (\is_string($value)) {
$value = \trim($value, "Bb \t\n\r\0\x0B");
if (! isset($value{0})) {
if (! isset($value[0])) {
return 0;
}

View file

@ -98,8 +98,8 @@ class Func
$result = [];
if (\is_dir($dir) && ($dh = \opendir($dir)) !== false) {
while (($entry = \readdir($dh)) !== false) {
if (isset($entry{0})
&& $entry{0} !== '.'
if (isset($entry[0])
&& $entry[0] !== '.'
&& \is_dir("{$dir}/{$entry}")
&& \is_file("{$dir}/{$entry}/{$file}")
) {

View file

@ -120,7 +120,7 @@ class Lang
$line = \trim($lines[$i]);
// пустая строка
if (! isset($line{0})) {
if (! isset($line[0])) {
// промежуточные данные
if (isset($curComm)) {
$cur[$curComm] = $curVal;
@ -178,11 +178,11 @@ class Lang
continue;
// комментарий
} elseif ($line{0} == '#') {
} elseif ($line[0] == '#') {
continue;
// многострочное содержимое
} elseif ($line{0} == '"') {
} elseif ($line[0] == '"') {
if (isset($curComm)) {
$curVal .= $this->originalLine($line);
}
@ -255,7 +255,7 @@ class Lang
*/
protected function originalLine($line)
{
if (isset($line[1]) && $line{0} == '"' && $line{\strlen($line) - 1} == '"') {
if (isset($line[1]) && $line[0] == '"' && $line{\strlen($line) - 1} == '"') {
$line = \substr($line, 1, -1);
}
return \str_replace(

View file

@ -101,7 +101,7 @@ class Mail
$local = $matches[1];
$domain = $matches[2];
if ('[' === $domain{0} && ']' === \substr($domain, -1)) {
if ('[' === $domain[0] && ']' === \substr($domain, -1)) {
if (1 === \strpos($domain, 'IPv6:')) {
$prefix = 'IPv6:';
$ip = \substr($domain, 6, -1);
@ -509,7 +509,7 @@ class Mail
throw new SmtpException('Couldn\'t get mail server response codes.');
}
$response .= $get;
if (isset($get{3}) && $get{3} === ' ') {
if (isset($get[3]) && $get[3] === ' ') {
$return = \substr($get, 0, 3);
break;
}

View file

@ -472,7 +472,7 @@ class Validator
if (null !== $value) {
$this->addError('The :alias should be absent');
}
if (isset($attr{0})) {
if (isset($attr[0])) {
return $attr;
} else {
return null;

View file

@ -400,7 +400,7 @@ class Install extends Page
*/
public function vCheckPrefix(Validator $v, $prefix)
{
if (isset($prefix{0})) {
if (isset($prefix[0])) {
if (! \preg_match('%^[a-z][a-z\d_]*$%i', $prefix)) {
$v->addError('Table prefix error');
} elseif ('sqlite' === $v->dbtype && 'sqlite_' === \strtolower($prefix)) {