PHP is a great language and it is getting better and better with time. The only disadvantage that I see now is that the average salaries for a php developer are lower compared to any other language :(
@@phpannotated Great. The thing about them is that they really bring out PHP features like enums, readonly, etc. and its power and shortcoming while showing how to properly use them to solve various situations. Thanks.
Great video, thank you. Constructive criticism if you are interested: some words were difficult to understand. Here are the words that I could not understand: 0:10 Disjunctive normal form types, that ____. 2:29 Self, static, ____. (Actually, after playing it a few times and watching your code, I was able to figure out that the words were "or this".)
in case someone is wondering, 1) that is a mouthful 2) this like myself, you are probably not a native english speaker, it's something we can adjust to with practice ^^
hi Brent. thanks for great content, as usual ^_^ i have two remarks: - the countdown before video was insanely loud 🙉 - i noticed, that you like ligatures for things like -> or ===, but many people may not even know this IDE feature exists or they use an editor that does not do that, so i think code snippets should be presented in plain old ascii. ligatures may be confusing. no matter how cool it looks, it is not valid PHP code : ]
@@phpannotated Personally I love the look of ligatures but I do agree that for mass-consumption, they could confuse some people. It's probably safer to leave them off in a tutorial or RU-vid video, especially when targeting less experienced users.
Dear Brent, I had something like this: $conn = new PDO ( DSN, #[\SensitiveParameter]USER, PW, OPTIONS); The arguments were defined in my Config.php file as constants. The connection failed! Please, what did I do wrong? Prepending the value with the attribute in the configuration file didn't work either! Only works when function or method parameters are hard-coded?
I am honestly quite sad that arrow functions with more than one statement/expression did not pass the RFC vote. PHP 8.2 feels like minor upgrade, unfortunately. But it is better than nothing, so thanks to devs for the hard work
Is an example more reductive can you show this DNF (Disjunctive Normal Form ) with Interfaces A,B,C combining a class so (A&B) | C and obligatory types? Thank you ;)
Could you please make a video about type hinting for modern PHP? Sometime I see some sources say like array. I can see it inspires by typescript but I can't see any source explain clearly for that. This is only for PHP > 8 I guess?
@@phpannotated Thank you. Your series helps me answer a lot questions. Turn out it is Generics and came from doc block for static analyser. I searched Psalm and I can see that syntax. But I think it would be nicer with a solution more native like other language do. Maybe php 8.3 or 9 hopefully.
Hello. How do you select two not necessarily sequential instances like you’re doing at 3:27 ? In PhpStorm I can’t hit Alt-J to keep selecting sequentially, but I don’t know how to do it with a mouse.
In PhpStorm on Windows, place the first cursor, then press and hold the key and use the mouse to place additional cursors with a left-click. Release the key and you can write simultaneously in different places. Instead of just placing cursors, you can also mark different parts of your code while pressing , etc.
In 3:14, what is the "#[Something]" exactly? I never saw it before, is it something specific to your IDE? Or do you have a link to get more information about it? Thank you
0:58 im into PHP all day for work and i love it. But why? Why "#[...]" ?? This is SO ugly. And # is comment. And [] is optional, which MAY fit, somehow. But why not just SensitiveString? I mean ... you could have a PHP default SensitiveString class. And if you really need to have your own string class you extend it. Nothing new. _Soon we type code like_ _&!public funciton {${$method}} (#[SensitiveParameter] null|string $param) {} :#[SensitiveParameter#[OptionalParameter#[SomemoreParameterAttributes]]]string => {(%?MyString)}_ _or fancy shit like {}(){$1 => x {#+}}_ _(No this does not make sense. And yes this is how it will look for beginners. And yes we SHOULD have script languages that are ez readable because we do not have to spare bytes anymore.)_
There was a lot of discussion about what syntax to use when attributes were introduced. One advantage of # being a comment (in older versions of PHP) is that you could write code that worked in both PHP 7.4 and PHP 8. Php 7.4 simply saw the attributes as comments, so it made the upgrade process to 8 simpler.
@@phpannotated Basically when i'd like to factorize a behaviour but cannot or do not want to force using class to extend a base class. I did it for emulating enums, for database tables that have recurring columns for example (in which case a constant for the column name is convenient). Basically it can replace the decoarator pattern or serve for some kind of mixins.
Great video! Those code examples fly a bit too fast so I had to pause. No big deal but you could keep them for 2-3 seconds longer after finishing writing.
I still think non-readonly classes should have been allowed to extend readonly classes - make a readonly class exactly the same as a class in which every property is marked readonly. Those properties would be guaranteed readonly also in a child class, but there shouldn't be anything to stop a child class adding rewriteable properties in addition.
I program for 15 years in PHP and I have never used even one feature presented here. They seem very... specific. Maybe PHP is gearing for a shift in logic?