File tree Expand file tree Collapse file tree 2 files changed +31
-5
lines changed
spec/Packagist/Api/Result/Package
src/Packagist/Api/Result/Package Expand file tree Collapse file tree 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()
4343 {
4444 $ this ->getShasum ()->shouldReturn ('cb0a489db41707d5df078f1f35e028e04ffd9e8e ' );
4545 }
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+ }
4670}
Original file line number Diff line number Diff line change 44
55namespace Packagist \Api \Result \Package ;
66
7- class Dist extends Source
7+ use Packagist \Api \Result \AbstractResult ;
8+
9+ class Dist extends AbstractResult
810{
9- protected string $ shasum ;
11+ protected ? string $ shasum ;
1012
1113 protected string $ type ;
1214
1315 protected string $ url ;
1416
15- protected string $ reference ;
17+ protected ? string $ reference ;
1618
17- public function getShasum (): string
19+ public function getShasum (): ? string
1820 {
1921 return $ this ->shasum ;
2022 }
@@ -29,7 +31,7 @@ public function getUrl(): string
2931 return $ this ->url ;
3032 }
3133
32- public function getReference (): string
34+ public function getReference (): ? string
3335 {
3436 return $ this ->reference ;
3537 }
You can’t perform that action at this time.
0 commit comments