mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
commit
bb9aabe5b1
@ -557,7 +557,11 @@ class FunctionLikeNodeScanner
|
||||
= $classlike_storage->appearing_method_ids[$method_name_lc]
|
||||
= $method_id;
|
||||
|
||||
if (!$stmt->isPrivate() || $method_name_lc === '__construct' || $classlike_storage->is_trait) {
|
||||
if (!$stmt->isPrivate()
|
||||
|| $method_name_lc === '__construct'
|
||||
|| $method_name_lc === '__clone'
|
||||
|| $classlike_storage->is_trait
|
||||
) {
|
||||
$classlike_storage->inheritable_method_ids[$method_name_lc] = $method_id;
|
||||
}
|
||||
|
||||
|
@ -82,6 +82,28 @@ class CloneTest extends TestCase
|
||||
clone $a;',
|
||||
'error_message' => 'InvalidClone',
|
||||
],
|
||||
'notVisibleCloneMethodSubClass' => [
|
||||
'code' => '<?php
|
||||
class a {
|
||||
private function __clone() {}
|
||||
}
|
||||
class b extends a {}
|
||||
|
||||
clone new b;',
|
||||
'error_message' => 'InvalidClone',
|
||||
],
|
||||
'notVisibleCloneMethodTrait' => [
|
||||
'code' => '<?php
|
||||
trait a {
|
||||
private function __clone() {}
|
||||
}
|
||||
class b {
|
||||
use a;
|
||||
}
|
||||
|
||||
clone new b;',
|
||||
'error_message' => 'InvalidClone',
|
||||
],
|
||||
'invalidGenericClone' => [
|
||||
'code' => '<?php
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user