Skip to content

Commit

Permalink
some classes & members marked as final (BC break)
Browse files Browse the repository at this point in the history
This reverts commit "Christmas Gift 2013" 0dfe244.
  • Loading branch information
dg committed Feb 1, 2017
1 parent 969656d commit a632cd6
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/Utils/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* PHP callable tools.
*/
class Callback
final class Callback
{
use Nette\StaticClass;

Expand Down
2 changes: 1 addition & 1 deletion src/Utils/FileSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* File system tool.
*/
class FileSystem
final class FileSystem
{
use Nette\StaticClass;

Expand Down
52 changes: 26 additions & 26 deletions src/Utils/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static function el(string $name = NULL, $attrs = NULL)
* @return static
* @throws Nette\InvalidArgumentException
*/
public function setName(string $name, bool $isEmpty = NULL)
final public function setName(string $name, bool $isEmpty = NULL)
{
$this->name = $name;
$this->isEmpty = $isEmpty === NULL ? isset(static::$emptyElements[$name]) : $isEmpty;
Expand All @@ -95,7 +95,7 @@ public function setName(string $name, bool $isEmpty = NULL)
/**
* Returns element's name.
*/
public function getName(): string
final public function getName(): string
{
return $this->name;
}
Expand All @@ -104,7 +104,7 @@ public function getName(): string
/**
* Is element empty?
*/
public function isEmpty(): bool
final public function isEmpty(): bool
{
return $this->isEmpty;
}
Expand Down Expand Up @@ -180,7 +180,7 @@ public function removeAttribute(string $name)
* Overloaded setter for element's attribute.
* @return void
*/
public function __set(string $name, $value)
final public function __set(string $name, $value)
{
$this->attrs[$name] = $value;
}
Expand All @@ -190,7 +190,7 @@ public function __set(string $name, $value)
* Overloaded getter for element's attribute.
* @return mixed
*/
public function &__get(string $name)
final public function &__get(string $name)
{
return $this->attrs[$name];
}
Expand All @@ -199,7 +199,7 @@ public function &__get(string $name)
/**
* Overloaded tester for element's attribute.
*/
public function __isset(string $name): bool
final public function __isset(string $name): bool
{
return isset($this->attrs[$name]);
}
Expand All @@ -209,7 +209,7 @@ public function __isset(string $name): bool
* Overloaded unsetter for element's attribute.
* @return void
*/
public function __unset(string $name)
final public function __unset(string $name)
{
unset($this->attrs[$name]);
}
Expand All @@ -219,7 +219,7 @@ public function __unset(string $name)
* Overloaded setter for element's attribute.
* @return mixed
*/
public function __call(string $m, array $args)
final public function __call(string $m, array $args)
{
$p = substr($m, 0, 3);
if ($p === 'get' || $p === 'set' || $p === 'add') {
Expand Down Expand Up @@ -250,7 +250,7 @@ public function __call(string $m, array $args)
* Special setter for element's attribute.
* @return static
*/
public function href(string $path, array $query = NULL)
final public function href(string $path, array $query = NULL)
{
if ($query) {
$query = http_build_query($query, '', '&');
Expand Down Expand Up @@ -283,7 +283,7 @@ public function data(string $name, $value = NULL)
* @return static
* @throws Nette\InvalidArgumentException
*/
public function setHtml($html)
final public function setHtml($html)
{
if (is_array($html)) {
throw new Nette\InvalidArgumentException(sprintf('Textual content must be a scalar, %s given.', gettype($html)));
Expand All @@ -297,7 +297,7 @@ public function setHtml($html)
/**
* Returns element's HTML content.
*/
public function getHtml(): string
final public function getHtml(): string
{
$s = '';
foreach ($this->children as $child) {
Expand All @@ -316,7 +316,7 @@ public function getHtml(): string
* @return static
* @throws Nette\InvalidArgumentException
*/
public function setText($text)
final public function setText($text)
{
if (!is_array($text) && !$text instanceof self) {
$text = htmlspecialchars((string) $text, ENT_NOQUOTES, 'UTF-8');
Expand All @@ -328,7 +328,7 @@ public function setText($text)
/**
* Returns element's textual content.
*/
public function getText(): string
final public function getText(): string
{
return html_entity_decode(strip_tags($this->getHtml()), ENT_QUOTES, 'UTF-8');
}
Expand All @@ -339,7 +339,7 @@ public function getText(): string
* @param Html|string Html node or raw HTML string
* @return static
*/
public function addHtml($child)
final public function addHtml($child)
{
return $this->insert(NULL, $child);
}
Expand All @@ -361,7 +361,7 @@ public function addText(string $text)
* @param array|string $attrs element's attributes or raw HTML string
* @return static created element
*/
public function create(string $name, $attrs = NULL)
final public function create(string $name, $attrs = NULL)
{
$this->insert(NULL, $child = static::el($name, $attrs));
return $child;
Expand Down Expand Up @@ -398,7 +398,7 @@ public function insert(int $index = NULL, $child, bool $replace = FALSE)
* @param Html|string Html node or raw HTML string
* @return void
*/
public function offsetSet($index, $child)
final public function offsetSet($index, $child)
{
$this->insert($index, $child, TRUE);
}
Expand All @@ -409,7 +409,7 @@ public function offsetSet($index, $child)
* @param int
* @return static|string
*/
public function offsetGet($index)
final public function offsetGet($index)
{
return $this->children[$index];
}
Expand All @@ -419,7 +419,7 @@ public function offsetGet($index)
* Exists child node? (\ArrayAccess implementation).
* @param int
*/
public function offsetExists($index): bool
final public function offsetExists($index): bool
{
return isset($this->children[$index]);
}
Expand All @@ -441,7 +441,7 @@ public function offsetUnset($index)
/**
* Returns children count.
*/
public function count(): int
final public function count(): int
{
return count($this->children);
}
Expand All @@ -460,7 +460,7 @@ public function removeChildren()
/**
* Iterates over elements.
*/
public function getIterator(): \ArrayIterator
final public function getIterator(): \ArrayIterator
{
return new \ArrayIterator($this->children);
}
Expand All @@ -469,7 +469,7 @@ public function getIterator(): \ArrayIterator
/**
* Returns all children.
*/
public function getChildren(): array
final public function getChildren(): array
{
return $this->children;
}
Expand All @@ -478,7 +478,7 @@ public function getChildren(): array
/**
* Renders element's start tag, content and end tag.
*/
public function render(int $indent = NULL): string
final public function render(int $indent = NULL): string
{
$s = $this->startTag();

Expand Down Expand Up @@ -506,7 +506,7 @@ public function render(int $indent = NULL): string
}


public function __toString(): string
final public function __toString(): string
{
try {
return $this->render();
Expand All @@ -519,7 +519,7 @@ public function __toString(): string
/**
* Returns element's start tag.
*/
public function startTag(): string
final public function startTag(): string
{
if ($this->name) {
return '<' . $this->name . $this->attributes() . (static::$xhtml && $this->isEmpty ? ' />' : '>');
Expand All @@ -533,7 +533,7 @@ public function startTag(): string
/**
* Returns element's end tag.
*/
public function endTag(): string
final public function endTag(): string
{
return $this->name && !$this->isEmpty ? '</' . $this->name . '>' : '';
}
Expand All @@ -543,7 +543,7 @@ public function endTag(): string
* Returns element's attributes.
* @internal
*/
public function attributes(): string
final public function attributes(): string
{
if (!is_array($this->attrs)) {
return '';
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* JSON encoder and decoder.
*/
class Json
final class Json
{
use Nette\StaticClass;

Expand Down
2 changes: 1 addition & 1 deletion src/Utils/ObjectHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* Nette\SmartObject helpers.
*/
class ObjectHelpers
final class ObjectHelpers
{
use Nette\StaticClass;

Expand Down
2 changes: 1 addition & 1 deletion src/Utils/ObjectMixin.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Nette\Object behaviour mixin.
* @deprecated
*/
class ObjectMixin
final class ObjectMixin
{
use Nette\StaticClass;

Expand Down
2 changes: 1 addition & 1 deletion src/Utils/Random.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* Secure random string generator.
*/
class Random
final class Random
{
use Nette\StaticClass;

Expand Down
2 changes: 1 addition & 1 deletion src/Utils/Reflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* PHP reflection helpers.
*/
class Reflection
final class Reflection
{
use Nette\StaticClass;

Expand Down

0 comments on commit a632cd6

Please sign in to comment.