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
Prev Previous commit
Next Next commit
removed deprecated stuff
  • Loading branch information
dg committed Oct 11, 2021
commit 0206d6ae90d804e3c9b8cd88e8ab089f9d5bb6e7
41 changes: 0 additions & 41 deletions src/Utils/Callback.php
Original file line number Diff line number Diff line change
@@ -20,47 +20,6 @@ final class Callback
{
use Nette\StaticClass;

/**
* @param string|object|callable $callable class, object, callable
* @deprecated use Closure::fromCallable()
*/
public static function closure($callable, string $method = null): \Closure
{
trigger_error(__METHOD__ . '() is deprecated, use Closure::fromCallable().', E_USER_DEPRECATED);
try {
return \Closure::fromCallable($method === null ? $callable : [$callable, $method]);
} catch (\TypeError $e) {
throw new Nette\InvalidArgumentException($e->getMessage());
}
}


/**
* Invokes callback.
* @return mixed
* @deprecated
*/
public static function invoke($callable, ...$args)
{
trigger_error(__METHOD__ . '() is deprecated, use native invoking.', E_USER_DEPRECATED);
self::check($callable);
return $callable(...$args);
}


/**
* Invokes callback with an array of parameters.
* @return mixed
* @deprecated
*/
public static function invokeArgs($callable, array $args = [])
{
trigger_error(__METHOD__ . '() is deprecated, use native invoking.', E_USER_DEPRECATED);
self::check($callable);
return $callable(...$args);
}


/**
* Invokes internal PHP function with own error handler.
* @return mixed
41 changes: 0 additions & 41 deletions src/Utils/ObjectMixin.php

This file was deleted.

30 changes: 0 additions & 30 deletions src/Utils/Reflection.php
Original file line number Diff line number Diff line change
@@ -60,16 +60,6 @@ public static function getReturnType(\ReflectionFunctionAbstract $func): ?string
}


/**
* @deprecated
*/
public static function getReturnTypes(\ReflectionFunctionAbstract $func): array
{
$type = Type::fromReflection($func);
return $type ? $type->getNames() : [];
}


/**
* Returns the type of given parameter and normalizes `self` and `parent` to the actual class names.
* If the parameter does not have a type, it returns null.
@@ -81,16 +71,6 @@ public static function getParameterType(\ReflectionParameter $param): ?string
}


/**
* @deprecated
*/
public static function getParameterTypes(\ReflectionParameter $param): array
{
$type = Type::fromReflection($param);
return $type ? $type->getNames() : [];
}


/**
* Returns the type of given property and normalizes `self` and `parent` to the actual class names.
* If the property does not have a type, it returns null.
@@ -102,16 +82,6 @@ public static function getPropertyType(\ReflectionProperty $prop): ?string
}


/**
* @deprecated
*/
public static function getPropertyTypes(\ReflectionProperty $prop): array
{
$type = Type::fromReflection($prop);
return $type ? $type->getNames() : [];
}


/**
* @param \ReflectionFunction|\ReflectionMethod|\ReflectionParameter|\ReflectionProperty $reflection
*/
49 changes: 0 additions & 49 deletions tests/Utils/Callback.invoke.phpt

This file was deleted.

4 changes: 0 additions & 4 deletions tests/Utils/Reflection.getParameterType.81.phpt
Original file line number Diff line number Diff line change
@@ -50,11 +50,7 @@ Assert::same('callable', Reflection::getParameterType($params[3]));
Assert::same('A', Reflection::getParameterType($params[4]));
Assert::null(Reflection::getParameterType($params[5]));
Assert::same('Test\B', Reflection::getParameterType($params[6]));
Assert::same(['Test\B', 'null'], Reflection::getParameterTypes($params[6]));
Assert::same('mixed', Reflection::getParameterType($params[7]));
Assert::same(['mixed'], Reflection::getParameterTypes($params[7]));
Assert::same(['A', 'array'], Reflection::getParameterTypes($params[8]));
Assert::same(['A', 'array', 'null'], Reflection::getParameterTypes($params[9]));

Assert::exception(function () use ($params) {
Reflection::getParameterType($params[8]);
4 changes: 0 additions & 4 deletions tests/Utils/Reflection.getParameterType.phpt
Original file line number Diff line number Diff line change
@@ -48,11 +48,7 @@ Assert::same('callable', Reflection::getParameterType($params[3]));
Assert::same('A', Reflection::getParameterType($params[4]));
Assert::null(Reflection::getParameterType($params[5]));
Assert::same('Test\B', Reflection::getParameterType($params[6]));
Assert::same(['Test\B', 'null'], Reflection::getParameterTypes($params[6]));
Assert::same('mixed', Reflection::getParameterType($params[7]));
Assert::same(['mixed'], Reflection::getParameterTypes($params[7]));
Assert::same(['A', 'array'], Reflection::getParameterTypes($params[8]));
Assert::same(['A', 'array', 'null'], Reflection::getParameterTypes($params[9]));

Assert::exception(function () use ($params) {
Reflection::getParameterType($params[8]);
4 changes: 0 additions & 4 deletions tests/Utils/Reflection.getPropertyType.81.phpt
Original file line number Diff line number Diff line change
@@ -43,11 +43,7 @@ Assert::same('array', Reflection::getPropertyType($props[2]));
Assert::same('A', Reflection::getPropertyType($props[3]));
Assert::null(Reflection::getPropertyType($props[4]));
Assert::same('Test\B', Reflection::getPropertyType($props[5]));
Assert::same(['Test\B', 'null'], Reflection::getPropertyTypes($props[5]));
Assert::same('mixed', Reflection::getPropertyType($props[6]));
Assert::same(['mixed'], Reflection::getPropertyTypes($props[6]));
Assert::same(['A', 'array'], Reflection::getPropertyTypes($props[7]));
Assert::same(['A', 'array', 'null'], Reflection::getPropertyTypes($props[8]));

Assert::exception(function () use ($props) {
Reflection::getPropertyType($props[7]);
4 changes: 0 additions & 4 deletions tests/Utils/Reflection.getPropertyType.phpt
Original file line number Diff line number Diff line change
@@ -41,11 +41,7 @@ Assert::same('array', Reflection::getPropertyType($props[2]));
Assert::same('A', Reflection::getPropertyType($props[3]));
Assert::null(Reflection::getPropertyType($props[4]));
Assert::same('Test\B', Reflection::getPropertyType($props[5]));
Assert::same(['Test\B', 'null'], Reflection::getPropertyTypes($props[5]));
Assert::same('mixed', Reflection::getPropertyType($props[6]));
Assert::same(['mixed'], Reflection::getPropertyTypes($props[6]));
Assert::same(['A', 'array'], Reflection::getPropertyTypes($props[7]));
Assert::same(['A', 'array', 'null'], Reflection::getPropertyTypes($props[8]));

Assert::exception(function () use ($props) {
Reflection::getPropertyType($props[7]);
7 changes: 0 additions & 7 deletions tests/Utils/Reflection.getReturnType.81.phpt
Original file line number Diff line number Diff line change
@@ -120,10 +120,6 @@ Assert::same('string', Reflection::getReturnType(new \ReflectionMethod(A::class,

Assert::same('A', Reflection::getReturnType(new \ReflectionMethod(A::class, 'nullableSelfType')));

Assert::same(['A', 'array'], Reflection::getReturnTypes(new \ReflectionMethod(A::class, 'unionType')));

Assert::same(['A', 'array', 'null'], Reflection::getReturnTypes(new \ReflectionMethod(A::class, 'nullableUnionType')));

Assert::exception(function () {
Reflection::getReturnType(new \ReflectionMethod(A::class, 'unionType'));
}, Nette\InvalidStateException::class, 'The A::unionType() is not expected to have a union or intersection type.');
@@ -144,8 +140,6 @@ Assert::same('Test\B', Reflection::getReturnType(new \ReflectionFunction('classT

Assert::same('string', Reflection::getReturnType(new \ReflectionFunction('nativeType')));

Assert::same(['A', 'array'], Reflection::getReturnTypes(new \ReflectionFunction('unionType')));

Assert::exception(function () {
Reflection::getReturnType(new \ReflectionFunction('unionType'));
}, Nette\InvalidStateException::class, 'The unionType() is not expected to have a union or intersection type.');
@@ -157,4 +151,3 @@ Assert::exception(function () {

// tentative type
Assert::same('int', Reflection::getReturnType(new \ReflectionMethod(\ArrayObject::class, 'count')));
Assert::same(['int'], Reflection::getReturnTypes(new \ReflectionMethod(\ArrayObject::class, 'count')));
6 changes: 0 additions & 6 deletions tests/Utils/Reflection.getReturnType.phpt
Original file line number Diff line number Diff line change
@@ -109,10 +109,6 @@ Assert::same('string', Reflection::getReturnType(new \ReflectionMethod(A::class,

Assert::same('A', Reflection::getReturnType(new \ReflectionMethod(A::class, 'nullableSelfType')));

Assert::same(['A', 'array'], Reflection::getReturnTypes(new \ReflectionMethod(A::class, 'unionType')));

Assert::same(['A', 'array', 'null'], Reflection::getReturnTypes(new \ReflectionMethod(A::class, 'nullableUnionType')));

Assert::exception(function () {
Reflection::getReturnType(new \ReflectionMethod(A::class, 'unionType'));
}, Nette\InvalidStateException::class, 'The A::unionType() is not expected to have a union or intersection type.');
@@ -129,8 +125,6 @@ Assert::same('Test\B', Reflection::getReturnType(new \ReflectionFunction('classT

Assert::same('string', Reflection::getReturnType(new \ReflectionFunction('nativeType')));

Assert::same(['A', 'array'], Reflection::getReturnTypes(new \ReflectionFunction('unionType')));

Assert::exception(function () {
Reflection::getReturnType(new \ReflectionFunction('unionType'));
}, Nette\InvalidStateException::class, 'The unionType() is not expected to have a union or intersection type.');