1--TEST-- 2strict_types=1 of the attribute use-site is respected 3--FILE-- 4<?php 5 6#[Attribute] 7class MyAttribute { 8 public function __construct(public int $value) {} 9} 10 11#[MyAttribute("42")] 12class TestWeak {} 13 14require __DIR__ . '/030_strict_types.inc'; 15 16var_dump((new ReflectionClass(TestWeak::class))->getAttributes()[0]->newInstance()); 17var_dump((new ReflectionClass(TestStrict::class))->getAttributes()[0]->newInstance()); 18 19?> 20--EXPECTF-- 21object(MyAttribute)#1 (1) { 22 ["value"]=> 23 int(42) 24} 25 26Fatal error: Uncaught TypeError: MyAttribute::__construct(): Argument #1 ($value) must be of type int, string given, called in %s030_strict_types.inc on line 4 and defined in %s030_strict_types.php:5 27Stack trace: 28#0 %s030_strict_types.inc(4): MyAttribute->__construct('42') 29#1 %s(%d): ReflectionAttribute->newInstance() 30#2 {main} 31 thrown in %s on line %d 32