Results for project PHP master, build date 2017-07-11 19:23:01-07:00
commit: d1ee666
previous commit:8a287c0
revision date: 2017-07-11 23:13:22+02:00
environment:Haswell-EP
cpu:Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores,
stepping 2, LLC 45 MB
2017-07-12 17:26 GMT+02:00 Michał Brzuchalski
:
> 12.07.2017 15:35 "Mark Shust" napisał(a):
> >
> > Hi Aidan,
> >
> > I think you are correct on all points. The initial emit is just a
> warning,
> > so I think a suppressor will work just fine, since it does just pass over
> > the foreach if a tr
For those in the cheap seats who may not be paying attention, 7.2 is moving
into beta next week and along with that comes its very own GIT branch and
updates to the bugfix workflow (usual merge from maintenance branches down to
master).
As beta1, like all other releases will be cut on the Tuesd
Stas,
Wow, for some reason it didn't occur to me to try that. Confirming the
following works:
foreach ($foo ?? [] as $bar) {
echo $bar;
}
I think the biggest need for this is if the value is null. Guess it's
case-closed :)
Might be a good idea to add this to the docs, pretty neat.
Mark
Hi!
> Code will error if a non-array value is passed through a looping feature.
> For example, this code:
>
>
> $foo = "abc";
>
> foreach ($foo as $bar) {
Looks like $foo??[] would work here. If $foo is something like false or
null, that is. If it's not, this is probably a serious bug (why wo
> That said, another possibility I thought of is automatically converting
whatever is passed into a foreach loop to
> be cast into an iterable/array for the duration of the loop. I'm
wondering what opinions would be on the cons of
> going this route. Given php's weak typing and someone's desire to
I agree, error suppression is generally ugly/nasty behavior that is a hack
to the language. I also agree that if it's there now, @as is a pretty good
use for it.
That said, another possibility I thought of is automatically converting
whatever is passed into a foreach loop to be cast into an iterab
> IMHO the whole error supression and its operator should be deprecated and
removed from language.
> Supressing errors is just hiding problems because someone didn't want to
solve it. Supressing errors
> makes debuging very hard and leads to frustration.
I can concur with disliking the error suppr
> PHP already exhibits the skipping behaviour (it only emits a warning
> for the wrong type used in `foreach`, skips the loop, and then
> continues with remaining code).
Yes, a warning is not an error. If someone dont care about warnings from
error prone code, set the error_reporting accordingly
12.07.2017 15:35 "Mark Shust" napisał(a):
>
> Hi Aidan,
>
> I think you are correct on all points. The initial emit is just a warning,
> so I think a suppressor will work just fine, since it does just pass over
> the foreach if a traversable isn't passed in.
>
> I could see this being helpful as i
Hi Aidan,
I think you are correct on all points. The initial emit is just a warning,
so I think a suppressor will work just fine, since it does just pass over
the foreach if a traversable isn't passed in.
I could see this being helpful as it makes wrapping an if block around a
foreach not needed
>
> so that I can use functional composition instead of operators
> (`array_map('...', $values))`).
I think I do not understand.
Still, the addition is very nice and complimentary with the existing
> splat/variadic argument stuff :D
So can I create RFC? :)
2017-07-12 14:12 GMT+02:00 Marco Pive
On Wed, Jul 12, 2017 at 2:09 PM, Bartłomiej Krukowski <
krukowski.bartlom...@gmail.com> wrote:
> Hello,
>
> Yes, this is exactly what I would like to achieve.
>
> Best regards
>
> 2017-07-12 14:06 GMT+02:00 Marco Pivetta :
>
>> On Wed, Jul 12, 2017 at 11:22 AM, Bartłomiej Krukowski <
>> krukowski.
Hello,
Yes, this is exactly what I would like to achieve.
Best regards
2017-07-12 14:06 GMT+02:00 Marco Pivetta :
> On Wed, Jul 12, 2017 at 11:22 AM, Bartłomiej Krukowski <
> krukowski.bartlom...@gmail.com> wrote:
>
>> Hello,
>> From PHP 5.6 we have possibility to add variadic functions and unp
On Wed, Jul 12, 2017 at 11:22 AM, Bartłomiej Krukowski <
krukowski.bartlom...@gmail.com> wrote:
> Hello,
> From PHP 5.6 we have possibility to add variadic functions and unpacking
> arrays via *...*
> Would be nice to extend responsibility of *...*. Sometimes in code I can
> find lines similar to
Hello,
>From PHP 5.6 we have possibility to add variadic functions and unpacking
arrays via *...*
Would be nice to extend responsibility of *...*. Sometimes in code I can
find lines similar to the following:
$result = array_merge(['some value'], ['some other value'], $array);
I would like to sho
In theory you'd only *need* it be considered a suppressor? PHP already
exhibits the skipping behaviour (it only emits a warning for the wrong type
used in `foreach`, skips the loop, and then continues with remaining code).
No harm in/there is probably value in, making that skipping intent explicit
17 matches
Mail list logo