diff --git a/src/formdata/FormData.php b/src/formdata/FormData.php index 352d079..1015fb0 100644 --- a/src/formdata/FormData.php +++ b/src/formdata/FormData.php @@ -42,16 +42,16 @@ public function getValue(string $key) { private function initValuesFromArray(array $values, bool $recursion = false): array { $result = []; foreach($values as $key => $value) { - if (is_string($value)) { + if (\is_string($value)) { $result[$key] = $value; continue; } - if ($recursion === false && is_array($value)) { + if ($recursion === false && \is_array($value)) { $result[$key] = $this->initValuesFromArray($value, true); continue; } throw new FormDataException( - sprintf('Data type "%s" in key "%s" not supported', gettype($value), $key) + sprintf('Data type "%s" in key "%s" not supported', \gettype($value), $key) ); } diff --git a/src/snippet/SnippetList.php b/src/snippet/SnippetList.php index eb17ad5..3c1287b 100644 --- a/src/snippet/SnippetList.php +++ b/src/snippet/SnippetList.php @@ -34,7 +34,7 @@ public function rewind() { } public function count(): int { - return count($this->snippets); + return \count($this->snippets); } } diff --git a/src/viewmodel/SnapshotDOMNodelist.php b/src/viewmodel/SnapshotDOMNodelist.php index b2208b1..e8fb6f9 100644 --- a/src/viewmodel/SnapshotDOMNodelist.php +++ b/src/viewmodel/SnapshotDOMNodelist.php @@ -24,7 +24,7 @@ public function __construct(DOMNodeList $list) { } public function count() { - return count($this->items); + return \count($this->items); } public function hasNode(DOMNode $node) { @@ -66,7 +66,7 @@ public function key(): int { } public function valid(): bool { - $count = count($this->items); + $count = \count($this->items); return $count > 0 && $count > $this->pos; } @@ -81,7 +81,7 @@ private function extractItemsFromNodeList(DOMNodeList $list) { } public function hasNext(): bool { - $count = count($this->items); + $count = \count($this->items); return $count > 0 && $this->pos < $count; } diff --git a/src/viewmodel/ViewModelRenderer.php b/src/viewmodel/ViewModelRenderer.php index c90ec47..02ea2ab 100644 --- a/src/viewmodel/ViewModelRenderer.php +++ b/src/viewmodel/ViewModelRenderer.php @@ -105,7 +105,7 @@ private function dropFromStack() { */ private function applyCurrent(DOMElement $context): DOMNode { $model = $this->current(); - switch (gettype($model)) { + switch (\gettype($model)) { case 'boolean': { return $this->processBoolean($context, $model); } @@ -125,7 +125,7 @@ private function applyCurrent(DOMElement $context): DOMNode { default: { throw new ViewModelRendererException( - sprintf('Unsupported type %s', gettype($model)) + sprintf('Unsupported type %s', \gettype($model)) ); } } @@ -194,9 +194,8 @@ private function processObjectAsModel(DOMElement $context, $model): DOMElement { * @throws ViewModelRendererException */ private function processArray(DOMElement $context, $model): DOMDocumentFragment { - $count = count($model); - if ($context->isSameNode($context->ownerDocument->documentElement) && - $count > 1) { + $count = \count($model); + if ($count > 1 && $context->isSameNode($context->ownerDocument->documentElement)) { throw new ViewModelRendererException( 'Cannot render multiple copies of root element' ); @@ -288,10 +287,10 @@ function (&$value, $pos) { $value = ucfirst($value); } return; } - if (!is_string($value)) { + if (!\is_string($value)) { throw new ViewModelRendererException( sprintf('Attribute value must be string or boolean false - type %s received from $model->%s', - gettype($value), + \gettype($value), implode('()->', $this->stackNames) . '()' ) ); @@ -307,12 +306,12 @@ function (&$value, $pos) { $value = ucfirst($value); } * @throws ViewModelRendererException */ private function ensureIsObject($model, string $property) { - if (!is_object($model)) { + if (!\is_object($model)) { throw new ViewModelRendererException( sprintf( 'Trying to add "%s" failed - Non object (%s) on stack: $%s', $property, - gettype($model), + \gettype($model), implode('()->', $this->stackNames) . '() ' ) );