Closed aszenz closed 6 months ago
Additional context Symfony cs fix rules auto convert
/** @var */
to/* @var */
Just to mention that I failed to confirm this.
And obviously Symfony itself uses /** @var ...
far more than /* @var ...
@jfcherng Thanks for confirming, just got to know this auto conversion by php cs fixer only happens in cases where there is no assignment like this:
/* @var Contract $subject */
$subject->methodCall($argument);
Anyways would be nice if this is supported
where there is no assignment like this:
/* @var Contract $subject */ $subject->methodCall($argument);
Not on my side.
But I am not against supporting /* @var ...
since it's not a BC breaking feature.
@jfcherng Thanks, I made up an exact example to reproduce it:
<?php
if (true) {
/** @var Contract $subject */
$subject->methodCall($argument);
}
Using symfony rules this is converted to /* @var Contract $subject */
@jfcherng Thanks, I made up an exact example to reproduce it:
<?php if (true) { /** @var Contract $subject */ $subject->methodCall($argument); }
Using symfony rules this is converted to
/* @var Contract $subject */
Feel weird but confirmed.
any update on this?
also need support for
/* @var $obj Class */
support please
v1.8.2 any update?
também preciso de apoio para / @var $obj Class /
Fix your "converters", /*
is not a docblock.
Please, support /** @var $obj Class */
It is supported. Except it is senseless. But supported.
Use the following rule to prevent conversion /** @var */
: phpdoc_to_comment.ignored_tags
// .php-cs-fixer.php
<?php
return (new PhpCsFixer\Config())
->setRules([
// ... more rules
'phpdoc_to_comment' => ['ignored_tags' => ['var']],
])
;
Please, support
/** @var $obj Class */
-1 for this feature.
Both /* @var */
and /** @var $obj Class */
are wrong, should not be supported. You should fix your linter.
when I use something like this in my tests
/** @var CEClient $ceClient */
$ceClient = $this->mock(CEClient::class);
everything works
but if I use
/** @var CEClient $ceClient */
$ceClient = $this->mock(CEClient::class, function (MockInterface $mock) {
$mock->shouldReceive('createFulfillment')
->andThrow(new Exception('Exception occurred'));
});
It doesn't recognize the type correctly,
let's use other programming language
Feature description or problem with existing feature In our code there are many type declarations using single astreiks syntax for variable type annotations, phpStorm can parse them while Intelphense can't
Describe the solution you'd like Consider
/* @var */
the same as/** @var */
Additional context Symfony cs fix rules auto convert
/** @var */
to/* @var */
in some cases