Closed Faboslav closed 2 years ago
Hi @Faboslav.
resources/stubs
is used only for IDE autocompletion and you can ignore it.
Oh, i am ignoring it all right, but PSALM and PHPStan doesnt know that.
Oh, i am ignoring it all right, but PSALM and PHPStan doesnt know that.
You can ignore vendor directory via psalm config
<?xml version="1.0"?>
<psalm>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
But i want to resolve that error which Is generated by PSALM caused by two identical namespaces in this package, which Is in general bad practice, right?
It is possible to make annotations with named arguments like this: https://github.com/cycle/annotated/pull/34 But we don't have priority in this direction. We have some task about release ORM v2.
What, do we understand each other? Annotations are working great, but why do we need to have two identical namespaces? That Is highly unusual right? And static analytic can't deal with that.
Psalm does not check fake attributes (stubs) because they are not added in composer.json psr-4 section. Static analysis cannot handle the signature of real attributes because they don't use named arguments.
Psalm sees this signature
and says that your definition #[Column(type: 'datetime')]
is uncompatible.
But it works because under hood the spiral/attributes package converts type: 'datetime'
from metadata to ['type' => 'datetime']
and pass it in the attribute constructor.
There are two solutions: 1 Configure suppression InvalidNamedArgument for Cycle Attributes 2 Update attributes to using named arguments like this: #34
Okay, i get it now, thanks for your explanation and patience.
No problem.
By the way. Instead of full ignoring some project files you can configure suppression for the InvalidNamedArgument
handler only for cycle atributes. psalm.xml
for example:
<?xml version="1.0"?>
<psalm
...
>
...
<issueHandlers>
...
<InvalidNamedArgument>
<errorLevel type="suppress">
<directory name="vendor/cycle/annotated/src/Annotation" />
</errorLevel>
</InvalidNamedArgument>
</issueHandlers>
</psalm>
Fixed in annotated v3.0.0 (Cycle ORM v2.0)
Oh this is cool, thank you for your hard work!
For example there is
namespace Cycle\Annotated\Annotation;
located inresources/stubs
and also insrc/Annotation
. This can't be right, right? It is messing with psalm and other alike tools. Is there any solution for that?Error generated by psalm looks like this:
It is probably using the first occurence in alphabet for that namespace?