POPP Diary #3 - Actually Writing
This weeks it all begins to get a bit real. I saw my delivery schedule, and realised that everything is looking much tighter than I blithely assumed when I agreed to what seemed like an amazingly distant completion date. I also became aware that my first deadline – this coming Wednesday – was hurtling towards me with much of the chapter still to finish. I don’t regret the time I invested in tools and the move to Markdown, but I’m feeling the pinch.
In other news, I’m beginning to write up new features introduced since the last edition.
It occurred to me that fascinating as this diary no doubt is, people interested in new features in PHP might appreciate some cleaner posts on these topics. To that end I’m going to break out some discussions into their own pieces. I start this week with a post on constructor property promotion which is a new mechanism in PHP 8 that allows you to declare and assign to class properties in a single constructor definition. Read more here
Right. Back to work. See you next week.
Tuesday 09 June 2020
Started working with rather than on production scripts today. Checking and renumbering listings, running tests, researching new features that might be relevant. Mostly, today that has meant basic formatting and checking of code.
Wednesday 10 June 2020
After some tool code fixes, today was all about feature research. That meant much trawling of the PHP RFC and release pages to remind myself of things that have changed since the last edition – and still more features that are slated for PHP 8. I came away with a fair haul – I’ll document them here as I go. I’m particularly pleased to see that we can constrain properties by type now, for example.
Thursday 11 June 2020
Kicked off the session today with a PHP build failure. A tense moment but fixed once again with sudo make clean
before rebuilding. And then into the editorial weeds. After that, I ground on through Chapter 3. Because the basics don’t change very much, there isn’t a lot to report about that. I am checking all copy, re-testing every code example, and generally tweaking as necessary.
Also had a check in with (tech reviewer) Paul T. regarding the review process. Now that chapters will be worked on in text format, it looks likely that we’ll be able to PR them and use Bitbucket or Github tools for commenting. These details need to be confirmed though.
Added a note to warn coders against using PHP 4 style constructors (with the same name as that of the class) are no longer supported in PHP 8.
Friday 12 June 2020
Despite many edits and improvements, up until today I have not had the opportunity to get to grips with any really new features. And then came constructor property promotion. This is a feature I absolutely love. In short, it allows you to combine property declaration and assignment into a single constructor signature. OK, that still sounds complicated. It really isn’t. I think the best place for this is its own post.
Saturday 13 June 2020
Down in the weeds today, slogging along sentence by sentence, code example by code example. I have a deadline of 17 June for this chapter, and the time I took out for set up is beginning to show. Head down and onward.
Sunday 14 June 2020
And onward. I found and fixed a few errors in code – proving that tests won’t catch everything. The most interesting new section today was a piece I wrote on the mixed
type declaration. As of PHP 8 you can declare that an argument accepts a mixed
value – in other words a value that is either an array
, a bool
, is callable
, an int
, a float
, null
, an object
, a resource
, or a string
. Since that’s the same as leaving the mixed
declaration out altogether, what’s the point of having it? In fact it’s incredibly useful, because is acts as semaphore to both client code and subclassers that an argument explicitly accepts any type. A guarantee an unadorned argument just doesn’t offer.