When I reach 488 definitions i get error

mcmatak
Member | 504
+
0
-

I have apitte directory with controllers, when i add next controller, and final count of definitions in config reach 488, then i get this error:

Notice

Object of class Nette\DI\Definitions\Statement could not be converted to int

problem is on this row


 $serviceDefinitions = array_unique($serviceDefinitions, SORT_REGULAR);

tracy

my composer info:

nette/application v3.0.2.1 🏆 Nette Application: a full-stack component-based MVC kernel for PHP that helps you write powerful and modern…
nette/bootstrap v3.0.2 🅱 Nette Bootstrap: the simple way to configure and bootstrap your Nette application.
nette/caching v3.1.4 ⏱ Nette Caching: library with easy-to-use API and many cache backends.
nette/component-model v3.0.3 ⚛ Nette Component Model
nette/database v3.0.2 💾 Nette Database: layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins…
nette/di v3.0.2 💎 Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowi…
nette/finder v2.6.0 🔍 Nette Finder: find files and directories with an intuitive API.
nette/forms v3.0.7 ?? Nette Forms: generating, validating and processing secure forms in PHP. Handy API, fully customizable, server…
nette/http v3.0.3.1 🌐 Nette Http: abstraction for HTTP request, response and session. Provides careful data sanitization and util…
nette/mail v3.1.0 📧 Nette Mail: handy email creation and transfer library for PHP with both text and MIME-compliant support.
nette/neon v3.3.3 🍸 Nette NEON: encodes and decodes NEON file format.
nette/nette v3.0.0 ? Nette Framework – innovative framework for fast and easy development of secured web applications in PHP (metap…
nette/php-generator v3.4.1 🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 7.4 features.
nette/reflection v2.4.2 Nette Reflection: docblock annotations parser and common reflection classes
nette/robot-loader v3.4.2 🍀 Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within…
nette/routing v3.0.5 Nette Routing: two-ways URL conversion
nette/safe-stream v2.5.1 Nette SafeStream: provides isolation for thread safe manipulation with files via native PHP functions.
nette/schema v1.0.1 📐 Nette Schema: validating data structures against a given Schema.
nette/security v3.0.2 🔑 Nette Security: provides authentication, authorization and a role-based access control management via ACL (…
nette/tokenizer v3.1.1 Nette Tokenizer
nette/utils v3.0.4 🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/deco…

i cant explain myself what is going on :(

David Grudl
Nette Core | 8179
+
0
-

Write the issue to the repository that contains the file where the error is occurring.

mcmatak
Member | 504
+
0
-

i solved it by this code, but i am not sure if it is ok

// 17.1.2024 - bcs it throws error when there is too much services, https://forum.nette.org/en/36319-when-i-reach-488-definitions-i-get-error
		/*
		 * impossible to serialize closure
		 */
		$uniqueArray = [];
		foreach ($serviceDefinitions as $item) {
			//d($item);
			//$key = serialize($item); // nebo nějaký jiný jedinečný identifikátor
			$key = json_encode($item);
			$uniqueArray[$key] = $item;
		}
		$serviceDefinitions = array_values($uniqueArray);