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

PHPStorm code inspection errors #1975

Open
paweltfit opened this issue Aug 14, 2023 · 4 comments · May be fixed by #1989
Open

PHPStorm code inspection errors #1975

paweltfit opened this issue Aug 14, 2023 · 4 comments · May be fixed by #1989

Comments

@paweltfit
Copy link

Hello,

During its inspection, PHPStorm returns errors like these in generated base query classes, complaining that the method Collection is already defined:

image

The code still works fine but obviously it's a bit inconvenient. I dealt with it by removing the following piece of code from the baseQueryClassHeader.php file, deleting all query classes and then re-running propel model:build:

<?php foreach($columns as $column):?>
 * @method     <?= $modelClass ?>[]|Collection findBy<?= $column->getPhpName() ?>(<?= $column->getPhpType() ?>|array<<?= $column->getPhpType() ?>> $<?= $column->getName() ?>) Return <?= $modelClass ?> objects filtered by the <?= $column->getName() ?> column
 * @psalm-method Collection&\Traversable<<?= $modelClass ?>> findBy<?= $column->getPhpName() ?>(<?= $column->getPhpType() ?>|array<<?= $column->getPhpType() ?>> $<?= $column->getName() ?>) Return <?= $modelClass ?> objects filtered by the <?= $column->getName() ?> column
<?php endforeach;?>

Another issue is the word match in the same file - it's now a reserved word in PHP so some comments were highlighting it as an error. I fixed it by putting match between single quotes on line 67.

What are your thoughts?

@tsybenko tsybenko linked a pull request Jan 21, 2024 that will close this issue
@tsybenko
Copy link

@paweltfit, I see a fully qualified class name has been missed here. Just provided a fix for that here - #1989

@PhilinTv
Copy link
Contributor

PhilinTv commented Feb 3, 2024

@tsybenko normally FQCN should not be required here, as there is a declaration of the Collection type in the use statement above. I checked in the older version of PHPStorm 2023, and it doesn't show such an error (it doesn't understand intersection type & either, not not error).

Does FQCN solve the problem in the newer versions?

@PhilinTv
Copy link
Contributor

PhilinTv commented Feb 3, 2024

After an update to PHPStorm to 2023.3.3, I can also see it. Phpstorm started to wrongly recognise psalm notations: here it recognised Collection as a class name, however the right class name is "findBy..".

@PhilinTv
Copy link
Contributor

PhilinTv commented Feb 4, 2024

@paweltfit Thanks for reporting this issue with new IDE version.
Please submit the "match" issue separately.

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.

3 participants