« first day (4300 days earlier)      last day (655 days later) » 

12:07 AM
@LeviMorrison I wouldn't backport warnings-only fixes. But yes, backport, then merge with -X theirs (IIRC).
 
 
2 hours later…
2:30 AM
@bwoebi Why shouldn't we try to make the latest stable release warning free except when it might affect ABI or something?
 
 
6 hours later…
9:00 AM
@LeviMorrison IIRC, you can cherry-pick the master commit in 8.1, so merge forward will work
 
 
2 hours later…
10:47 AM
Could I have some second/third/fourth... opinions on bugs.php.net/bug.php?id=80047&thanks=1 please?
 
11:18 AM
In PhpStorm how can i remove this section ?
 
@Mwthreex (I think) View -> Appearance -> Toolbar (or right-click the toolbar and customize toolbar if you want to just remove some things). See also Settings dialog -> Appearance & Behavior -> Menus & Toolbars
 
Yeah that was navigation bar, But it also remove the left side
Is there anything that only remove the right section ?
Ok i found that under Setting > Menus & Toolbars as AllenJB said thanks
 
Oh, that's weird - was wondering why yours was right aligned. There's a separate "navigation toolbar" that only appears if the main toolbar is disabled and doesn't appear to have its own toggle. o_O
Why do people have to keep doing weird things with UIs?
 
11:43 AM
Consider the following snippet.
```$stmt = $this->pdo->prepare("SELECT `foo`, `bar` FROM `table` WHERE `id` = :id");
$stmt->execute(array("id" => $id));
$result = $stmt->fetch();
if (empty($result)) {
return null;
}

return new FooBar(
$result["id"],
filter_var($result["foo"], FILTER_VALIDATE_BOOL),
$result["bar"]
);```
I have some doubts...
Do I have to check if the array keys "foo", "bar", "id" exist in result? If not how do I make the snippet pass static analysis tests?
Is using `empty` bad there?
rip code formatting
 
cmb
11:59 AM
@yessure Code formatting requires indentation here (CTRL+k), and only works for a full post.
filter_var() for casting to bool looks like overkill; use (bool) if needed.
I don't think result["id"] is ever set.
Don't use empty() (here); instead check for === false.
 
Sorry for my code formatting. Yeah right, "id" is not set, my bad for the example.
Would you check for the other array keys existence here, although we know that they do exist?
Thank you for the tips!
 
cmb
I would not check for the other keys; if static analysis requires it, I would assert() their existence.
 
1:02 PM
got it, thanks!
 
1:49 PM
o/
 
2:07 PM
o/
 
\o
 
3:01 PM
@Derick as always..... constructors were probably a mistake. But for this:
i) What one of them was saying about Solid is nonsensical.
ii) I'm not totally sure what you mean by calling userland constructors being unreliable. But I'm guessing it's related to the signature of the constructor being able to change. One possibility is defining the constructor in a (probably new) interface. https://3v4l.org/RFChD so that it's guaranteed to have the right signature.
 
3:46 PM
no, calling the userland constructor... I don't want to mess or guess what;s the right way
 
cmb
@Derick And rightly so, since constructors are exempt from LSP checks. However, SPL does it "all the time".
 
SPL --- is that a great example? :-)
 
cmb
It is a great example – on what not to do. ;)
 
4:54 PM
@Derick The code in the SPL that calls constructors is insane for other reasons than "being able to call userland constructors with two parameters".
 
so let's not replicate that :-D
 
except the datetime constructor does take 2 arguments....so I'd assume that would be okay. And to clarify, I don't mean adding a DateTimeConstructorInterface to the parameter type, instead checking it manually where you're about to construct the appropriate type:
bool correct_type = false;

if ((usertype instanceof DateTime) || (usertype instanceof DateTimeImmutable)){
    correct_type = true;
}
else if (usertype instanceof DateTimeConstructorInterface) {
    correct_type = true;
}

if (correct_type != true) {
    throw something();
}
// do the needfull
(for the record, the SPL was insane because it hard-coded the 2nd parameter, and didn't pass args 3 + 4 - github.com/php/php-src/pull/1196/files)
And I feared being tainted by looking at the SPL any longer.
 
cmb
5:28 PM
@Danack You cannot assert anything about the constructor signature of subclasses; see e.g. 3v4l.org/TY7Lq.
 
If the constructor is in the interface, it appears to be guaranteed.
 
cmb
@Danack Oh, right. Unfortunately, DateTimeInterface doesn't declare __construct(), and adding that would be a BC break. :(
 
Yeah. I know. I meant add:
interface DateTimeConstructorInterface {
    public function __construct(string $time = 'now', ?DateTimeZone $timezone = null);
}
As a new interface, and anyone passing a child class into DatePeriod would need to implement that interface on their child class.
And then manually check the type inside there (as above) rather than it being a parameter type check.
 
I'm not adding another interface
 
Other than the various aesthetic reasons, what would the problem be?
 
5:39 PM
It's already complicated, I don't want to get it more complicated.
 
cmb
5:55 PM
plus, there's a BC break either way
 
@cmb meh. adding an interface to guarantee stuff works, rather than just working by coincidence is a small BC break. A polyfill could be done in userland to allow code to work across 8.0 to whatever version of PHP was to implement it with:
if (interface_exists(DateTimeConstructorInterface::class) === false) {
  interface DateTimeConstructorInterface {
    public function __construct(string $time = 'now', ?DateTimeZone $timezone = null);
  }
}
@Derick fair enough. anyway it's probably not my place to pressure you, and I don't have the energy. I depart the conversation, leaving only an image:
user image
2
 
Those are some nice tea pots.
 
 
1 hour later…
7:21 PM
"Code to Interface" this is the term i hear a lot, But don't when to use Or when it's too much or over overengineerd
 
 
2 hours later…
9:15 PM
Has anyone migrate from Slim 3 to 4? And/or does anyone know how to set the equivalent of the:
$container['foundHandler'] =
$container['errorHandler'] =
$container['phpErrorHandler']
handlers that used to be passed into the container?
 
 
2 hours later…
10:56 PM
fyi foundHandler looks gone.....which is annoying. Magic stuff that used to be done there probably needs to be done elsewhere....
 

« first day (4300 days earlier)      last day (655 days later) »