Calling all PHP developers! Want to wrap your brain around functional programming? Are you sick of reading tutorials about this magic “monad” thing but having no idea how to read Haskell? Then this book is for you.
Announcing Thinking Functionally in PHP, by yours truly, available now on LeanPub.
Continue reading this post on PeakD
Editor’s Note: This is the second in a five-part series on refactoring and modernizing PHP applications. If you were to identify the most expensive part of any development project, what would that part be? The planning phase? Acquiring copyright or intellectual property? Marketing and advertising? All of these would be wrong. The most expensive part […]
This episode is sponsored by
Using the WordPress REST API
Editor’s Note: This is the first in a five-part blog series on refactoring and modernizing PHP applications. We’ve all heard the expression from the children’s story: “slow and steady wins the race.” But what does this have to do with refactoring? And how can this help us to modernize our applications? First, a little background: […]
This blog is a guide to learn about a PHP class, properties, methods, inheritance, and constructors.
The RSS feed for this podcast is https://derickrethans.nl/feed-phpinternalsnews.xml, you can download this episode’s MP3 file, and it’s available on Spotify and iTunes. There is a dedicated website: https://phpinternals.news
- Derick Rethans 0:16
Hi, I’m Derick. And this is PHP internals news, a weekly podcast dedicated to demystifying the development of the PHP language. This is Episode 53. Today I’m talking with Nikita Popov about a few RFCs that he’s made in the last few weeks. Let’s start with the constructor property promotion RFC.
- Nikita Popov 0:36
Hello Nikita, would you please introduce yourself? Hi, Derick. I am Nikita and I am doing PHP internals work at JetBrains and the constructor promotion, constructor property promotion RFC is the result of some discussion about how we can improve object ergonomics in PHP.
- Derick Rethans 0:56
Object economics. It’s something that I spoke with Larry Garfield about two episodes ago, where we discuss Larry’s proposal or overview of what can be improved with object ergonomics in PHP. And I think we mentioned that you just landed this RFC that we’re now talking about. What is the part of the object ergonomics proposal that this RFC is trying to solve?
- Nikita Popov 1:20
I mean, the basic problem we have right now is that it’s a bit more inconvenient than it really should be to use simple value objects in PHP. And there is two sides to that problem. One is on the side of writing the class declaration, and the other part is on the side of instantiating the object. This RFC tries to make the class declaration simpler, and shorter, and less redundant.
- Derick Rethans 1:50
At the moment, how would a typical class instantiation constructor look like?
- Nikita Popov 1:55
Right now, if we take simple examples from the RFC, we have a class Point, which has three properties, x, y, and Zed. And each of those has a float type. And that’s really all the class is. Ideally, this is all we would have to write. But of course, to make this object actually usable, we also have to provide a constructor. And the constructor is going to repeat that. Yes, we want to accept three floating point numbers x, y, and Zed as parameters. And then in the body, we have to again repeat that, okay, each of those parameters needs to be assigned to a property. So we have to write this x equals x, this y equals y, this z equals z. I think for the Point class this is still not a particularly large burden. Because we have like only three properties. The names are nice and short. The types are really short. We don’t have to write a lot of code, but if you have larger classes with more properties, with more constructor arguments, with larger and more descriptive names, and also larger and more descriptive type names, then this makes up for quite a bit of boilerplate code.
- Derick Rethans 3:16
Because you’re pretty much having the properties’ names in there three times.
- Nikita Popov 3:20
Four times even. One is the property name and the declaration, one in the parameter, and then you have to the assignment has to repeat it twice.
- Derick Rethans 3:30
You’re repeating the property names four times, and the types twice.
- Nikita Popov 3:34
Truncated by Planet PHP, read more at the original (another 19135 bytes)
The PHP development team announces the immediate availability of PHP 7.4.6. This is a security release which also contains several bug fixes.All PHP 7.4 users are encouraged to upgrade to this version.For source downloads of PHP 7.4.6 please visit our downloads page, Windows source and binaries can be found on windows.php.net/download/. The list of changes is recorded in the ChangeLog.
The PHP development team announces the immediate availability of PHP 7.2.31. This is a security release.All PHP 7.2 users are encouraged to upgrade to this version.For source downloads of PHP 7.2.31 please visit our downloads page, Windows source and binaries can be found on windows.php.net/download/. The list of changes is recorded in the ChangeLog.
Platform.sh now supports displaying activities from your integrations in the API or command line.
This means that from now on, external integrations (GitHub, Gitlab, Slack, etc.) that you enable in your Platform.sh project will trigger activities every time that something happens with that integration.
This makes validating, testing, and troubleshooting an external integration so much easier.
These new activities are already available to users via the API or the CLI, and they will soon be displayed in the Platform.