File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Tests \Fixtures ;
4
4
5
+ use Attribute ;
6
+
5
7
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_FUNCTION )]
6
8
class ModelAttribute
7
9
{
Original file line number Diff line number Diff line change 4
4
use Some \ClassName as ClassAlias ;
5
5
use Tests \Fixtures \Model ;
6
6
use Tests \Fixtures \RegularClass ;
7
+ use Tests \SerializerPhp81Controller ;
8
+
7
9
use function Tests \Fixtures \{makeModel };
8
10
9
11
enum GlobalEnum {
@@ -623,7 +625,7 @@ function () {
623
625
624
626
$ e = <<<EOF
625
627
#[Tests\Fixtures\ModelAttribute()]
626
- #[MyAttribute('My " \' Argument 1', 'Tests\Fixtures\Model')]
628
+ #[Tests\ MyAttribute('My " \' Argument 1', 'Tests\Fixtures\Model')]
627
629
function ()
628
630
{
629
631
return \$this->privateGetter();
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
+ namespace Tests ;
4
+
5
+ use Attribute ;
6
+ use Error ;
3
7
use Illuminate \Support \Carbon ;
8
+ use PropertyPromotion ;
9
+ use ReflectionFunction ;
10
+ use RuntimeException ;
4
11
use Tests \Fixtures \Model ;
5
12
use Tests \Fixtures \ModelAttribute ;
6
13
use Tests \Fixtures \RegularClass ;
@@ -164,7 +171,7 @@ enum SerializerScopedBackedEnum: string {
164
171
165
172
expect ($ f )->toThrow (function (Error $ e ) {
166
173
expect ($ e ->getMessage ())->toBe (
167
- 'Cannot modify readonly property SerializerPhp81Controller::$service ' ,
174
+ 'Cannot modify readonly property Tests\ SerializerPhp81Controller::$service ' ,
168
175
);
169
176
});
170
177
})->with ('serializers ' );
@@ -552,6 +559,9 @@ enum SerializerScopedBackedEnum: string {
552
559
'model ' => Model::class,
553
560
]);
554
561
562
+ var_dump ($ attribute ->value );
563
+ var_dump ($ attribute ->value ->newInstance ()->string );
564
+
555
565
expect ($ attribute ->value ->newInstance ())
556
566
->string ->toBe ('My " \' Argument 1 ' )
557
567
->model ->toBe (Model::class);
You can’t perform that action at this time.
0 commit comments