1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Merge pull request #9740 from edsrzf/better-property-error

Fix OverriddenPropertyAccess error message
This commit is contained in:
orklah 2023-05-04 18:49:00 +02:00 committed by GitHub
commit 7483f4d809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -702,7 +702,7 @@ class ClassAnalyzer extends ClassLikeAnalyzer
new OverriddenPropertyAccess(
'Property ' . $fq_class_name . '::$' . $property_name
. ' has different access level than '
. $storage->name . '::$' . $property_name,
. $guide_class_name . '::$' . $property_name,
$property_storage->location,
),
);

View File

@ -5,6 +5,8 @@ namespace Psalm\Tests;
use Psalm\Tests\Traits\InvalidCodeAnalysisTestTrait;
use Psalm\Tests\Traits\ValidCodeAnalysisTestTrait;
use const DIRECTORY_SEPARATOR;
class ClassTest extends TestCase
{
use InvalidCodeAnalysisTestTrait;
@ -936,7 +938,7 @@ class ClassTest extends TestCase
/** @var string|null */
private $foo;
}',
'error_message' => 'OverriddenPropertyAccess',
'error_message' => 'OverriddenPropertyAccess - src' . DIRECTORY_SEPARATOR . 'somefile.php:9:33 - Property B::$foo has different access level than A::$foo',
],
'overridePublicPropertyAccessLevelToProtected' => [
'code' => '<?php