« first day (3246 days earlier)      last day (1702 days later) » 

10:10 PM
[7.2.0+] DateTime on certain dates – #78499
 
10:21 PM
@Trowski that explains why some of it looks like a spider or a bug and scared the shit out of me. ... not literally ...
I was about to clean it up with a pair of gloves and paper towels earlier (at least cleaning up the loose bits, before sanitizing it), saw what looked like a weird bug and NOPED out
I still need to take care of it though
 
I have a spider that's living in the roof of my conservatory, and I think it's due for eviction. I let it make quite a large web and the flipping thing is useless at catching flies.
 
lol
yeah, I would consider that eviction-worthy. I'm an arachnophobe, but I recognize that spiders are useful for keeping other pests away... I leave them alone as long as they leave me alone.
 
Is there a C API that converts a zval to a string, but if it can't it doesn't issue an error or exception?
All the ones I can find will throw or warn, and I don't want that.
 
@cmb Fails with exception :/
 
cmb
10:33 PM
Wouldn't that be a bug with regard to the comment?
 
Maybe a bug, but the impl definitely still warns/throws: lxr.room11.org/xref/php-src%40master/Zend/zend_operators.c#882
 
Could someone with phpstorm run a quick test for me please? I'm trying to work out if I have a configuration error, or if it's just not implemented yet.... if I use arrow functions it's treating auto-captured variables as undefined and giving a red squiggle under it, could someone please confirm?

$example = 1;
$func = fn() => $example * 1;
 
11:04 PM
@MarkR Looks like not implemented yet. which tbh is fair as it's still a while till release. Did you check the early access version, if there is one currently?
 
Hmmm good point, i'll check the EAP. I assumed it was working because it detected the fn() =>
Thanks @Danack
 
11:45 PM
with a multi dimension array, say of user data where the first layer is just numeric indexes and sub arrays are assocative eg username => james, age => 150 etc. I currently return an array of objects but I lose IDE auto complete as the variable is an array not a User object. Is it best to return an object of arrays, or just stick with an array of objects? And is an object with an array where the arrays values are objects just insane?
 
where's the array from, is it in your source or from DB etc?
 
it's actually from an API so Json array
 
You're out of luck for autocomplete then unless you custom define something for it.
 
yeah I already have ideas for custom but they're a bit funky and break KISS
 
@James you should check out psalm and the stuff it does to integrate with phpstorm.
 
11:49 PM
From the json it will be returned as a stdClass which has no fixed properties. If you're using something like phpstorm you can create a fake type with the properties in, or just define them using phpdoc and @property, and then type-hint the variable like: /** @var MyFakeUser[] $json */
 
yeah @var would work but I guess I Want best of both worlds, the sub arrays to hold objects so each one represents a single User entity (username, etc) but the outer being an object too, like UserCollection that holds multiple User objects
 
It sounds like you want to take your JSON data and turn it into actual proper object instances.
 
I do with a single user being returned - mapped to an entity and I set an object with properties, username, email etc. but I Can receive an array of users. which of course doesn't work on a single user entity
 
Well why not just create an entity for every user in the array?
 
and store it how (this is my main question) I currently have an array of user objects, but ultimately it's an array
 
11:56 PM
Well you can just put all of your user entities in an array as well
 

« first day (3246 days earlier)      last day (1702 days later) »