Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validators::isEmail: Add check for DNS nameservers. #269

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
19 changes: 0 additions & 19 deletions .github/ISSUE_TEMPLATE/Bug_report.md

This file was deleted.

9 changes: 0 additions & 9 deletions .github/ISSUE_TEMPLATE/Feature_request.md

This file was deleted.

12 changes: 0 additions & 12 deletions .github/ISSUE_TEMPLATE/Support_question.md

This file was deleted.

21 changes: 0 additions & 21 deletions .github/ISSUE_TEMPLATE/Support_us.md

This file was deleted.

2 changes: 0 additions & 2 deletions .github/funding.yml

This file was deleted.

11 changes: 0 additions & 11 deletions .github/pull_request_template.md

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/coding-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.0
coverage: none

- run: composer create-project nette/code-checker temp/code-checker ^3 --no-progress
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.0
coverage: none

- run: composer install --no-progress --prefer-dist
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
php: ['7.2', '7.3', '7.4', '8.0', '8.1']
php: ['8.0', '8.1']

fail-fast: false

Expand Down Expand Up @@ -37,7 +37,7 @@ jobs:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.0
extensions: iconv, json, mbstring, xml, gd, intl, tokenizer
coverage: none

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
}
],
"require": {
"php": ">=7.2 <8.2"
"php": ">=8.0 <8.2"
},
"require-dev": {
"nette/tester": "~2.0",
"tracy/tracy": "^2.3",
"nette/tester": "^2.4",
"tracy/tracy": "^2.8",
"phpstan/phpstan": "^0.12"
},
"conflict": {
Expand All @@ -44,7 +44,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
"dev-master": "4.0-dev"
}
}
}
33 changes: 0 additions & 33 deletions contributing.md

This file was deleted.

2 changes: 1 addition & 1 deletion ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


return function (Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(PRESET_DIR . '/php71.php');
$containerConfigurator->import(PRESET_DIR . '/php80.php');

$parameters = $containerConfigurator->parameters();

Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ The recommended way to install is via Composer:
composer require nette/utils
```

- Nette Utils 4.0 is compatible with PHP 8.0 to 8.1
- Nette Utils 3.2 is compatible with PHP 7.2 to 8.1
- Nette Utils 3.1 is compatible with PHP 7.1 to 8.0
- Nette Utils 3.0 is compatible with PHP 7.1 to 8.0
Expand Down
11 changes: 4 additions & 7 deletions src/Iterators/CachingIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ class CachingIterator extends \CachingIterator implements \Countable
{
use Nette\SmartObject;

/** @var int */
private $counter = 0;
private int $counter = 0;


public function __construct($iterator)
Expand All @@ -47,7 +46,7 @@ public function __construct($iterator)
} elseif ($iterator instanceof \Traversable) {
$iterator = new \IteratorIterator($iterator);
} else {
throw new Nette\InvalidArgumentException(sprintf('Invalid argument passed to %s; array or Traversable expected, %s given.', self::class, is_object($iterator) ? get_class($iterator) : gettype($iterator)));
throw new Nette\InvalidArgumentException(sprintf('Invalid argument passed to %s; array or Traversable expected, %s given.', self::class, is_object($iterator) ? $iterator::class : gettype($iterator)));
}

parent::__construct($iterator, 0);
Expand Down Expand Up @@ -147,19 +146,17 @@ public function rewind(): void

/**
* Returns the next key.
* @return mixed
*/
public function getNextKey()
public function getNextKey(): mixed
{
return $this->getInnerIterator()->key();
}


/**
* Returns the next element.
* @return mixed
*/
public function getNextValue()
public function getNextValue(): mixed
{
return $this->getInnerIterator()->current();
}
Expand Down
3 changes: 1 addition & 2 deletions src/Iterators/Mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ public function __construct(\Traversable $iterator, callable $callback)
}


#[\ReturnTypeWillChange]
public function current()
public function current(): mixed
{
return ($this->callback)(parent::current(), parent::key());
}
Expand Down
20 changes: 8 additions & 12 deletions src/SmartObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ trait SmartObject
/**
* @throws MemberAccessException
*/
public function __call(string $name, array $args)
public function __call(string $name, array $args): mixed
{
$class = static::class;

Expand All @@ -37,27 +37,26 @@ public function __call(string $name, array $args)
} elseif ($handlers !== null) {
throw new UnexpectedValueException("Property $class::$$name must be iterable or null, " . gettype($handlers) . ' given.');
}

} else {
ObjectHelpers::strictCall($class, $name);
return null;
}

ObjectHelpers::strictCall($class, $name);
}


/**
* @throws MemberAccessException
*/
public static function __callStatic(string $name, array $args)
public static function __callStatic(string $name, array $args): mixed
{
ObjectHelpers::strictStaticCall(static::class, $name);
}


/**
* @return mixed
* @throws MemberAccessException if the property is not defined.
*/
public function &__get(string $name)
public function &__get(string $name): mixed
{
$class = static::class;

Expand All @@ -79,11 +78,9 @@ public function &__get(string $name)


/**
* @param mixed $value
* @return void
* @throws MemberAccessException if the property is not defined or is read-only
*/
public function __set(string $name, $value)
public function __set(string $name, mixed $value): void
{
$class = static::class;

Expand All @@ -103,10 +100,9 @@ public function __set(string $name, $value)


/**
* @return void
* @throws MemberAccessException
*/
public function __unset(string $name)
public function __unset(string $name): void
{
$class = static::class;
if (!ObjectHelpers::hasProperty($class, $name)) {
Expand Down
3 changes: 1 addition & 2 deletions src/StaticClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ final public function __construct()

/**
* Call to undefined static method.
* @return void
* @throws MemberAccessException
*/
public static function __callStatic(string $name, array $args)
public static function __callStatic(string $name, array $args): void
{
Utils\ObjectHelpers::strictStaticCall(static::class, $name);
}
Expand Down
4 changes: 1 addition & 3 deletions src/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ interface Translator
{
/**
* Translates the given string.
* @param mixed $message
* @param mixed ...$parameters
*/
function translate($message, ...$parameters): string;
function translate(mixed $message, mixed ...$parameters): string;
}


Expand Down
6 changes: 2 additions & 4 deletions src/Utils/ArrayHash.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ class ArrayHash extends \stdClass implements \ArrayAccess, \Countable, \Iterator
/**
* Transforms array to ArrayHash.
* @param array<T> $array
* @return static
*/
public static function from(array $array, bool $recursive = true)
public static function from(array $array, bool $recursive = true): static
{
$obj = new static;
foreach ($array as $key => $value) {
Expand Down Expand Up @@ -73,8 +72,7 @@ public function offsetSet($key, $value): void
* @param string|int $key
* @return T
*/
#[\ReturnTypeWillChange]
public function offsetGet($key)
public function offsetGet($key): mixed
{
return $this->$key;
}
Expand Down
11 changes: 4 additions & 7 deletions src/Utils/ArrayList.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@ class ArrayList implements \ArrayAccess, \Countable, \IteratorAggregate
{
use Nette\SmartObject;

/** @var mixed[] */
private $list = [];
private array $list = [];


/**
* Transforms array to ArrayList.
* @param array<T> $array
* @return static
*/
public static function from(array $array)
public static function from(array $array): static
{
if (!Arrays::isList($array)) {
throw new Nette\InvalidArgumentException('Array is not valid list.');
Expand Down Expand Up @@ -85,8 +83,7 @@ public function offsetSet($index, $value): void
* @return T
* @throws Nette\OutOfRangeException
*/
#[\ReturnTypeWillChange]
public function offsetGet($index)
public function offsetGet($index): mixed
{
if (!is_int($index) || $index < 0 || $index >= count($this->list)) {
throw new Nette\OutOfRangeException('Offset invalid or out of range');
Expand Down Expand Up @@ -123,7 +120,7 @@ public function offsetUnset($index): void
* Prepends a item.
* @param T $value
*/
public function prepend($value): void
public function prepend(mixed $value): void
{
$first = array_slice($this->list, 0, 1);
$this->offsetSet(0, $value);
Expand Down
Loading