Warning: 'str_replace ("-", ...)' can be used instead
return preg_replace('#-#', $this->separator, $value); /* * , * .. . * * return str_replace('-', $this->separator, $value); */
Warning: '0 === strpos ("...", "get")' can be used instead
if (preg_match('/^get/', $method)) { ... } /* * , , * . * * if (0 === strpos($method, 'get')) { * ... * } */
Warning: '[0-9]' can be replaced with '\ d' (safe in non-unicode mode)
if (!preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $host)) { ... } /* * /u * /u -, , . * * if (!preg_match('/^(\d{1,3}\.){3}\d{1,3}$/', $host)) { * ... * } */
Warning: '[^ \ s]' can be replaced with '\ S' (as options: \ D, \ W)
if ($property->isPublic() && preg_match_all('/@var\s+([^\s]+)/m', $property->getDocComment(), $matches)) { ... } /* * \S , , , . */
Warning: 'i' modifier is ambiguous here (no az in given pattern)
if (preg_match('/([^.]{2,10})$/iu', end($domainParts), $matches) || (array_key_exists(end($domainParts), $this->validIdns))) { ... } /* * /i , .. . */
Warning: 'false! == strpos ("...", "file")' can be used instead
return preg_match('/file/', $this->getFilename()); /* * , * .. . * * return false !== strpos($this->getFilename(), 'file'); */
Warning: '[^ A-Za-z0-9_]' can be replaced with '\ W' (safe in non-unicode mode)
$gotoname = 'not_'.preg_replace('/[^A-Za-z0-9_]/', '', $name); /* * \W , , , . */
Warning: '[a-zA-Z0-9_]' can be replaced with '\ w' (safe in non-unicode mode)
return '' === $name || null === $name || preg_match('/^[a-zA-Z0-9_][a-zA-Z0-9_\-:]*$/D', $name); /* * \w , , , . */
Warning: Probably / s modifier is missing (nested tags are not recognized)
$content = preg_replace('#<esi\:remove>.*?</esi\:remove>#', '', $content); /* * : . * /s */
Source: https://habr.com/ru/post/260185/
All Articles