Skip to content

Invalid argument supplied when condition is stored in variable #1209

@simPod

Description

@simPod
	/**
	 * @param mixed[]|string $value
	 */
	public function sayHello($value): void
	{
		$isArray = is_array($value);
		if($isArray){
			foreach($value as $x){
				
			}
		}

	}

Argument of an invalid type array|string supplied for foreach, only iterables are supported.

https://phpstan.org/r/a2c25c03288fbfc18c7d0a7cb6460764

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions