-
-
Notifications
You must be signed in to change notification settings - Fork 742
Closed
rectorphp/rector-src
#6659Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/0980a8cb-7dd7-4118-b799-c892101f82e2
<?php
declare(strict_types=1);
namespace Survos\PixieBundle\Debug;
final class TraceableStorageBox extends StorageBox
{
// private Stopwatch $stopwatch;
function __construct(private string $filename,
private array &$data, // debug data, passed from Pixie
private ?Config $config=null, // for creation only. Shouldn't be in constructor!
private ?string $currentTable = null,
private ?int $version = 1,
private string $valueType = 'json', // eventually jsonb
private bool $temporary = false, // nyi
private readonly ?LoggerInterface $logger = null,
private readonly ?PropertyAccessorInterface $accessor = null,
private readonly ?SerializerInterface $serializer=null,
private array $formatters = [],
private readonly ?Stopwatch $stopwatch = null,
private ?string $pixieCode=null, //
private array $templates=[],
)
{
parent::__construct(...func_get_args());
// $this->stopwatch = $stopwatch;
}
// public function mapHeader(array $header, string $propertyRule, string $tableName = null, array $regexRules = []): array
// {
// return $this->innerSearchService(__FUNCTION__, \func_get_args());
// }
public function getVersion(): string
{
return $this->innerSearchService(__FUNCTION__, \func_get_args());
}
public function get(string $key, ?string $tableName = null, ?callable $callback=null): ?Item // string|object|array|null
// public function get(string $key, string $table = null): string|object|array|null
{
return $this->innerSearchService(__FUNCTION__, \func_get_args());
}
protected function query(string $sql, array $variables = []): \PDOStatement
{
return $this->innerSearchService(__FUNCTION__, \func_get_args());
}
public function innerSearchService(string $function, array $args): mixed
{
$this->stopwatch->start($function);
$result = parent::{$function}(...$args);
$event = $this->stopwatch->stop($function);
$this->data[$this->getFilename()][$function][] = [
'_params' => $args,
'_results' => $result,
'_duration' => $event->getDuration(),
'_memory' => $event->getMemory(),
];
return $result;
}
public function clear(): void
{
$this->innerSearchService(__FUNCTION__, \func_get_args());
}
public function delete(string $key, ?string $table = null): bool
{
return $this->innerSearchService(__FUNCTION__, \func_get_args());
}
public function count(?string $table = null, array $where=[]): ?int
{
return $this->innerSearchService(__FUNCTION__, \func_get_args());
}
}Responsible rules
ReadOnlyPropertyRector
Expected Behavior
I can't reproduce this in this platform, but on my machine, even with rector/rector:dev-main, I'm getting
I was, however, able to reproduce this by getting rid of the extends statement. But in this case I have an extends statement, and I call the parent in the constructor.
Reactions are currently unavailable
