File tree 2 files changed +31
-5
lines changed
spec/Packagist/Api/Result/Package
src/Packagist/Api/Result/Package
2 files changed +31
-5
lines changed Original file line number Diff line number Diff line change @@ -43,4 +43,28 @@ public function it_gets_shasum()
43
43
{
44
44
$ this ->getShasum ()->shouldReturn ('cb0a489db41707d5df078f1f35e028e04ffd9e8e ' );
45
45
}
46
+
47
+ public function it_can_deal_with_nullable_reference ()
48
+ {
49
+ $ this ->fromArray ([
50
+ 'type ' => 'git ' ,
51
+ 'url ' => 'https://github.com/Sylius/Sylius.git ' ,
52
+ 'reference ' => null ,
53
+ 'shasum ' => 'cb0a489db41707d5df078f1f35e028e04ffd9e8e ' ,
54
+ ]);
55
+
56
+ $ this ->getReference ()->shouldReturn (null );
57
+ }
58
+
59
+ public function it_can_deal_with_nullable_shasum ()
60
+ {
61
+ $ this ->fromArray ([
62
+ 'type ' => 'git ' ,
63
+ 'url ' => 'https://github.com/Sylius/Sylius.git ' ,
64
+ 'reference ' => 'cb0a489db41707d5df078f1f35e028e04ffd9e8e ' ,
65
+ 'shasum ' => null ,
66
+ ]);
67
+
68
+ $ this ->getShasum ()->shouldReturn (null );
69
+ }
46
70
}
Original file line number Diff line number Diff line change 4
4
5
5
namespace Packagist \Api \Result \Package ;
6
6
7
- class Dist extends Source
7
+ use Packagist \Api \Result \AbstractResult ;
8
+
9
+ class Dist extends AbstractResult
8
10
{
9
- protected string $ shasum ;
11
+ protected ? string $ shasum ;
10
12
11
13
protected string $ type ;
12
14
13
15
protected string $ url ;
14
16
15
- protected string $ reference ;
17
+ protected ? string $ reference ;
16
18
17
- public function getShasum (): string
19
+ public function getShasum (): ? string
18
20
{
19
21
return $ this ->shasum ;
20
22
}
@@ -29,7 +31,7 @@ public function getUrl(): string
29
31
return $ this ->url ;
30
32
}
31
33
32
- public function getReference (): string
34
+ public function getReference (): ? string
33
35
{
34
36
return $ this ->reference ;
35
37
}
You can’t perform that action at this time.
0 commit comments