Skip to content

Exception on instantiating descendant of \ArrayObject #129

@msjyoo

Description

@msjyoo

Hello,

I think I've found a bug when auryn attempts to instantiate an object which is a descendant of \ArrayObject.

Exception / Stack trace:

PHP Fatal error:  Uncaught exception 'InvalidArgumentException' with message 'Passed variable is not an array or object, using empty array instead' in /project/g/php-typechecker/vendor/rdlowrey/auryn/lib/Injector.php:400
Stack trace:
#0 [internal function]: ArrayObject->__construct(NULL)
#1 /project/g/php-typechecker/vendor/rdlowrey/auryn/lib/Injector.php(400): ReflectionClass->newInstanceArgs(Array)
#2 /project/g/php-typechecker/vendor/rdlowrey/auryn/lib/Injector.php(367): Auryn\Injector->provisionInstance('sekjun9878\\Func...', 'sekjun9878\\func...', Array)
#3 /project/g/php-typechecker/vendor/rdlowrey/auryn/lib/Injector.php(522): Auryn\Injector->make('sekjun9878\\Func...')
#4 /project/g/php-typechecker/vendor/rdlowrey/auryn/lib/Injector.php(459): Auryn\Injector->buildArgFromTypeHint(Object(ReflectionMethod), Object(ReflectionParameter))
#5 /h in /project/g/php-typechecker/vendor/rdlowrey/auryn/lib/Injector.php on line 400

Class signatures:

final class FunctionDirectory extends Directory
abstract class Directory extends \ArrayObject

Workaround:

//$functionDirectory = $injector->make(FunctionDirectory::class);
$functionDirectory = new FunctionDirectory;
$injector->share($functionDirectory);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions