1--TEST-- 2Magic Methods inheritance rules 3--FILE-- 4<?php 5class ValidMagicMethods { 6 public function __call(string $name, array $arguments): mixed {} 7 8 public static function __callStatic(string $name, array $arguments): mixed {} 9 10 public function __clone(): void {} 11 12 public function __debugInfo(): ?array {} 13 14 public function __get(string $name): mixed {} 15 16 public function __invoke(mixed $arguments): mixed {} 17 18 public function __isset(string $name): bool {} 19 20 public function __serialize(): array {} 21 22 public function __set(string $name, mixed $value): void {} 23 24 public static function __set_state(array $properties): object {} 25 26 public function __sleep(): array {} 27 28 public function __toString(): string {} 29 30 public function __unserialize(array $data): void {} 31 32 public function __unset(string $name): void {} 33 34 public function __wakeup(): void {} 35} 36 37class NarrowedReturnType extends ValidMagicMethods { 38 public function __call(string $name, array $arguments): string|float|null {} 39 40 public static function __callStatic(string $name, array $arguments): ?array {} 41 42 public function __debugInfo(): array {} 43 44 public function __get(string $name): int|string {} 45 46 public function __invoke(mixed $arguments): object {} 47} 48 49class WidenedArgumentType extends NarrowedReturnType { 50 public function __call(string|array $name, array|string $arguments): string|float|null {} 51 52 public static function __callStatic(string|object $name, array|object $arguments): ?array {} 53 54 public function __get(string|array $name): int|string {} 55 56 public function __isset(string|bool $name): bool {} 57 58 public function __set(string|bool|float $name, mixed $value): void {} 59 60 public static function __set_state(string|array $properties): object {} 61 62 public function __unserialize(array|string $data): void {} 63 64 public function __unset(string|array $name): void {} 65} 66 67echo 'No problems!'; 68?> 69--EXPECT-- 70No problems! 71