Everything you need (and don't need) to know about PHP's type system
1–10 of 67 posts
Re: Everything you need (and don't need) to know about PHP's type system
#2Re: Everything you need (and don't need) to know about PHP's type system
#3Re: Everything you need (and don't need) to know about PHP's type system
#4I've been knee deep in PHP for the last 6 months after keeping it at arm's length for probably 10 years. It's really quite incredible how much it's improved and I think the type system is the major factor for me. It's not perfect but damn - I can get some stuff done really quick now.
Re: Everything you need (and don't need) to know about PHP's type system
#5This is quite complete, definitely bookmarking for reference. I've been knee deep in PHP for the last 6 months after keeping it at arm's length for probably 10 years. It's really quite incredible how much it's improved and I think the type system is the major factor for me. It's not perfect but damn - I can get some stuff done really quick now.
Re: Everything you need (and don't need) to know about PHP's type system
#6This is quite complete, definitely bookmarking for reference. I've been knee deep in PHP for the last 6 months after keeping it at arm's length for probably 10 years. It's really quite incredible how much it's improved and I think the type system is the major factor for me. It's not perfect but damn - I can get some stuff done really quick now.
I'll add though; the real benefit only comes with heavy use of objects, like in Yii/Craft. If you've got keyed arrays everywhere it's still a hellhole.
Re: Everything you need (and don't need) to know about PHP's type system
#7This is one of my most common sources of bugs, and it is frustrating not having this be available, when it makes my life so much easier in Perl.
Lately I've been thinking about doing something crazy like implementing my own variable system...
Re: Everything you need (and don't need) to know about PHP's type system
#8While we are on the subject, does anyone know of a way of having required variable declarations in PHP, similar to the way Perl's "use strict" works? This is one of my most common sources of bugs, and it is frustrating not having this be available, when it makes my life so much easier in Perl. Lately I've been thinking about doing something crazy like implementing my own variable system...
Re: Everything you need (and don't need) to know about PHP's type system
#9* A "list" type representing a non-associative array
* Types representing specific kinds of values, like numeric-string or non-empty-array, as well as exact values as types (like true and false, or string constants).
* Typing on keys and values in arrays, e.g. array for an array with class names as keys and integers as values
* Complex typing on the contents of associative arrays, e.g. array{foo:int, bar:string}
* Templated types on functions, like a function which returns an instance of a class whose name is passed in as a string:
/**
* @template T
* @param T::class $class_name
* @return T
*/
[1]: https://psalm.dev/Re: Everything you need (and don't need) to know about PHP's type system
#10I'm often amused by developers that revile PHP, while going on to use another language, which suffers from a similar set of problems to PHP, oftentimes with poorer performance and more complex toolchains.
PHP deserves a little more love, imo.