-
Notifications
You must be signed in to change notification settings - Fork 108
Closed
Description
Version: 1.2.6 to 1.2.8
Very buggy static analyse - sometimes PHPStan is ok and sometimes reports manz errors
Example code:
<?php declare(strict_types = 1);
namespace App\Entities;
use Doctrine\ORM\Mapping as ORM;
use App\Repositories\CountryRepository;
#[ORM\Entity(repositoryClass: CountryRepository::class)]
#[ORM\Table(name: 'countries')]
class Country
{
#[ORM\Id]
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue]
private int $id;
#[ORM\Column(type: 'string', nullable: false)]
private string $code;
#[ORM\Column(type: 'string', nullable: false)]
private string $country;
public function getId(): int
{
return $this->id;
}
public function getCode(): string
{
return $this->code;
}
public function getCountry(): string
{
return $this->country;
}
public function setCode(string $code): void
{
$this->code = $code;
}
public function setCountry(string $country): void
{
$this->country = $country;
}
}
?>
<?php declare(strict_types = 1);
namespace App\Repositories;
use App\Entities\Country;
use App\Model\EntityRepository;
/**
* @extends EntityRepository<Country>
*/
final class CountryRepository extends EntityRepository
{
}
?>
<?php declare(strict_types = 1);
namespace App\Model;
use Doctrine\ORM\EntityRepository as DoctrineEntityRepository;
/**
* @template TEntityClass of object
* @extends DoctrineEntityRepository<TEntityClass>
*/
abstract class EntityRepository extends DoctrineEntityRepository
{
}
tests/object-manager.php
<?php declare(strict_types = 1);
return App\Bootstrap::boot()
->createContainer()
->getByType(App\Model\EntityManagerDecorator::class);
phpstan.neon
parameters:
level: 8
doctrine:
repositoryClass: App\Model\EntityRepository
objectManagerLoader: tests/object-manager.php
composer packages versions:
beberlei/doctrineextensions v1.3.0
contributte/console v0.9.1
contributte/di v0.5.1
doctrine/annotations 1.13.2
doctrine/cache 1.12.1
doctrine/collections 1.6.8
doctrine/common 3.2.1
doctrine/dbal 2.13.7
doctrine/deprecations v0.5.3
doctrine/event-manager 1.1.1
doctrine/inflector 2.0.4
doctrine/instantiator 1.4.0
doctrine/lexer 1.2.2
doctrine/orm 2.11.1
doctrine/persistence 2.3.0
latte/latte v2.10.8
nette/application v3.0.8
nette/bootstrap v3.0.2
nette/caching v3.0.2
nette/component-model v3.0.2
nette/di v3.0.12
nette/finder v2.5.3
nette/forms v3.0.7
nette/http v3.0.7
nette/mail v3.1.8
nette/neon v3.3.2
nette/php-generator v3.6.5
nette/robot-loader v3.4.1
nette/routing v3.0.2
nette/safe-stream v2.5.0
nette/security v3.0.6
nette/schema v1.2.2
nette/tokenizer v3.1.0
nette/utils v3.2.7
nettrine/annotations v0.7.0
nettrine/cache v0.3.0
nettrine/dbal v0.7.0
nettrine/extensions-beberlei v0.2.0
nettrine/orm v0.8.2
psr/cache 3.0.0
psr/container 2.0.2
symfony/console v5.4.3
symfony/deprecation-contracts v3.0.0
symfony/polyfill-ctype v1.24.0
symfony/polyfill-intl-grapheme v1.24.0
symfony/polyfill-intl-normalizer v1.24.0
symfony/polyfill-mbstring v1.24.0
symfony/polyfill-php72 v1.24.0
symfony/polyfill-php73 v1.24.0
symfony/polyfill-php80 v1.24.0
symfony/service-contracts v3.0.0
symfony/string v6.0.3
tracy/tracy v2.7.8
Dev Packages
nette/tester v2.4.1
phpstan/extension-installer 1.1.0
phpstan/phpstan 1.4.4
phpstan/phpstan-deprecation-rules 1.0.0
phpstan/phpstan-doctrine 1.2.8
phpstan/phpstan-nette 1.0.0
phpstan/phpstan-strict-rules 1.1.0
Error report:
------ -----------------------------------------------------------------------
Line app/Entities/Country.php
------ -----------------------------------------------------------------------
16 Property App\Entities\Country::$id is never written, only
read.
💡 See:
https://phpstan.org/developing-extensions/always-read-written-propert
ies
------ -----------------------------------------------------------------------
Metadata
Metadata
Assignees
Labels
No labels