Skip to content

Commit adba66a

Browse files
committed
removed some deprecated stuff
1 parent e9f6df9 commit adba66a

File tree

8 files changed

+3
-119
lines changed

8 files changed

+3
-119
lines changed

src/Application/Routers/Route.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ class Route extends Nette\Routing\Route implements Nette\Application\IRouter
4040
],
4141
];
4242

43-
/** @deprecated */
44-
public static $styles = [];
45-
4643
/** @var int */
4744
private $flags;
4845

@@ -70,11 +67,6 @@ public function __construct(string $mask, $metadata = [], int $flags = 0)
7067
}
7168

7269
$this->defaultMeta = $this->defaultMeta + self::UI_META;
73-
if (self::$styles) {
74-
trigger_error('Route::$styles is deprecated.', E_USER_DEPRECATED);
75-
array_replace_recursive($this->defaultMeta, self::$styles);
76-
}
77-
7870
$this->flags = $flags;
7971
parent::__construct($mask, $metadata);
8072
}

src/Application/Routers/SimpleRouter.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ public function __construct($defaults = [], int $flags = 0)
4242
];
4343
}
4444

45-
if (isset($defaults[self::MODULE_KEY])) {
46-
trigger_error(__METHOD__ . '() parameter module is deprecated, use RouteList::withModule() instead.', E_USER_DEPRECATED);
47-
$this->module = $defaults[self::MODULE_KEY] . ':';
48-
unset($defaults[self::MODULE_KEY]);
49-
}
50-
5145
$this->flags = $flags;
5246
parent::__construct($defaults);
5347
}

src/Application/UI/Component.php

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,6 @@ final public function getParameterId(string $name): string
198198
}
199199

200200

201-
/** @deprecated */
202-
final public function getParam($name = null, $default = null)
203-
{
204-
trigger_error(__METHOD__ . '() is deprecated; use getParameter() or getParameters() instead.', E_USER_DEPRECATED);
205-
return func_num_args() ? $this->getParameter($name, $default) : $this->getParameters();
206-
}
207-
208-
209201
/********************* interface ISignalReceiver ****************d*g**/
210202

211203

@@ -286,21 +278,11 @@ public function isLinkCurrent(string $destination = null, $args = []): bool
286278
* @param array|mixed $args
287279
* @throws Nette\Application\AbortException
288280
*/
289-
public function redirect(/*int $code, string */$destination, $args = []): void
281+
public function redirect($destination, $args = []): void
290282
{
291-
if (is_numeric($destination)) {
292-
trigger_error(__METHOD__ . '() first parameter $code is deprecated; use redirectPermanent() for 301 redirect.', E_USER_DEPRECATED);
293-
[$code, $destination, $args] = func_get_args() + [null, null, []];
294-
if (func_num_args() > 3 || !is_array($args)) {
295-
$args = array_slice(func_get_args(), 2);
296-
}
297-
} else {
298-
$code = null;
299-
$args = func_num_args() < 3 && is_array($args) ? $args : array_slice(func_get_args(), 1);
300-
}
301-
283+
$args = func_num_args() < 3 && is_array($args) ? $args : array_slice(func_get_args(), 1);
302284
$presenter = $this->getPresenter();
303-
$presenter->redirectUrl($presenter->createRequest($this, $destination, $args, 'redirect'), $code);
285+
$presenter->redirectUrl($presenter->createRequest($this, $destination, $args, 'redirect'));
304286
}
305287

306288

src/Application/UI/Presenter.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -305,22 +305,6 @@ protected function shutdown(Application\IResponse $response)
305305
}
306306

307307

308-
/**
309-
* Checks authorization.
310-
*/
311-
public function checkRequirements($element): void
312-
{
313-
parent::checkRequirements($element);
314-
$user = (array) ComponentReflection::parseAnnotation($element, 'User');
315-
if (in_array('loggedIn', $user, true)) {
316-
trigger_error(__METHOD__ . '() annotation @User is deprecated', E_USER_DEPRECATED);
317-
if (!$this->getUser()->isLoggedIn()) {
318-
throw new Application\ForbiddenRequestException;
319-
}
320-
}
321-
}
322-
323-
324308
/**
325309
* This method will be called when CSRF is detected.
326310
*/

src/Bridges/ApplicationLatte/TemplateFactory.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,6 @@ public function createTemplate(UI\Control $control = null): UI\ITemplate
7777
}
7878
});
7979

80-
$latte->addFilter('url', function (string $s): string {
81-
trigger_error('Filter |url is deprecated, use |escapeUrl.', E_USER_DEPRECATED);
82-
return rawurlencode($s);
83-
});
84-
foreach (['normalize', 'toAscii'] as $name) {
85-
$latte->addFilter($name, function (string $s) use ($name): string {
86-
trigger_error("Filter |$name is deprecated.", E_USER_DEPRECATED);
87-
return [Nette\Utils\Strings::class, $name]($s);
88-
});
89-
}
90-
$latte->addFilter('null', function (): void {
91-
trigger_error('Filter |null is deprecated.', E_USER_DEPRECATED);
92-
});
9380
$latte->addFilter('modifyDate', function ($time, $delta, $unit = null) {
9481
return $time == null ? null : Nette\Utils\DateTime::from($time)->modify($delta . $unit); // intentionally ==
9582
});

tests/Bridges.Latte/TemplateFactory.filters.phpt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,3 @@ Assert::same('1978-01-24 11:40:00', (string) $latte->invokeFilter('modifyDate',
4242
Assert::same('1978-05-06 00:00:00', (string) $latte->invokeFilter('modifyDate', ['1978-05-05', '+1 day']));
4343
Assert::same('1978-05-06 00:00:00', (string) $latte->invokeFilter('modifyDate', [new DateTime('1978-05-05'), '1day']));
4444
Assert::same('1978-01-22 11:40:00', (string) $latte->invokeFilter('modifyDate', [254400000, -1, 'day']));
45-
46-
47-
Assert::same('%25', @$latte->invokeFilter('url', ['%'])); // @ is deprecated
48-
Assert::null(@$latte->invokeFilter('null', ['x'])); // @ is deprecated
49-
Assert::same('', @$latte->invokeFilter('normalize', [' '])); // @ is deprecated

tests/Routers/SimpleRouter.module.phpt

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

tests/UI/Component.redirect().phpt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,6 @@ test(function () use ($presenter) {
6666
});
6767

6868

69-
test(function () use ($presenter) {
70-
@$presenter->redirect(301, 'foo', ['arg' => 1]); // @ is deprecated
71-
Assert::type(Nette\Application\Responses\RedirectResponse::class, $presenter->response);
72-
Assert::same(301, $presenter->response->getCode());
73-
Assert::same('http://localhost/?arg=1&action=foo&presenter=test', $presenter->response->getUrl());
74-
});
75-
76-
77-
test(function () use ($presenter) {
78-
@$presenter->redirect(301, 'foo', 2); // @ is deprecated
79-
Assert::type(Nette\Application\Responses\RedirectResponse::class, $presenter->response);
80-
Assert::same(301, $presenter->response->getCode());
81-
Assert::same('http://localhost/?val=2&action=foo&presenter=test', $presenter->response->getUrl());
82-
});
83-
84-
8569
test(function () use ($presenter) {
8670
$presenter->redirectPermanent('foo', 2);
8771
Assert::type(Nette\Application\Responses\RedirectResponse::class, $presenter->response);

0 commit comments

Comments
 (0)