1 | <?php |
||
20 | class AddressFactory |
||
21 | { |
||
22 | public $php_address_class; |
||
23 | |||
24 | public $default_data = array( |
||
25 | 'type' => null, |
||
26 | 'street1' => null, |
||
27 | 'street2' => null, |
||
28 | 'zip' => null, |
||
29 | 'location' => null, |
||
30 | 'country' => null, |
||
31 | ); |
||
32 | |||
33 | /** |
||
34 | * @param string|null $address_class |
||
35 | */ |
||
36 | 10 | public function __construct(string $address_class = null) |
|
40 | |||
41 | |||
42 | /** |
||
43 | * @param array $address_data |
||
44 | * @return AddressInterface |
||
45 | */ |
||
46 | 6 | public function __invoke(array $address_data = array()) : AddressInterface |
|
51 | |||
52 | |||
53 | /** |
||
54 | * @param AddressProviderInterface $address_provider |
||
55 | * @param array|null $address_data |
||
56 | * @return AddressProviderInterface |
||
57 | */ |
||
58 | 12 | public function apply(AddressProviderInterface $address_provider, array $address_data = null): AddressProviderInterface |
|
85 | } |
||
86 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: