Skip to content

Commit e452d07

Browse files
committed
Add RouteCollection::__isset method
1 parent 2869b12 commit e452d07

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/RouteCollection.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ public function __get(string $property) : mixed
108108
);
109109
}
110110

111+
public function __isset(string $property) : bool
112+
{
113+
return isset($this->{$property});
114+
}
115+
111116
/**
112117
* @param string $origin
113118
*

tests/RouteCollectionTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,14 @@ public function testMethodNotFound() : void
344344
$this->collection->bazz(); // @phpstan-ignore-line
345345
}
346346

347+
public function testIsset() : void
348+
{
349+
self::assertTrue(isset($this->collection->origin));
350+
self::assertTrue(isset($this->collection->router));
351+
self::assertTrue(isset($this->collection->routes));
352+
self::assertFalse(isset($this->collection->notFoundAction));
353+
}
354+
347355
public function testGetProperties() : void
348356
{
349357
self::assertIsString($this->collection->origin);

0 commit comments

Comments
 (0)