Skip to content

Commit b45de14

Browse files
committed
removed PHP < 7 support
1 parent b8bd131 commit b45de14

File tree

11 files changed

+58
-405
lines changed

11 files changed

+58
-405
lines changed

src/Application/Application.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Application
2929
/** @var callable[] function (Application $sender); Occurs before the application loads presenter */
3030
public $onStartup;
3131

32-
/** @var callable[] function (Application $sender, \Exception|\Throwable $e = NULL); Occurs before the application shuts down */
32+
/** @var callable[] function (Application $sender, \Throwable $e = NULL); Occurs before the application shuts down */
3333
public $onShutdown;
3434

3535
/** @var callable[] function (Application $sender, Request $request); Occurs when a new request is received */
@@ -41,7 +41,7 @@ class Application
4141
/** @var callable[] function (Application $sender, IResponse $response); Occurs when a new response is ready for dispatch */
4242
public $onResponse;
4343

44-
/** @var callable[] function (Application $sender, \Exception|\Throwable $e); Occurs when an unhandled exception occurs in the application */
44+
/** @var callable[] function (Application $sender, \Throwable $e); Occurs when an unhandled exception occurs in the application */
4545
public $onError;
4646

4747
/** @var Request[] */
@@ -84,9 +84,6 @@ public function run()
8484
$this->onShutdown($this);
8585

8686
} catch (\Throwable $e) {
87-
} catch (\Exception $e) {
88-
}
89-
if (isset($e)) {
9087
$this->onError($this, $e);
9188
if ($this->catchExceptions && $this->errorPresenter) {
9289
try {
@@ -96,8 +93,6 @@ public function run()
9693

9794
} catch (\Throwable $e) {
9895
$this->onError($this, $e);
99-
} catch (\Exception $e) {
100-
$this->onError($this, $e);
10196
}
10297
}
10398
$this->onShutdown($this, $e);
@@ -156,7 +151,6 @@ public function processRequest(Request $request)
156151

157152

158153
/**
159-
* @param \Exception|\Throwable
160154
* @return void
161155
*/
162156
public function processException($e)

src/Application/Helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static function splitName($name)
2626
$pos = strrpos($name, ':');
2727
return $pos === FALSE
2828
? ['', $name, '']
29-
: [substr($name, 0, $pos), (string) substr($name, $pos + 1), ':'];
29+
: [substr($name, 0, $pos), substr($name, $pos + 1), ':'];
3030
}
3131

3232
}

src/Application/Routers/Route.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function match(Nette\Http\IRequest $httpRequest)
175175
if (strncmp($url->getPath(), $basePath, strlen($basePath)) !== 0) {
176176
return NULL;
177177
}
178-
$path = (string) substr($url->getPath(), strlen($basePath));
178+
$path = substr($url->getPath(), strlen($basePath));
179179

180180
} else {
181181
$path = $url->getPath();
@@ -571,7 +571,7 @@ private function setMask($mask, array $metadata)
571571
}
572572

573573
if ($default !== '') {
574-
$meta[self::VALUE] = (string) substr($default, 1);
574+
$meta[self::VALUE] = substr($default, 1);
575575
$meta['fixity'] = self::PATH_OPTIONAL;
576576
}
577577

src/Application/UI/ComponentReflection.php

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -215,28 +215,9 @@ public static function parseAnnotation(\Reflector $ref, $name)
215215
*/
216216
public static function getParameterType(\ReflectionParameter $param)
217217
{
218-
$def = gettype($param->isDefaultValueAvailable() ? $param->getDefaultValue() : NULL);
219-
if (PHP_VERSION_ID >= 70000) {
220-
return $param->hasType()
221-
? [PHP_VERSION_ID >= 70100 ? $param->getType()->getName() : (string) $param->getType(), !$param->getType()->isBuiltin()]
222-
: [$def, FALSE];
223-
} elseif ($param->isArray() || $param->isCallable()) {
224-
return [$param->isArray() ? 'array' : 'callable', FALSE];
225-
} else {
226-
try {
227-
return ($ref = $param->getClass()) ? [$ref->getName(), TRUE] : [$def, FALSE];
228-
} catch (\ReflectionException $e) {
229-
if (preg_match('#Class (.+) does not exist#', $e->getMessage(), $m)) {
230-
throw new \LogicException(sprintf(
231-
"Class %s not found. Check type hint of parameter $%s in %s() or 'use' statements.",
232-
$m[1],
233-
$param->getName(),
234-
$param->getDeclaringFunction()->getDeclaringClass()->getName() . '::' . $param->getDeclaringFunction()->getName()
235-
));
236-
}
237-
throw $e;
238-
}
239-
}
218+
return $param->hasType()
219+
? [(string) $param->getType(), !$param->getType()->isBuiltin()]
220+
: [gettype($param->isDefaultValueAvailable() ? $param->getDefaultValue() : NULL), FALSE];
240221
}
241222

242223

src/Application/UI/Link.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ public function __toString()
9393
return (string) $this->component->link($this->destination, $this->params);
9494

9595
} catch (\Throwable $e) {
96-
} catch (\Exception $e) {
97-
}
98-
if (isset($e)) {
9996
if (func_num_args()) {
10097
throw $e;
10198
}

src/Bridges/ApplicationDI/RoutingExtension.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ public function afterCompile(Nette\PhpGenerator\ClassType $class)
7676
$s = serialize($router);
7777
} catch (\Throwable $e) {
7878
throw new Nette\DI\ServiceCreationException('Unable to cache router due to error: ' . $e->getMessage(), 0, $e);
79-
} catch (\Exception $e) {
80-
throw new Nette\DI\ServiceCreationException('Unable to cache router due to error: ' . $e->getMessage(), 0, $e);
8179
}
8280
$method->setBody('return unserialize(?);', [$s]);
8381
}

src/Bridges/ApplicationLatte/Template.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ public function __toString()
6363
try {
6464
return $this->latte->renderToString($this->file, $this->params);
6565
} catch (\Throwable $e) {
66-
} catch (\Exception $e) {
67-
}
68-
if (isset($e)) {
6966
if (func_num_args()) {
7067
throw $e;
7168
}

tests/UI/ComponentReflection.combineArgs.php7.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
/**
44
* Test: ComponentReflection::combineArgs()
5-
* @phpVersion 7
65
*/
76

87
use Nette\Application\UI\ComponentReflection as Reflection;

tests/UI/ComponentReflection.combineArgs.phpt

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

0 commit comments

Comments
 (0)