Closed (fixed)
Project:
Simplenews
Version:
4.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
25 Jan 2022 at 16:01 UTC
Updated:
17 Nov 2023 at 16:07 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
jonathanshawComment #3
adamps commentedI like passing 'create' because it's much more informative to the reader than just TRUE.
What we can do is to add types to the function arguments. This would then force conversion to bool.
Comment #4
berdir> What we can do is to add types to the function arguments. This would then force conversion to bool.
That's now how types work. Types don't convert automatically, that will give you a fatal error.
Comment #5
jonathanshawSo let's used string or mixed in the interface, rather than violating our own interface. Someone swapping out the Subscriber class could get bitten if they believed what the interface said.
Comment #6
adamps commentedI realise it's a little strange that I pass strings like this for bool - I'm content to give it up. Here's a patch that adds types to SubscriberInterface - let's see what happens.
Comment #8
adamps commentedComment #9
adamps commentedIt seems there are some specific exceptions where types do convert automatically. See https://www.php.net/manual/en/language.types.type-juggling.php#language.....
Comment #10
adamps commentedComment #11
adamps commentedComment #14
berdirFollow-up: #3402475: Subscriber::loadByMail(): Argument #1 ($mail) must be of type string, null given