-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
phpstan/phpstan-src
#3855Closed
Copy link
Description
Bug report
Hi!
the most recent version added some new rules about hooked property unset. I'm trying to find out, that this is expected behavior or a bug.
I can't create a reproducer as I'm using 3rd party code, but I have something like this:
<?php declare(strict_types = 1);
namespace App\Monolog\Handler;
use Monolog\Handler\AbstractProcessingHandler;
use Monolog\LogRecord;
class MynHandler extends AbstractProcessingHandler
{
protected function write(LogRecord $record): void
{
// ...
unset($record->formatted['context']['target']);
// ...
}
}
This shows the error:
Cannot unset property Monolog\LogRecord::$formatted because it might have hooks in a subclass.
But I'm not unsetting the whole property only part of it.
Code snippet that reproduces the problem
No response
Expected output
probably no error
Did PHPStan help you today? Did it make you happy in any way?
yes, as allway :)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels