Return type of Nette\Application\Routers\RouteList::offsetGet($index) should either be compatible with ArrayAc

vlkodlak
Member | 167
+
0
-

full topic: Return type of Nette\Application\Routers\RouteList::offsetGet($index) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

File: ...\src\Application\Routers\RouteList.php:121
...
116:        /**
117:         * @param  int  $index
118:         * @return mixed
119:         * @throws Nette\OutOfRangeException
120:         */
121:        public function offsetGet($index)
122:        {
123:            if (!$this->offsetExists($index)) {
124:                throw new Nette\OutOfRangeException('Offset invalid or out of range');
125:            }
...

in last time Iwas created easy web page. My “agony” is I cannot update my frameworks to last version because … is not possible.
And now I need useing this version and adding new code, but when try changin to admin mode I have this misstake. But what I do not uderstand is when I have roduction mode all working prorelly withou error.

I added only my ip and activation debug mode

      $configurator->setDebugMode(true);
      $configurator->setDebugMode(['10.64.13.54']);

please help, where starting solving this

thx

nightfish
Member | 507
+
+2
-

vlkodlak wrote:

Return type of Nette\Application\Routers\RouteList::offsetGet($index) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

@vlkodlak
The version of nette/application that you are using is not compatible with the PHP version that you are using. You either need to upgrade nette/application to a newer version or use older PHP version.

Marek Bartoš
Nette Blogger | 1245
+
+3
-

If you can't update Nette, then don't change the PHP version either. Even if you do a patch for this change, there are likely more incompatibilities you'd have to solve.
Specifically for the ReturnTypeWillChange issue, your upper limit is PHP 8.0
You don't see the error in production mode, becase it is just a deprecation notice, not a hard failure. These are usually just logged in production mode. Debug mode warns you immediatelly instead.

These lines are duplicate. On first you enable debug mode for everyone and on the second, you enable it just for your IP address.

$configurator->setDebugMode(true);
$configurator->setDebugMode(['10.64.13.54']);
vlkodlak
Member | 167
+
0
-

@MarekBartoš thank you for your fast answer.