Skip to content

Commit f8c4047

Browse files
More short closures + isset instead of null checks + etc.
1 parent 1205999 commit f8c4047

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Matcher/Dumper/CompiledUrlMatcherDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ private function compileDynamicRoutes(RouteCollection $collection, bool $matchHo
349349
$state->markTail = 0;
350350

351351
// if the regex is too large, throw a signaling exception to recompute with smaller chunk size
352-
set_error_handler(function ($type, $message) { throw str_contains($message, $this->signalingException->getMessage()) ? $this->signalingException : new \ErrorException($message); });
352+
set_error_handler(fn ($type, $message) => throw str_contains($message, $this->signalingException->getMessage()) ? $this->signalingException : new \ErrorException($message));
353353
try {
354354
preg_match($state->regex, '');
355355
} finally {

Router.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ public function setContext(RequestContext $context)
193193
{
194194
$this->context = $context;
195195

196-
if (null !== $this->matcher) {
196+
if (isset($this->matcher)) {
197197
$this->getMatcher()->setContext($context);
198198
}
199-
if (null !== $this->generator) {
199+
if (isset($this->generator)) {
200200
$this->getGenerator()->setContext($context);
201201
}
202202
}
@@ -242,7 +242,7 @@ public function matchRequest(Request $request): array
242242
*/
243243
public function getMatcher(): UrlMatcherInterface|RequestMatcherInterface
244244
{
245-
if (null !== $this->matcher) {
245+
if (isset($this->matcher)) {
246246
return $this->matcher;
247247
}
248248

@@ -283,7 +283,7 @@ function (ConfigCacheInterface $cache) {
283283
*/
284284
public function getGenerator(): UrlGeneratorInterface
285285
{
286-
if (null !== $this->generator) {
286+
if (isset($this->generator)) {
287287
return $this->generator;
288288
}
289289

0 commit comments

Comments
 (0)