← CodeClarityLab Home
Browse by Category
+ added · updated 7d
✕ Clear A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Traits — Horizontal Reuse (PHP 5.4) PHP 5.4+
PHP 5.4 traits enable horizontal code reuse — mixins for PHP classes that can't use multiple inheritance. Use sparingly; prefer composition over trait overuse.
2mo ago php intermediate
Typed Class Constants (PHP 8.3) PHP 8.3+
PHP 8.3 allows class, interface, and enum constants to declare an explicit type, catching type mismatches at definition time rather than at runtime when the constant is used.
2mo ago php intermediate
Typed Properties (PHP 7.4) PHP 7.4+
PHP 7.4 typed properties add type declarations to class properties — public string $name — preventing type mismatches and enabling full static analysis of object state.
2mo ago php intermediate
TypeError — When Type Declarations Throw PHP 7.0+
TypeError is thrown when a value passed to a typed parameter or return type doesn't match — strict_types=1 makes this happen at call sites too.
2mo ago php intermediate
Type Widening & Covariance/Contravariance PHP 7.4+
PHP's rules for overriding method types in subclasses — return types are covariant (can narrow), parameter types are contravariant (can widen), enforced since PHP 7.4.
2mo ago php advanced
Diagram: Traits Traits PHP 5.4+
Reusable code blocks that can be mixed into any class, providing horizontal code reuse without inheritance.
2mo ago php intermediate
Type Casting in PHP PHP 5.0+
Explicitly converting a value to another type using (int), (string), (array), (object) casts or intval(), strval() functions.
2mo ago php beginner
Type Coercion PHP 7.0+
PHP's automatic conversion between types can produce unexpected comparison results, leading to logic bugs and security bypasses.
CWE-704 OWASP A3:2021
2mo ago php intermediate 8.1
Type Declarations Overview PHP 7.0+
PHP's full type system: scalar types, return types, union types, intersection types, nullable, never, and mixed — all enforced at runtime.
2mo ago php intermediate
✓ schema.org compliant