V3 fix/phpunit (#1024)

This commit is contained in:
Jerry Ma 2026-02-06 17:02:36 +08:00 committed by GitHub
parent 7c3ac484b3
commit 041b08f10f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 139 additions and 131 deletions

View File

@ -7,6 +7,7 @@ namespace StaticPHP\Registry;
use StaticPHP\Config\ArtifactConfig;
use StaticPHP\Config\PackageConfig;
use StaticPHP\ConsoleApplication;
use StaticPHP\Exception\FileSystemException;
use StaticPHP\Exception\RegistryException;
use StaticPHP\Util\FileSystem;
use Symfony\Component\Yaml\Yaml;
@ -87,116 +88,121 @@ class Registry
self::$current_registry_name = $registry_name;
// Load composer autoload if specified (for external registries with their own dependencies)
if (isset($data['autoload']) && is_string($data['autoload'])) {
$autoload_path = FileSystem::fullpath($data['autoload'], dirname($registry_file));
if (file_exists($autoload_path)) {
logger()->debug("Loading external autoload from: {$autoload_path}");
require_once $autoload_path;
} else {
logger()->warning("Autoload file not found: {$autoload_path}");
}
}
// load package configs
if (isset($data['package']['config']) && is_array($data['package']['config'])) {
foreach ($data['package']['config'] as $path) {
$path = FileSystem::fullpath($path, dirname($registry_file));
if (is_file($path)) {
self::$loaded_package_configs[] = PackageConfig::loadFromFile($path, $registry_name);
} elseif (is_dir($path)) {
self::$loaded_package_configs = array_merge(self::$loaded_package_configs, PackageConfig::loadFromDir($path, $registry_name));
try {
// Load composer autoload if specified (for external registries with their own dependencies)
if (isset($data['autoload']) && is_string($data['autoload'])) {
$autoload_path = FileSystem::fullpath($data['autoload'], dirname($registry_file));
if (file_exists($autoload_path)) {
logger()->debug("Loading external autoload from: {$autoload_path}");
require_once $autoload_path;
} else {
logger()->warning("Autoload file not found: {$autoload_path}");
}
}
}
// load artifact configs
if (isset($data['artifact']['config']) && is_array($data['artifact']['config'])) {
foreach ($data['artifact']['config'] as $path) {
$path = FileSystem::fullpath($path, dirname($registry_file));
if (is_file($path)) {
self::$loaded_artifact_configs[] = ArtifactConfig::loadFromFile($path, $registry_name);
} elseif (is_dir($path)) {
self::$loaded_package_configs = array_merge(self::$loaded_package_configs, ArtifactConfig::loadFromDir($path, $registry_name));
// load package configs
if (isset($data['package']['config']) && is_array($data['package']['config'])) {
foreach ($data['package']['config'] as $path) {
$path = FileSystem::fullpath($path, dirname($registry_file));
if (is_file($path)) {
self::$loaded_package_configs[] = PackageConfig::loadFromFile($path, $registry_name);
} elseif (is_dir($path)) {
self::$loaded_package_configs = array_merge(self::$loaded_package_configs, PackageConfig::loadFromDir($path, $registry_name));
}
}
}
}
// load doctor items from PSR-4 directories
if (isset($data['doctor']['psr-4']) && is_assoc_array($data['doctor']['psr-4'])) {
foreach ($data['doctor']['psr-4'] as $namespace => $path) {
$path = FileSystem::fullpath($path, dirname($registry_file));
DoctorLoader::loadFromPsr4Dir($path, $namespace, $auto_require);
// load artifact configs
if (isset($data['artifact']['config']) && is_array($data['artifact']['config'])) {
foreach ($data['artifact']['config'] as $path) {
$path = FileSystem::fullpath($path, dirname($registry_file));
if (is_file($path)) {
self::$loaded_artifact_configs[] = ArtifactConfig::loadFromFile($path, $registry_name);
} elseif (is_dir($path)) {
self::$loaded_package_configs = array_merge(self::$loaded_package_configs, ArtifactConfig::loadFromDir($path, $registry_name));
}
}
}
}
// load doctor items from specific classes
// Supports both array format ["ClassName"] and map format {"ClassName": "path/to/file.php"}
if (isset($data['doctor']['classes']) && is_array($data['doctor']['classes'])) {
foreach ($data['doctor']['classes'] as $key => $value) {
[$class, $file] = self::parseClassEntry($key, $value);
self::requireClassFile($class, $file, dirname($registry_file), $auto_require);
DoctorLoader::loadFromClass($class);
// load doctor items from PSR-4 directories
if (isset($data['doctor']['psr-4']) && is_assoc_array($data['doctor']['psr-4'])) {
foreach ($data['doctor']['psr-4'] as $namespace => $path) {
$path = FileSystem::fullpath($path, dirname($registry_file));
DoctorLoader::loadFromPsr4Dir($path, $namespace, $auto_require);
}
}
}
// load packages from PSR-4 directories
if (isset($data['package']['psr-4']) && is_assoc_array($data['package']['psr-4'])) {
foreach ($data['package']['psr-4'] as $namespace => $path) {
$path = FileSystem::fullpath($path, dirname($registry_file));
PackageLoader::loadFromPsr4Dir($path, $namespace, $auto_require);
// load doctor items from specific classes
// Supports both array format ["ClassName"] and map format {"ClassName": "path/to/file.php"}
if (isset($data['doctor']['classes']) && is_array($data['doctor']['classes'])) {
foreach ($data['doctor']['classes'] as $key => $value) {
[$class, $file] = self::parseClassEntry($key, $value);
self::requireClassFile($class, $file, dirname($registry_file), $auto_require);
DoctorLoader::loadFromClass($class);
}
}
}
// load packages from specific classes
// Supports both array format ["ClassName"] and map format {"ClassName": "path/to/file.php"}
if (isset($data['package']['classes']) && is_array($data['package']['classes'])) {
foreach ($data['package']['classes'] as $key => $value) {
[$class, $file] = self::parseClassEntry($key, $value);
self::requireClassFile($class, $file, dirname($registry_file), $auto_require);
PackageLoader::loadFromClass($class);
// load packages from PSR-4 directories
if (isset($data['package']['psr-4']) && is_assoc_array($data['package']['psr-4'])) {
foreach ($data['package']['psr-4'] as $namespace => $path) {
$path = FileSystem::fullpath($path, dirname($registry_file));
PackageLoader::loadFromPsr4Dir($path, $namespace, $auto_require);
}
}
}
// load artifacts from PSR-4 directories
if (isset($data['artifact']['psr-4']) && is_assoc_array($data['artifact']['psr-4'])) {
foreach ($data['artifact']['psr-4'] as $namespace => $path) {
$path = FileSystem::fullpath($path, dirname($registry_file));
ArtifactLoader::loadFromPsr4Dir($path, $namespace, $auto_require);
// load packages from specific classes
// Supports both array format ["ClassName"] and map format {"ClassName": "path/to/file.php"}
if (isset($data['package']['classes']) && is_array($data['package']['classes'])) {
foreach ($data['package']['classes'] as $key => $value) {
[$class, $file] = self::parseClassEntry($key, $value);
self::requireClassFile($class, $file, dirname($registry_file), $auto_require);
PackageLoader::loadFromClass($class);
}
}
}
// load artifacts from specific classes
// Supports both array format ["ClassName"] and map format {"ClassName": "path/to/file.php"}
if (isset($data['artifact']['classes']) && is_array($data['artifact']['classes'])) {
foreach ($data['artifact']['classes'] as $key => $value) {
[$class, $file] = self::parseClassEntry($key, $value);
self::requireClassFile($class, $file, dirname($registry_file), $auto_require);
ArtifactLoader::loadFromClass($class);
// load artifacts from PSR-4 directories
if (isset($data['artifact']['psr-4']) && is_assoc_array($data['artifact']['psr-4'])) {
foreach ($data['artifact']['psr-4'] as $namespace => $path) {
$path = FileSystem::fullpath($path, dirname($registry_file));
ArtifactLoader::loadFromPsr4Dir($path, $namespace, $auto_require);
}
}
}
// load additional commands from PSR-4 directories
if (isset($data['command']['psr-4']) && is_assoc_array($data['command']['psr-4'])) {
foreach ($data['command']['psr-4'] as $namespace => $path) {
$path = FileSystem::fullpath($path, dirname($registry_file));
$classes = FileSystem::getClassesPsr4($path, $namespace, auto_require: $auto_require);
$instances = array_map(fn ($x) => new $x(), $classes);
// load artifacts from specific classes
// Supports both array format ["ClassName"] and map format {"ClassName": "path/to/file.php"}
if (isset($data['artifact']['classes']) && is_array($data['artifact']['classes'])) {
foreach ($data['artifact']['classes'] as $key => $value) {
[$class, $file] = self::parseClassEntry($key, $value);
self::requireClassFile($class, $file, dirname($registry_file), $auto_require);
ArtifactLoader::loadFromClass($class);
}
}
// load additional commands from PSR-4 directories
if (isset($data['command']['psr-4']) && is_assoc_array($data['command']['psr-4'])) {
foreach ($data['command']['psr-4'] as $namespace => $path) {
$path = FileSystem::fullpath($path, dirname($registry_file));
$classes = FileSystem::getClassesPsr4($path, $namespace, auto_require: $auto_require);
$instances = array_map(fn ($x) => new $x(), $classes);
ConsoleApplication::_addAdditionalCommands($instances);
}
}
// load additional commands from specific classes
// Supports both array format ["ClassName"] and map format {"ClassName": "path/to/file.php"}
if (isset($data['command']['classes']) && is_array($data['command']['classes'])) {
$instances = [];
foreach ($data['command']['classes'] as $key => $value) {
[$class, $file] = self::parseClassEntry($key, $value);
self::requireClassFile($class, $file, dirname($registry_file), $auto_require);
$instances[] = new $class();
}
ConsoleApplication::_addAdditionalCommands($instances);
}
} catch (FileSystemException $e) {
throw new RegistryException($e->getMessage(), 0, $e);
}
// load additional commands from specific classes
// Supports both array format ["ClassName"] and map format {"ClassName": "path/to/file.php"}
if (isset($data['command']['classes']) && is_array($data['command']['classes'])) {
$instances = [];
foreach ($data['command']['classes'] as $key => $value) {
[$class, $file] = self::parseClassEntry($key, $value);
self::requireClassFile($class, $file, dirname($registry_file), $auto_require);
$instances[] = new $class();
}
ConsoleApplication::_addAdditionalCommands($instances);
}
self::$current_registry_name = null;
}

View File

@ -50,7 +50,7 @@ class ArtifactConfigTest extends TestCase
$this->expectException(WrongUsageException::class);
$this->expectExceptionMessage('Directory /nonexistent/path does not exist, cannot load artifact config.');
ArtifactConfig::loadFromDir('/nonexistent/path');
ArtifactConfig::loadFromDir('/nonexistent/path', 'test');
}
public function testLoadFromDirWithValidArtifactJson(): void
@ -63,7 +63,7 @@ class ArtifactConfigTest extends TestCase
file_put_contents($this->tempDir . '/artifact.json', $artifactContent);
ArtifactConfig::loadFromDir($this->tempDir);
ArtifactConfig::loadFromDir($this->tempDir, 'test');
$config = ArtifactConfig::get('test-artifact');
$this->assertIsArray($config);
@ -88,7 +88,7 @@ class ArtifactConfigTest extends TestCase
file_put_contents($this->tempDir . '/artifact.lib.json', $artifact2Content);
file_put_contents($this->tempDir . '/artifact.json', json_encode(['artifact-3' => ['source' => 'custom']]));
ArtifactConfig::loadFromDir($this->tempDir);
ArtifactConfig::loadFromDir($this->tempDir, 'test');
$this->assertNotNull(ArtifactConfig::get('artifact-1'));
$this->assertNotNull(ArtifactConfig::get('artifact-2'));
@ -100,7 +100,7 @@ class ArtifactConfigTest extends TestCase
$this->expectException(WrongUsageException::class);
$this->expectExceptionMessage('Failed to read artifact config file:');
ArtifactConfig::loadFromFile('/nonexistent/file.json');
ArtifactConfig::loadFromFile('/nonexistent/file.json', 'test');
}
public function testLoadFromFileThrowsExceptionWhenJsonIsInvalid(): void
@ -111,7 +111,7 @@ class ArtifactConfigTest extends TestCase
$this->expectException(WrongUsageException::class);
$this->expectExceptionMessage('Invalid JSON format in artifact config file:');
ArtifactConfig::loadFromFile($file);
ArtifactConfig::loadFromFile($file, 'test');
}
public function testLoadFromFileWithValidJson(): void
@ -127,7 +127,7 @@ class ArtifactConfigTest extends TestCase
]);
file_put_contents($file, $content);
ArtifactConfig::loadFromFile($file);
ArtifactConfig::loadFromFile($file, 'test');
$config = ArtifactConfig::get('my-artifact');
$this->assertIsArray($config);
@ -144,7 +144,7 @@ class ArtifactConfigTest extends TestCase
]);
file_put_contents($file, $content);
ArtifactConfig::loadFromFile($file);
ArtifactConfig::loadFromFile($file, 'test');
$all = ArtifactConfig::getAll();
$this->assertIsArray($all);
@ -170,7 +170,7 @@ class ArtifactConfigTest extends TestCase
]);
file_put_contents($file, $content);
ArtifactConfig::loadFromFile($file);
ArtifactConfig::loadFromFile($file, 'test');
$config = ArtifactConfig::get('test-artifact');
$this->assertIsArray($config);
@ -188,7 +188,7 @@ class ArtifactConfigTest extends TestCase
]);
file_put_contents($file, $content);
ArtifactConfig::loadFromFile($file);
ArtifactConfig::loadFromFile($file, 'test');
$config = ArtifactConfig::get('test-artifact');
$this->assertIsArray($config);
@ -208,7 +208,7 @@ class ArtifactConfigTest extends TestCase
]);
file_put_contents($file, $content);
ArtifactConfig::loadFromFile($file);
ArtifactConfig::loadFromFile($file, 'test');
$config = ArtifactConfig::get('test-artifact');
$this->assertIsArray($config['binary']);
@ -228,7 +228,7 @@ class ArtifactConfigTest extends TestCase
]);
file_put_contents($file, $content);
ArtifactConfig::loadFromFile($file);
ArtifactConfig::loadFromFile($file, 'test');
$config = ArtifactConfig::get('test-artifact');
$this->assertIsArray($config['binary']);
@ -253,7 +253,7 @@ class ArtifactConfigTest extends TestCase
]);
file_put_contents($file, $content);
ArtifactConfig::loadFromFile($file);
ArtifactConfig::loadFromFile($file, 'test');
$config = ArtifactConfig::get('test-artifact');
$this->assertIsArray($config['binary']);
@ -266,7 +266,7 @@ class ArtifactConfigTest extends TestCase
public function testLoadFromDirWithEmptyDirectory(): void
{
// Empty directory should not throw exception
ArtifactConfig::loadFromDir($this->tempDir);
ArtifactConfig::loadFromDir($this->tempDir, 'test');
$this->assertEquals([], ArtifactConfig::getAll());
}
@ -279,8 +279,8 @@ class ArtifactConfigTest extends TestCase
file_put_contents($file1, json_encode(['art1' => ['source' => 'custom']]));
file_put_contents($file2, json_encode(['art2' => ['source' => 'custom']]));
ArtifactConfig::loadFromFile($file1);
ArtifactConfig::loadFromFile($file2);
ArtifactConfig::loadFromFile($file1, 'test');
ArtifactConfig::loadFromFile($file2, 'test');
$all = ArtifactConfig::getAll();
$this->assertCount(2, $all);

View File

@ -582,7 +582,7 @@ class ConfigValidatorTest extends TestCase
public function testValidateAndLintPackagesThrowsExceptionForWrongTypeString(): void
{
$this->expectException(ValidationException::class);
$this->expectExceptionMessage('Package test-pkg [artifact] must be string');
$this->expectExceptionMessage('Package test-pkg [artifact] has invalid type specification');
$data = [
'test-pkg' => [

View File

@ -6,6 +6,7 @@ namespace Tests\StaticPHP\Config;
use PHPUnit\Framework\TestCase;
use StaticPHP\Config\PackageConfig;
use StaticPHP\Exception\ValidationException;
use StaticPHP\Exception\WrongUsageException;
use StaticPHP\Runtime\SystemTarget;
@ -49,7 +50,7 @@ class PackageConfigTest extends TestCase
$this->expectException(WrongUsageException::class);
$this->expectExceptionMessage('Directory /nonexistent/path does not exist, cannot load pkg.json config.');
PackageConfig::loadFromDir('/nonexistent/path');
PackageConfig::loadFromDir('/nonexistent/path', 'test');
}
public function testLoadFromDirWithValidPkgJson(): void
@ -63,7 +64,7 @@ class PackageConfigTest extends TestCase
file_put_contents($this->tempDir . '/pkg.json', $packageContent);
PackageConfig::loadFromDir($this->tempDir);
PackageConfig::loadFromDir($this->tempDir, 'test');
$this->assertTrue(PackageConfig::isPackageExists('test-pkg'));
}
@ -87,7 +88,7 @@ class PackageConfigTest extends TestCase
file_put_contents($this->tempDir . '/pkg.lib.json', $pkg2Content);
file_put_contents($this->tempDir . '/pkg.json', json_encode(['pkg-3' => ['type' => 'virtual-target']]));
PackageConfig::loadFromDir($this->tempDir);
PackageConfig::loadFromDir($this->tempDir, 'test');
$this->assertTrue(PackageConfig::isPackageExists('pkg-1'));
$this->assertTrue(PackageConfig::isPackageExists('pkg-2'));
@ -99,7 +100,7 @@ class PackageConfigTest extends TestCase
$this->expectException(WrongUsageException::class);
$this->expectExceptionMessage('Failed to read package config file:');
PackageConfig::loadFromFile('/nonexistent/file.json');
PackageConfig::loadFromFile('/nonexistent/file.json', 'test');
}
public function testLoadFromFileThrowsExceptionWhenJsonIsInvalid(): void
@ -107,10 +108,10 @@ class PackageConfigTest extends TestCase
$file = $this->tempDir . '/invalid.json';
file_put_contents($file, 'not valid json{');
$this->expectException(WrongUsageException::class);
$this->expectExceptionMessage('Invalid JSON format in package config file:');
$this->expectException(ValidationException::class);
$this->expectExceptionMessage('invalid.json is broken');
PackageConfig::loadFromFile($file);
PackageConfig::loadFromFile($file, 'test');
}
public function testLoadFromFileWithValidJson(): void
@ -124,7 +125,7 @@ class PackageConfigTest extends TestCase
]);
file_put_contents($file, $content);
PackageConfig::loadFromFile($file);
PackageConfig::loadFromFile($file, 'test');
$this->assertTrue(PackageConfig::isPackageExists('my-pkg'));
}
@ -145,7 +146,7 @@ class PackageConfigTest extends TestCase
]);
file_put_contents($file, $content);
PackageConfig::loadFromFile($file);
PackageConfig::loadFromFile($file, 'test');
$this->assertTrue(PackageConfig::isPackageExists('test-pkg'));
}
@ -160,7 +161,7 @@ class PackageConfigTest extends TestCase
]);
file_put_contents($file, $content);
PackageConfig::loadFromFile($file);
PackageConfig::loadFromFile($file, 'test');
$all = PackageConfig::getAll();
$this->assertIsArray($all);
@ -189,7 +190,7 @@ class PackageConfigTest extends TestCase
]);
file_put_contents($file, $content);
PackageConfig::loadFromFile($file);
PackageConfig::loadFromFile($file, 'test');
$result = PackageConfig::get('test-pkg');
$this->assertIsArray($result);
@ -208,7 +209,7 @@ class PackageConfigTest extends TestCase
]);
file_put_contents($file, $content);
PackageConfig::loadFromFile($file);
PackageConfig::loadFromFile($file, 'test');
$result = PackageConfig::get('test-pkg', 'artifact');
$this->assertEquals('test-artifact', $result);
@ -225,7 +226,7 @@ class PackageConfigTest extends TestCase
]);
file_put_contents($file, $content);
PackageConfig::loadFromFile($file);
PackageConfig::loadFromFile($file, 'test');
$result = PackageConfig::get('test-pkg', 'non-existent-field', 'default');
$this->assertEquals('default', $result);
@ -251,7 +252,7 @@ class PackageConfigTest extends TestCase
]);
file_put_contents($file, $content);
PackageConfig::loadFromFile($file);
PackageConfig::loadFromFile($file, 'test');
// The get method will check SystemTarget::getTargetOS()
// On real Linux systems, it should return 'depends@linux' first
@ -273,7 +274,7 @@ class PackageConfigTest extends TestCase
]);
file_put_contents($file, $content);
PackageConfig::loadFromFile($file);
PackageConfig::loadFromFile($file, 'test');
$result = PackageConfig::get('test-pkg', 'depends');
$this->assertEquals(['base-dep'], $result);
@ -291,7 +292,7 @@ class PackageConfigTest extends TestCase
]);
file_put_contents($file, $content);
PackageConfig::loadFromFile($file);
PackageConfig::loadFromFile($file, 'test');
// 'artifact' is not in SUFFIX_ALLOWED_FIELDS, so it won't check suffixes
$result = PackageConfig::get('test-pkg', 'artifact');
@ -314,7 +315,7 @@ class PackageConfigTest extends TestCase
]);
file_put_contents($file, $content);
PackageConfig::loadFromFile($file);
PackageConfig::loadFromFile($file, 'test');
// These are all suffix-allowed fields
$pkg = PackageConfig::get('test-pkg');
@ -328,7 +329,7 @@ class PackageConfigTest extends TestCase
public function testLoadFromDirWithEmptyDirectory(): void
{
// Empty directory should not throw exception
PackageConfig::loadFromDir($this->tempDir);
PackageConfig::loadFromDir($this->tempDir, 'test');
$this->assertEquals([], PackageConfig::getAll());
}
@ -341,8 +342,8 @@ class PackageConfigTest extends TestCase
file_put_contents($file1, json_encode(['pkg1' => ['type' => 'virtual-target']]));
file_put_contents($file2, json_encode(['pkg2' => ['type' => 'virtual-target']]));
PackageConfig::loadFromFile($file1);
PackageConfig::loadFromFile($file2);
PackageConfig::loadFromFile($file1, 'test');
PackageConfig::loadFromFile($file2, 'test');
$all = PackageConfig::getAll();
$this->assertCount(2, $all);
@ -366,7 +367,7 @@ class PackageConfigTest extends TestCase
]);
file_put_contents($file, $content);
PackageConfig::loadFromFile($file);
PackageConfig::loadFromFile($file, 'test');
$phpExt = PackageConfig::get('test-ext', 'php-extension');
$this->assertIsArray($phpExt);
@ -384,7 +385,7 @@ class PackageConfigTest extends TestCase
]);
file_put_contents($file, $content);
PackageConfig::loadFromFile($file);
PackageConfig::loadFromFile($file, 'test');
$result = PackageConfig::get('test-pkg', 'non-existent');
$this->assertNull($result);
@ -411,7 +412,7 @@ class PackageConfigTest extends TestCase
]);
file_put_contents($file, $content);
PackageConfig::loadFromFile($file);
PackageConfig::loadFromFile($file, 'test');
$this->assertTrue(PackageConfig::isPackageExists('library-pkg'));
$this->assertTrue(PackageConfig::isPackageExists('extension-pkg'));

View File

@ -7,6 +7,7 @@ namespace Tests\StaticPHP\DI;
use DI\Container;
use PHPUnit\Framework\TestCase;
use StaticPHP\DI\CallbackInvoker;
use StaticPHP\Exception\SPCInternalException;
/**
* Helper class that requires constructor parameters for testing
@ -92,7 +93,7 @@ class CallbackInvokerTest extends TestCase
// Should not resolve from container as 'test.service' is not a type
// Will try default value or null
$this->expectException(\RuntimeException::class);
$this->expectException(SPCInternalException::class);
$this->invoker->invoke($callback);
}
@ -139,7 +140,7 @@ class CallbackInvokerTest extends TestCase
return $required;
};
$this->expectException(\RuntimeException::class);
$this->expectException(SPCInternalException::class);
$this->expectExceptionMessage("Cannot resolve parameter 'required' of type 'string'");
$this->invoker->invoke($callback);
}
@ -527,7 +528,7 @@ class CallbackInvokerTest extends TestCase
$callback = eval('return function (string|int $param) { return $param; };');
// Union types are not ReflectionNamedType, should not be resolved from container
$this->expectException(\RuntimeException::class);
$this->expectException(SPCInternalException::class);
$this->invoker->invoke($callback);
}
@ -594,7 +595,7 @@ class CallbackInvokerTest extends TestCase
return $obj;
};
$this->expectException(\RuntimeException::class);
$this->expectException(SPCInternalException::class);
$this->expectExceptionMessage("Cannot resolve parameter 'obj'");
$this->invoker->invoke($callback);