Code improvements (#1649)
* use global namespace for faster lookups * phpstan level 5
This commit is contained in:
@@ -86,7 +86,7 @@ class DatatableExtensions extends AbstractExtension
|
||||
}
|
||||
$values = $this->cookies[$cookie];
|
||||
|
||||
if (empty($values) || !is_array($values)) {
|
||||
if (empty($values) || !\is_array($values)) {
|
||||
return $this->checkInColumDefinition($columns, $column);
|
||||
}
|
||||
|
||||
@@ -103,9 +103,9 @@ class DatatableExtensions extends AbstractExtension
|
||||
|
||||
private function checkInColumDefinition(array $columns, string $column)
|
||||
{
|
||||
if (array_key_exists($column, $columns)) {
|
||||
if (\array_key_exists($column, $columns)) {
|
||||
$tmp = $columns[$column];
|
||||
if (is_array($tmp)) {
|
||||
if (\is_array($tmp)) {
|
||||
$tmp = $tmp['class'];
|
||||
}
|
||||
foreach (explode(' ', $tmp) as $class) {
|
||||
|
||||
@@ -92,11 +92,11 @@ class Extensions extends AbstractExtension
|
||||
*/
|
||||
public function getClassName($object)
|
||||
{
|
||||
if (!is_object($object)) {
|
||||
if (!\is_object($object)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return get_class($object);
|
||||
return \get_class($object);
|
||||
}
|
||||
|
||||
public function multilineIndent(?string $string, string $indent): string
|
||||
@@ -106,7 +106,7 @@ class Extensions extends AbstractExtension
|
||||
}
|
||||
|
||||
$parts = explode("\r\n", $string);
|
||||
if (count($parts) === 1) {
|
||||
if (\count($parts) === 1) {
|
||||
$parts = explode("\n", $string);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ final class MarkdownExtension extends AbstractExtension
|
||||
return '';
|
||||
}
|
||||
|
||||
if (!$fullLength && strlen($content) > 101) {
|
||||
if (!$fullLength && \strlen($content) > 101) {
|
||||
$content = trim(substr($content, 0, 100)) . ' …';
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class PaginationExtension extends AbstractExtension
|
||||
{
|
||||
@trigger_error('Twig function pagerfanta() is deprecated and will be removed with 2.0, use pagination() instead', E_USER_DEPRECATED);
|
||||
|
||||
if (is_array($viewName)) {
|
||||
if (\is_array($viewName)) {
|
||||
$options = $viewName;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,11 +46,11 @@ class WidgetExtension extends AbstractExtension
|
||||
*/
|
||||
public function renderWidget($widget, array $options = [])
|
||||
{
|
||||
if (!($widget instanceof WidgetInterface) && !is_string($widget)) {
|
||||
if (!($widget instanceof WidgetInterface) && !\is_string($widget)) {
|
||||
throw new InvalidArgumentException('Widget must either implement WidgetInterface or be a string');
|
||||
}
|
||||
|
||||
if (is_string($widget)) {
|
||||
if (\is_string($widget)) {
|
||||
if (!$this->service->hasWidget($widget)) {
|
||||
throw new InvalidArgumentException(sprintf('Unknown widget "%s" requested', $widget));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user