Skip to content

Commit 0206d6a

Browse files
committed
removed deprecated stuff
1 parent 0c5fcc9 commit 0206d6a

10 files changed

+0
-190
lines changed

src/Utils/Callback.php

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -20,47 +20,6 @@ final class Callback
2020
{
2121
use Nette\StaticClass;
2222

23-
/**
24-
* @param string|object|callable $callable class, object, callable
25-
* @deprecated use Closure::fromCallable()
26-
*/
27-
public static function closure($callable, string $method = null): \Closure
28-
{
29-
trigger_error(__METHOD__ . '() is deprecated, use Closure::fromCallable().', E_USER_DEPRECATED);
30-
try {
31-
return \Closure::fromCallable($method === null ? $callable : [$callable, $method]);
32-
} catch (\TypeError $e) {
33-
throw new Nette\InvalidArgumentException($e->getMessage());
34-
}
35-
}
36-
37-
38-
/**
39-
* Invokes callback.
40-
* @return mixed
41-
* @deprecated
42-
*/
43-
public static function invoke($callable, ...$args)
44-
{
45-
trigger_error(__METHOD__ . '() is deprecated, use native invoking.', E_USER_DEPRECATED);
46-
self::check($callable);
47-
return $callable(...$args);
48-
}
49-
50-
51-
/**
52-
* Invokes callback with an array of parameters.
53-
* @return mixed
54-
* @deprecated
55-
*/
56-
public static function invokeArgs($callable, array $args = [])
57-
{
58-
trigger_error(__METHOD__ . '() is deprecated, use native invoking.', E_USER_DEPRECATED);
59-
self::check($callable);
60-
return $callable(...$args);
61-
}
62-
63-
6423
/**
6524
* Invokes internal PHP function with own error handler.
6625
* @return mixed

src/Utils/ObjectMixin.php

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/Utils/Reflection.php

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,6 @@ public static function getReturnType(\ReflectionFunctionAbstract $func): ?string
6060
}
6161

6262

63-
/**
64-
* @deprecated
65-
*/
66-
public static function getReturnTypes(\ReflectionFunctionAbstract $func): array
67-
{
68-
$type = Type::fromReflection($func);
69-
return $type ? $type->getNames() : [];
70-
}
71-
72-
7363
/**
7464
* Returns the type of given parameter and normalizes `self` and `parent` to the actual class names.
7565
* If the parameter does not have a type, it returns null.
@@ -81,16 +71,6 @@ public static function getParameterType(\ReflectionParameter $param): ?string
8171
}
8272

8373

84-
/**
85-
* @deprecated
86-
*/
87-
public static function getParameterTypes(\ReflectionParameter $param): array
88-
{
89-
$type = Type::fromReflection($param);
90-
return $type ? $type->getNames() : [];
91-
}
92-
93-
9474
/**
9575
* Returns the type of given property and normalizes `self` and `parent` to the actual class names.
9676
* If the property does not have a type, it returns null.
@@ -102,16 +82,6 @@ public static function getPropertyType(\ReflectionProperty $prop): ?string
10282
}
10383

10484

105-
/**
106-
* @deprecated
107-
*/
108-
public static function getPropertyTypes(\ReflectionProperty $prop): array
109-
{
110-
$type = Type::fromReflection($prop);
111-
return $type ? $type->getNames() : [];
112-
}
113-
114-
11585
/**
11686
* @param \ReflectionFunction|\ReflectionMethod|\ReflectionParameter|\ReflectionProperty $reflection
11787
*/

tests/Utils/Callback.invoke.phpt

Lines changed: 0 additions & 49 deletions
This file was deleted.

tests/Utils/Reflection.getParameterType.81.phpt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,7 @@ Assert::same('callable', Reflection::getParameterType($params[3]));
5050
Assert::same('A', Reflection::getParameterType($params[4]));
5151
Assert::null(Reflection::getParameterType($params[5]));
5252
Assert::same('Test\B', Reflection::getParameterType($params[6]));
53-
Assert::same(['Test\B', 'null'], Reflection::getParameterTypes($params[6]));
5453
Assert::same('mixed', Reflection::getParameterType($params[7]));
55-
Assert::same(['mixed'], Reflection::getParameterTypes($params[7]));
56-
Assert::same(['A', 'array'], Reflection::getParameterTypes($params[8]));
57-
Assert::same(['A', 'array', 'null'], Reflection::getParameterTypes($params[9]));
5854

5955
Assert::exception(function () use ($params) {
6056
Reflection::getParameterType($params[8]);

tests/Utils/Reflection.getParameterType.phpt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,7 @@ Assert::same('callable', Reflection::getParameterType($params[3]));
4848
Assert::same('A', Reflection::getParameterType($params[4]));
4949
Assert::null(Reflection::getParameterType($params[5]));
5050
Assert::same('Test\B', Reflection::getParameterType($params[6]));
51-
Assert::same(['Test\B', 'null'], Reflection::getParameterTypes($params[6]));
5251
Assert::same('mixed', Reflection::getParameterType($params[7]));
53-
Assert::same(['mixed'], Reflection::getParameterTypes($params[7]));
54-
Assert::same(['A', 'array'], Reflection::getParameterTypes($params[8]));
55-
Assert::same(['A', 'array', 'null'], Reflection::getParameterTypes($params[9]));
5652

5753
Assert::exception(function () use ($params) {
5854
Reflection::getParameterType($params[8]);

tests/Utils/Reflection.getPropertyType.81.phpt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ Assert::same('array', Reflection::getPropertyType($props[2]));
4343
Assert::same('A', Reflection::getPropertyType($props[3]));
4444
Assert::null(Reflection::getPropertyType($props[4]));
4545
Assert::same('Test\B', Reflection::getPropertyType($props[5]));
46-
Assert::same(['Test\B', 'null'], Reflection::getPropertyTypes($props[5]));
4746
Assert::same('mixed', Reflection::getPropertyType($props[6]));
48-
Assert::same(['mixed'], Reflection::getPropertyTypes($props[6]));
49-
Assert::same(['A', 'array'], Reflection::getPropertyTypes($props[7]));
50-
Assert::same(['A', 'array', 'null'], Reflection::getPropertyTypes($props[8]));
5147

5248
Assert::exception(function () use ($props) {
5349
Reflection::getPropertyType($props[7]);

tests/Utils/Reflection.getPropertyType.phpt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ Assert::same('array', Reflection::getPropertyType($props[2]));
4141
Assert::same('A', Reflection::getPropertyType($props[3]));
4242
Assert::null(Reflection::getPropertyType($props[4]));
4343
Assert::same('Test\B', Reflection::getPropertyType($props[5]));
44-
Assert::same(['Test\B', 'null'], Reflection::getPropertyTypes($props[5]));
4544
Assert::same('mixed', Reflection::getPropertyType($props[6]));
46-
Assert::same(['mixed'], Reflection::getPropertyTypes($props[6]));
47-
Assert::same(['A', 'array'], Reflection::getPropertyTypes($props[7]));
48-
Assert::same(['A', 'array', 'null'], Reflection::getPropertyTypes($props[8]));
4945

5046
Assert::exception(function () use ($props) {
5147
Reflection::getPropertyType($props[7]);

tests/Utils/Reflection.getReturnType.81.phpt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,6 @@ Assert::same('string', Reflection::getReturnType(new \ReflectionMethod(A::class,
120120

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

123-
Assert::same(['A', 'array'], Reflection::getReturnTypes(new \ReflectionMethod(A::class, 'unionType')));
124-
125-
Assert::same(['A', 'array', 'null'], Reflection::getReturnTypes(new \ReflectionMethod(A::class, 'nullableUnionType')));
126-
127123
Assert::exception(function () {
128124
Reflection::getReturnType(new \ReflectionMethod(A::class, 'unionType'));
129125
}, 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
144140

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

147-
Assert::same(['A', 'array'], Reflection::getReturnTypes(new \ReflectionFunction('unionType')));
148-
149143
Assert::exception(function () {
150144
Reflection::getReturnType(new \ReflectionFunction('unionType'));
151145
}, Nette\InvalidStateException::class, 'The unionType() is not expected to have a union or intersection type.');
@@ -157,4 +151,3 @@ Assert::exception(function () {
157151

158152
// tentative type
159153
Assert::same('int', Reflection::getReturnType(new \ReflectionMethod(\ArrayObject::class, 'count')));
160-
Assert::same(['int'], Reflection::getReturnTypes(new \ReflectionMethod(\ArrayObject::class, 'count')));

tests/Utils/Reflection.getReturnType.phpt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ Assert::same('string', Reflection::getReturnType(new \ReflectionMethod(A::class,
109109

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

112-
Assert::same(['A', 'array'], Reflection::getReturnTypes(new \ReflectionMethod(A::class, 'unionType')));
113-
114-
Assert::same(['A', 'array', 'null'], Reflection::getReturnTypes(new \ReflectionMethod(A::class, 'nullableUnionType')));
115-
116112
Assert::exception(function () {
117113
Reflection::getReturnType(new \ReflectionMethod(A::class, 'unionType'));
118114
}, 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
129125

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

132-
Assert::same(['A', 'array'], Reflection::getReturnTypes(new \ReflectionFunction('unionType')));
133-
134128
Assert::exception(function () {
135129
Reflection::getReturnType(new \ReflectionFunction('unionType'));
136130
}, Nette\InvalidStateException::class, 'The unionType() is not expected to have a union or intersection type.');

0 commit comments

Comments
 (0)