> On 10 Nov 2023, at 20:00, Rowan Tommins wrote:
> [...] Wherever it is used, "null" is a confusing and often controversial
> concept. In different contexts, it is used for different things, and has
> different ideal behaviours. It's a whole debate on its own, and bringing in
> other types of c
On 10/11/2023 11:29, Craig Francis wrote:
strict_types=1 enables strict type checking
While it's not exactly false, this statement is misleading in a really
important way. That's not your fault, it's just that "strict_types" is,
in hindsight, a really terrible name.
If I had a time machine
On Fri, Nov 10, 2023 at 1:33 PM Craig Francis wrote:
>
> On 10 Nov 2023, at 12:16, Andreas Leathley wrote:
> > Also note that in your example $q could be an array (leading to a fatal
> > error in the code)from the request data, which is why checking types
> > thoroughly (not just coercing them
On 10 Nov 2023, at 12:16, Andreas Leathley wrote:
> Also note that in your example $q could be an array (leading to a fatal error
> in the code)from the request data, which is why checking types thoroughly
> (not just coercing them with strval) can be helpful in avoiding unexpected
> situations
On 10 Nov 2023, at 11:47, Alex Wells wrote:
> It fails to correctly change the type of the variable to nullable due to the
> coalescing operator. This is a bug in PHPStan,
Cool, and Kamil notes that bleeding edge has fixed this, that's good... but how
many developers do you think are using leve
On 10 Nov 2023, at 11:11, Kamil Tekiela wrote:
>> That's what I thought, but for some reason, casting null is deprecated only
>> when it's provided as an argument to functions, all other cases it's fine...
>> weird right?
>
>
> No, passing null to non-nullable parameters is already an error. I
On 10.11.23 12:33, Craig Francis wrote:
On 10 Nov 2023, at 10:54, Alex Wells wrote:
PHPStan does find
them:https://phpstan.org/r/38fc1545-2567-49b9-9937-f275dcfff6f5
It does not:
https://phpstan.org/r/c533ff42-80e4-4309-9751-1ec79e359946
Psalm does give you a PossiblyInvalidArgument here,
On 10.11.2023 12:11, Kamil Tekiela wrote:
function abc(string|int $p) {}
abc(null);
What should null be converted into and why? If you as a developer know then
you can cast the argument to an appropriate type but on the language level,
it's not really possible.
So, in conclusion, we are not sup
You must enable bleeding edge.
On Fri, Nov 10, 2023 at 1:33 PM Craig Francis
wrote:
> On 10 Nov 2023, at 10:54, Alex Wells wrote:
>
> PHPStan does find them:
> https://phpstan.org/r/38fc1545-2567-49b9-9937-f275dcfff6f5
>
>
>
> It does not:
>
> https://phpstan.org/r/c533ff42-80e4-4309-9751-1ec79e359946
>
>
It fails to correctl
On 10 Nov 2023, at 10:54, Alex Wells wrote:
> PHPStan does find them:
> https://phpstan.org/r/38fc1545-2567-49b9-9937-f275dcfff6f5
It does not:
https://phpstan.org/r/c533ff42-80e4-4309-9751-1ec79e359946
First, thanks Rowan (same to you Kamil), I do appreciate your thoughts on
this...
On 9 Nov 2023, at 20:01, Rowan Tommins wrote:
> On 09/11/2023 14:58, Craig Francis wrote:
>> We might as well make the PHP 9 upgrade as hard as possible, just to force a
>> little bit of `strict_types=1` on ever
Hi Craig,
Don't get me wrong, but I have a feeling you still didn't understand fully
my first message.
That's what I thought, but for some reason, casting null is deprecated only
> when it's provided as an argument to functions, all other cases it's
> fine... weird right?
>
No, passing null to n
On Fri, Nov 10, 2023 at 12:47 PM Craig Francis
wrote:
> This will start getting Fatal Type Errors in 9.0... and finding these
> "mistakes" is close to impossible (phpstan doesn't find them; psalm
> requires high levels 1-3)
>
PHPStan does find them:
https://phpstan.org/r/38fc1545-2567-49b9-9937-
On 9 Nov 2023, at 16:08, Kamil Tekiela wrote:
> Automatic casting of null to other types is a handy feature and deprecating
> it brings no benefit to anyone.
That's what I thought, but for some reason, casting null is deprecated only
when it's provided as an argument to functions, all other ca
On 29 Oct 2023, at 11:14, Kamil Tekiela wrote:
> A code like this already throws a fatal error.
>
> function enc(string $a){}
> enc(null);
>
> The only thing remaining to be fixed in PHP 9 is to make this error
> consistent on all function invocations.
Or, be consistent with all of the other
A code like this already throws a fatal error.
function enc(string $a){}
enc(null);
The only thing remaining to be fixed in PHP 9 is to make this error
consistent on all function invocations.
> I didn't realise the payment gateway doesn't always provide the order
reference
Well, there you go. T
Hi Internals,
I'm getting really annoyed at the "Passing null to parameter" problem, and
it happens with new code as well.
I know you have distain for websites that don't use strict types, or static
analysis at the strictest level, but yesterday I was working on a 15 year
old website, it still wo
18 matches
Mail list logo