array($ast->getType(), $ast->getFullName()) is of type array<integer,?,{"0":"?","1":"?"}>, but the function expects a object<Railt\SDL\Frontend\IR\iterable>.
It seems like the type of the argument is not accepted by the function/method
which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this
might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
functionacceptsInteger($int){}$x='123';// string "123"// Instead ofacceptsInteger($x);// we recommend to useacceptsInteger((integer)$x);
It seems like you code against a concrete implementation and not the interface Railt\Parser\Ast\RuleInterface as the method getType() does only exist in the following implementations of said interface: Railt\SDL\Frontend\AST\D...DirectiveDefinitionNode, Railt\SDL\Frontend\AST\D...tion\EnumDefinitionNode, Railt\SDL\Frontend\AST\D...ion\InputDefinitionNode, Railt\SDL\Frontend\AST\D...InterfaceDefinitionNode, Railt\SDL\Frontend\AST\D...on\ObjectDefinitionNode, Railt\SDL\Frontend\AST\D...on\ScalarDefinitionNode, Railt\SDL\Frontend\AST\D...on\SchemaDefinitionNode, Railt\SDL\Frontend\AST\D...tion\TypeDefinitionNode, Railt\SDL\Frontend\AST\D...ion\UnionDefinitionNode, Railt\SDL\Frontend\AST\D...\ArgumentDefinitionNode, Railt\SDL\Frontend\AST\D...ndentTypeDefinitionNode, Railt\SDL\Frontend\AST\D...EnumValueDefinitionNode, Railt\SDL\Frontend\AST\D...ent\FieldDefinitionNode, Railt\SDL\Frontend\AST\D...nputFieldDefinitionNode, Railt\SDL\Frontend\AST\I...DirectiveInvocationNode, Railt\SDL\Frontend\AST\I...ion\InputInvocationNode.
Let’s take a look at an example:
interfaceUser{/** @return string */publicfunctiongetPassword();}classMyUserimplementsUser{publicfunctiongetPassword(){// return something}publicfunctiongetDisplayName(){// return some name.}}classAuthSystem{publicfunctionauthenticate(User$user){$this->logger->info(sprintf('Authenticating %s.',$user->getDisplayName()));// do something.}}
In the above example, the authenticate() method works fine as long as you just pass
instances of MyUser. However, if you now also want to pass a different implementation
of User which does not have a getDisplayName() method, the code will break.
classAuthSystem{publicfunctionauthenticate(User$user){if($userinstanceofMyUser){$this->logger->info(/** ... */);}// or alternativelyif(!$userinstanceofMyUser){thrownew\LogicException('$user must be an instance of MyUser, '.'other instances are not supported.');}}}
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
It seems like you code against a concrete implementation and not the interface Railt\Parser\Ast\RuleInterface as the method getFullName() does only exist in the following implementations of said interface: Railt\SDL\Frontend\AST\Common\TypeHintNode, Railt\SDL\Frontend\AST\Common\TypeNameNode, Railt\SDL\Frontend\AST\D...DirectiveDefinitionNode, Railt\SDL\Frontend\AST\D...tion\EnumDefinitionNode, Railt\SDL\Frontend\AST\D...ion\InputDefinitionNode, Railt\SDL\Frontend\AST\D...InterfaceDefinitionNode, Railt\SDL\Frontend\AST\D...on\ObjectDefinitionNode, Railt\SDL\Frontend\AST\D...on\ScalarDefinitionNode, Railt\SDL\Frontend\AST\D...on\SchemaDefinitionNode, Railt\SDL\Frontend\AST\D...tion\TypeDefinitionNode, Railt\SDL\Frontend\AST\D...ion\UnionDefinitionNode, Railt\SDL\Frontend\AST\D...\ArgumentDefinitionNode, Railt\SDL\Frontend\AST\D...ndentTypeDefinitionNode, Railt\SDL\Frontend\AST\D...EnumValueDefinitionNode, Railt\SDL\Frontend\AST\D...ent\FieldDefinitionNode, Railt\SDL\Frontend\AST\D...nputFieldDefinitionNode, Railt\SDL\Frontend\AST\I...\ArgumentInvocationNode, Railt\SDL\Frontend\AST\I...DirectiveInvocationNode.
Let’s take a look at an example:
interfaceUser{/** @return string */publicfunctiongetPassword();}classMyUserimplementsUser{publicfunctiongetPassword(){// return something}publicfunctiongetDisplayName(){// return some name.}}classAuthSystem{publicfunctionauthenticate(User$user){$this->logger->info(sprintf('Authenticating %s.',$user->getDisplayName()));// do something.}}
In the above example, the authenticate() method works fine as long as you just pass
instances of MyUser. However, if you now also want to pass a different implementation
of User which does not have a getDisplayName() method, the code will break.
classAuthSystem{publicfunctionauthenticate(User$user){if($userinstanceofMyUser){$this->logger->info(/** ... */);}// or alternativelyif(!$userinstanceofMyUser){thrownew\LogicException('$user must be an instance of MyUser, '.'other instances are not supported.');}}}
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: