@@ -94,6 +94,12 @@ public function getModule(): ?string
9494 */
9595 public function offsetSet ($ index , $ router ): void
9696 {
97+ if ($ router instanceof Route) {
98+ trigger_error ('Usage `$router[] = new Route(...)` is deprecated, use `$router->addRoute(...)`. ' , E_USER_DEPRECATED );
99+ } else {
100+ $ class = getclass ($ router );
101+ trigger_error ("Usage ` \$router[] = new $ class` is deprecated, use ` \$router->add(new $ class)`. " , E_USER_DEPRECATED );
102+ }
97103 if ($ index === null ) {
98104 $ this ->add ($ router );
99105 } else {
@@ -108,6 +114,7 @@ public function offsetSet($index, $router): void
108114 */
109115 public function offsetGet ($ index ): mixed
110116 {
117+ trigger_error ('Usage `$route = $router[...]` is deprecated, use `$router->getRouters()`. ' , E_USER_DEPRECATED );
111118 if (!$ this ->offsetExists ($ index )) {
112119 throw new Nette \OutOfRangeException ('Offset invalid or out of range ' );
113120 }
@@ -120,6 +127,7 @@ public function offsetGet($index): mixed
120127 */
121128 public function offsetExists ($ index ): bool
122129 {
130+ trigger_error ('Usage `isset($router[...])` is deprecated. ' , E_USER_DEPRECATED );
123131 return is_int ($ index ) && $ index >= 0 && $ index < count ($ this ->getRouters ());
124132 }
125133
@@ -130,6 +138,7 @@ public function offsetExists($index): bool
130138 */
131139 public function offsetUnset ($ index ): void
132140 {
141+ trigger_error ('Usage `unset($router[$index])` is deprecated, use `$router->modify($index, null)`. ' , E_USER_DEPRECATED );
133142 if (!$ this ->offsetExists ($ index )) {
134143 throw new Nette \OutOfRangeException ('Offset invalid or out of range ' );
135144 }
0 commit comments