Add PHP 7 type annotation to Product/Price classes
Last one! This PR adds type annotations for the Product and Price services.
Please review: @ahoffmann @weizhong-wang @lloyd-carter @KJOYNER
Merge request reports
Activity
Build finished. Tests PASSED. Build results available at: https://ia-builds.doit.wisc.edu:8443/job/cbs-techstore-client-php-master-pull-requests/105/
119 116 * @param string $name 120 117 * @return Product 121 118 */ 122 public function setName($name) 119 public function setName(string $name): Product 123 120 { 124 121 $this->name = $name; 125 122 return $this; 126 123 } 127 124 128 125 /** 129 * @return Money 126 * @return Money|null 130 127 */ 131 128 public function getCost() Careful reviewers will notice that there is no return type annotation here. That's intentional, as cost can be null, but PHP7 doesn't have nullable type annotations yet. This is allegedly slated for 7.1: https://wiki.php.net/rfc/nullable_types
This has been an interesting exercise. We've been passing the wrong datatypes to some of these things for a while, but everything has been working as expected! If nothing else, I'll appreciate the piece of mind knowing that we're giving CBS what it expects now that our IDEs will complain a bit more.
mentioned in commit e2d28789