Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@var annotation behaving erratically #2366

Closed
JoyceBabu opened this issue Sep 7, 2023 · 2 comments · Fixed by #2371
Closed

@var annotation behaving erratically #2366

JoyceBabu opened this issue Sep 7, 2023 · 2 comments · Fixed by #2371

Comments

@JoyceBabu
Copy link

I have a PHP template file, which is included from my template engine class. Hence the variables are not defined within the template file, and I am trying to define the variables using @var annotation. But phpactor is behaving erratically when @var annotation is used to specify the type of a variable.

<?php

/** @var string $a */
/** @var string $b */
/** @var string $c */
?>
<?php

echo $a + $b;

echo $a;
echo $b;

image

But if I change the + operator to ., it no longer works.

image
@mamazu
Copy link
Contributor

mamazu commented Sep 7, 2023

Could it be that the variable scope is only inside the php tags? So if you put everything in one tag it works?

@JoyceBabu
Copy link
Author

No, putting it within the same <?php block too behaves the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants