Promoted Properties¶

Promoted properties are a class’s arguments, which are declared as properties and automatically assigned their value at instantiation.

<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>

Documentation

See also Class constructor property promotion

Added in PHP 8.0

Logo

The definitive reference with all things PHP, and their definitions.

Navigation

Contents:

  • Introduction
  • Index
    • $_COOKIE
    • $_ENV
    • $_FILES
    • $_GET
    • $_POST
    • $_REQUEST
    • $_SERVER
    • $argc
    • $argv
    • $GLOBALS
    • $HTTP_RAW_POST_DATA
    • $php_errormsg
    • $this
    • __call() Method
    • __callStatic() Method
    • __clone() Method
    • __get() Method
    • __invoke() Method
    • __isset() Method
    • __serialize() Method
    • __set() Method
    • __set_state() Method
    • __sleep() Method
    • __toString() Method
    • __unserialize() Method
    • __wakeup() Method
    • Absolute Value
    • Absolute
    • Abstract Class
    • Abstract Keyword
    • Abstraction Layer
    • Accessibility
    • Active Record
    • Adapters
    • Addition
    • Alias Types
    • Alias
    • Allow Dynamic Properties
    • Alternative Syntax
    • And Operator
    • Annotations
    • Anonymous Catch
    • Anonymous Class
    • Anonymous Constant
    • Anonymous Function
    • Anonymous
    • Application Programming Interface (API)
    • Application Performance Management (APM)
    • Array Append
    • Arbitrary Number Of Argument
    • Arcane
    • Archive
    • Argon2
    • Argument
    • ArgumentCountError
    • ArithmeticError Error
    • Arm
    • Array With Curly Braces
    • Array Spread
    • Array Syntax
    • Array
    • array_key_exists()
    • array_merge()
    • ArrayAccess
    • ArrayObject
    • Arrow Functions
    • Artifact
    • As
    • American Standard Code for Information Interchange (ASCII)
    • Assertions
    • Asset
    • Assignations
    • Associative Array
    • Assumption
    • Abstract Syntactic Tree (AST)
    • Asymmetric Property
    • Asymetric Visibility
    • Asynchronous
    • Attribute Class
    • Attribute
    • Authenticate
    • Authorize
    • Class Autoloading
    • Automagic
    • Automatic Index
    • Autovivification
    • Autowiring
    • Backed Enum
    • Backend
    • Backward Incompatible
    • BadFunctioncallException
    • Balanced
    • Base 64 Encoding
    • basename
    • Batch
    • Bcmath
    • Benchmarking
    • Best Practices
    • Binary Integer
    • Binary Operator
    • Binary
    • Bitshift Operators
    • Bitwise Operators
    • Blind Variable
    • Block
    • Body
    • Boolean
    • Branch
    • Break
    • browscap
    • Bucket
    • Passing By Reference
    • Passing By Value
    • Byte
    • C2 Framework
    • Cache
    • Call
    • Callables
    • Callbacks
    • Case Sensitivity
    • Case
    • Cast Operator
    • Catch
    • Centralization
    • Common Interface Gateway (CGI)
    • Chaining New Without Parenthesis
    • Chaining
    • Character
    • Child Class
    • Continuous Integration
    • Circular Reference
    • Class Interface Trait Enumeration (CITE)
    • Class Aliases
    • Class Constants Visibility
    • Static Constant
    • Class Entities
    • Class Hoisting
    • Class Invasion
    • Class Operator
    • Class
    • class_alias()
    • Clean Architecture
    • Clean Code
    • Command Line Interface (CLI)
    • Clone
    • Close Tag
    • ClosedGeneratorException
    • Closure Binding
    • Closure
    • Coalesce Operator
    • Code Coverage
    • Coding Formatting
    • Code Freeze
    • Code Injection
    • Code Reuse
    • Code Smell
    • Codepoint
    • Coding Conventions
    • Collection
    • Collision
    • Colon
    • Comma
    • Command Bus
    • Comments
    • Compact Array
    • compact()
    • Comparison
    • Compatibility
    • Compile Time
    • Component
    • Composer
    • Composition
    • Compression
    • Concatenation
    • Concrete Class
    • Condition
    • Conditional Structures
    • Conditioned Structures
    • Configuration
    • Const
    • Constant Expression
    • Constants In Trait
    • Constant Scalar Expression
    • Constants
    • constructor
    • Container
    • Continue
    • Design By Contract
    • Control Flow
    • Control Structures
    • Controller
    • Convention
    • Cookie
    • Copy On Write
    • Core
    • Coroutine
    • count()
    • Countable Interface
    • Coupling
    • Coverage
    • crc32
    • Create, Read, Update And Delete (CRUD)
    • Cryptography
    • CSV Injection
    • Comma Secparated Values (CSV)
    • Ctype
    • Client URL (CURL)
    • Curly Brackets
    • Custom
    • Concurent Version System (CVS)
    • Cyclomatic Complexity
    • Dangling Reference
    • Data Container
    • Data Mapper
    • Data
    • Database
    • Dataset
    • Dates
    • Datetime Trap
    • DateTime
    • Day Are Not 86400 Seconds
    • Days In Month
    • Database Abstraction Layer (DBA) extension
    • Database Abstraction Layer (DBAL)
    • Domain Design Driven (DDD)
    • Dead Code
    • Debugger
    • Declaration
    • declare Encoding
    • declare()
    • Decorator Pattern
    • Deep Clone
    • Default Parameter
    • Default Value
    • Default
    • define()
    • defined()
    • Definition
    • Dependency Injection Container
    • Dependency Injection
    • Deployment
    • Deprecated
    • Deprecation
    • Depth
    • Dereferencing
    • Design Pattern
    • Destructor
    • Dictionary
    • Directives
    • DirectoryIterator
    • dirname
    • Disable Classes
    • Disable Functions
    • Division
    • DivisionByZeroError
    • Disjunctive Normal Form (DNF)
    • Do While
    • DomainException
    • DOM
    • Double Quotes Strings
    • Do…while
    • Downtime
    • Don’t Repeat Yourself (DRY)
    • Data Source Name (DSN)
    • Data Transfer Object (DTO)
    • Duck Typing
    • Dynamic Call
    • Dynamic Class
    • Dynamic Constant
    • Dynamic Loading
    • Dynamic Properties
    • Dynamic Variable
    • Dynamic
    • each
    • Early Binding
    • Echo Tag
    • Echo
    • Elephpant
    • Ellipsis
    • Email
    • Empty
    • Text Encoding
    • Encoding
    • PHP Engine
    • Entities
    • Backed Enumeration
    • Enumeration Case
    • Enumeration (enum)
    • Environment Variables
    • Error Handler
    • Error Handling
    • Error Reporting
    • Error
    • Escape Character
    • Escape Data
    • HTML Escaping
    • Escape Sequences
    • Eval()
    • Event Driven
    • Event Loop
    • Event Storming
    • Chaining Exceptions
    • Exception Handler
    • Exception
    • Execution Time
    • Exit
    • Explicit
    • Exponent
    • Exponential
    • Expression
    • extends
    • Extensions
    • extract()
    • Facade
    • Fallback Function
    • Fallback To Global
    • Switch Fallthrough
    • False
    • Falsy
    • FastCGI
    • feature-flag
    • Feature
    • Foreign Function Interface (FFI)
    • File Extension
    • File Mode
    • File
    • File System
    • FileSystemIterator
    • filter
    • Final Class Constants
    • Final Keyword
    • Finally
    • First Class Callable
    • Fixture
    • Flag
    • Floating Point Numbers
    • Fluent Interface
    • For
    • Foreach
    • Form
    • Format
    • Forward Compatible
    • Fossilized Methods
    • PHP-FPM (FPM)
    • Framework
    • Front-end
    • File Transfert Protocol (FTP)
    • File Transfer Protocol Secure (FTPS)
    • Fully Qualified Name
    • Function Subscripting
    • Functions
    • Garbage Collection
    • Generator
    • Generics
    • Class Getter Method
    • gettext Extension
    • git
    • glob()
    • Global Code
    • Global Space
    • Global Variables
    • global Scope
    • $GLOBALS
    • God Object
    • Goto
    • GraphQL
    • __halt_compiler()
    • Handle
    • PHP Handlers
    • Hard Coded
    • Hardening
    • Hash Comparisons
    • Cryptographic Hash
    • hash() Function
    • Hash
    • Haystack
    • Headless
    • Heredocs
    • Hexadecimal Integer
    • Hexagonal Architecture
    • hg
    • Hosting
    • .htaccess
    • HTML Entities
    • HTML Entity
    • HTTP Code
    • HTTP Encoding
    • HTTP Headers
    • Hyper Text Transfer Protocol (HTTP)
    • Hyper Text Transfer Protocol Secure (HTTPS)
    • Hydratation
    • Iconv
    • Idempotent
    • Identical Operator
    • Identifier
    • If Then Else
    • Iffectation
    • ImagickException
    • ImagickPixelException
    • Immutable
    • implements
    • Implicit
    • Import
    • include
    • Inclusions
    • Incoming Data
    • Increment
    • Indentation
    • Index For Arrays
    • Index For SQL
    • Index
    • Indexed Array
    • Inequality
    • Infinite
    • Inflector
    • Inheritance
    • Inherited Variable
    • INI
    • Initialisation
    • Injection
    • instance
    • instanceof
    • Insteadof
    • integer
    • Interface
    • Internationalization
    • Interpolation
    • Intersection Type
    • Internationalization Functions
    • InvalidArgumentException
    • Type Invariant
    • Code Inventory
    • Invoke
    • IP
    • is_a()
    • is_object()
    • Interface Segregation Principle (ISP)
    • Isset
    • Iterable
    • Iterator
    • Just In Time (JIT)
    • Jobqueue
    • JavaScript Object Notation (JSON)
    • JsonException
    • Key-value Stores
    • Keyword
    • Goto Labels
    • Linux Apache Mysql PHP (LAMP)
    • Language Construct
    • Laravel
    • Late Static Binding
    • Lazy Loading
    • Lazy Objects
    • Leading Numeric String
    • Leading Zero Means Octal
    • LengthException
    • Letter Logical Bug
    • Lexical Variable
    • Library Loading
    • libsodium
    • Lint, Won’t Execute
    • Linting
    • List
    • Literal Types
    • Literal
    • Local File Inclusion
    • Local Variable
    • Local Scope
    • Locale
    • Log
    • Logical Operators
    • LogicException
    • Loops
    • Liskov Substitution Principle (LSP)
    • Machine Learning
    • Magic Bytes
    • Magic Constants
    • Magic Hash
    • Magic Methods
    • Magic Numbers
    • Magic Property
    • Magic
    • Maintenance
    • Man In The Middle
    • Map
    • Markdown
    • Match
    • max_execution_time
    • Multibyte String
    • mcrypt Extension
    • Message Digest Algorithm 5 (MD5)
    • Memoization
    • Merge
    • Message Queue
    • Method
    • Methodcall
    • Micro-optimisation
    • Microservice
    • Microtime()
    • Migration
    • Mixed
    • Mock
    • Model
    • Module
    • Modulo
    • Multidimensional Array
    • Multiplication
    • Mutation Testing
    • Model - View - Controller (MVC)
    • mysqli
    • mysqli_sql_exception
    • N+1 Query Problem
    • Name
    • Named Constructors
    • Named Parameters
    • Namespace Alias
    • Namespace Name
    • Namespaces
    • Naming
    • Not A Number (NAN)
    • Native
    • Needle
    • negative-index
    • Nested Attributes
    • Nesting
    • Neutral Element
    • Never Type
    • New In Initializers
    • New Without Parenthesis
    • new
    • Non Breakable Spaces
    • Non-static
    • @, No Scream Operator
    • Not Operator
    • Nowdocs
    • Null
    • Nullable
    • Null Pattern
    • Null Safe Object Operator
    • Nullsafe
    • Numeric Base
    • Numeric Separator
    • Numeric String
    • Obfuscation
    • Object API
    • Object Injection
    • Object Invasion
    • Object Nullsafe Operator ?->
    • Object Operator ->
    • Object Syntax
    • Object Type
    • Object
    • Observer Design Pattern
    • Open Closed Principle (OCP)
    • Octal Integer
    • Offset
    • One Liner
    • Opcache
    • Opcode
    • Open Tag
    • OpenSSL
    • Operand
    • Operator Precedence
    • Operators
    • Optional Parameter
    • Object Relational Mapping (ORM)
    • Outgoing Data
    • OutOfRangeException
    • Over-engineer
    • Overflow
    • Override Attribute
    • Overwrite
    • OWASP
    • pack
    • Packagist
    • Pagination
    • Parallel
    • Parameter Removal
    • Parameter
    • parent
    • Parenthesis
    • Parse
    • ParseError
    • Partial Function
    • Password API
    • Password
    • Path
    • Pattern Matching
    • Process Control (pcntl)
    • Perl Compatible Regular Expressions (PCRE)
    • PHP Data Objects (PDO)
    • PDOException
    • PEAR
    • PHP Extension C Library (PECL)
    • Performance
    • Permission
    • Persistence
    • PostgreSQL
    • Phar
    • PharException
    • PHP Docker Container
    • PHP Extensions
    • FIG
    • PHP Foundation
    • PHP Group
    • PHP Native Interfaces
    • PHP Native Attribute
    • PHP RFC
    • PHP Tags
    • PHP User Groups
    • PHP Variables
    • PHP Wrappers
    • PHP
    • php.ini
    • PHP_INT_MAX
    • PHPdoc
    • phpinfo()
    • PHPunit
    • PHP Installer For Extensions (PIE)
    • Pipeline
    • Plugin
    • Plus +
    • Polyfill
    • Polymorphism
    • Port
    • Portability
    • Positional Parameters
    • Precedence
    • Predefined Constants
    • PHP Predefined Exception
    • Prepared Query
    • Preprocessing
    • Primitive Obsession
    • Print
    • print_r()
    • Private Visibility
    • Production
    • PHP Profiler
    • Promise
    • Promoted Properties
    • Property Hook
    • Properties
    • Protected Visibility
    • Protocol
    • Pseudo-variable
    • PHP Standards Recommendations (PSR)
    • Public Visibility
    • Query String
    • Query
    • Queue
    • Random
    • RangeException
    • Role Based Access Control (RBAC)
    • RDBMS
    • Readability
    • Reading
    • Readonly
    • Real Numbers
    • Recursion
    • Recursive Array
    • Refactoring
    • Reference Count
    • References
    • Reflection
    • ReflectionException
    • Regular Expressions
    • Register Globals
    • Registry
    • Relative Types
    • Relative
    • Relaxed Comparison
    • Relaxed Keywords
    • Relaxed Syntax
    • Relay Function
    • Release
    • Rendering
    • Reserved Names
    • resource
    • REST API
    • Return Type
    • Return Value
    • Return
    • Return Type Will Change
    • Revision
    • RFC
    • Request For Change (RFC)
    • Reserved For Future Use (RFU)
    • Rounding
    • Route
    • Remote Procedure Call (RPC)
    • Rubber Ducking Debugging
    • Runtime Checks
    • Sanitation
    • Server Application Programming Interface (SAPI)
    • Scaffolding
    • Scalar Types
    • Scaling
    • Schema
    • Scheme
    • Scope Resolution Operator ::
    • Scope
    • Software Development Kit (SDK)
    • Second Order SQL Injection
    • Security
    • Segmentation Fault
    • Self-reference
    • Self
    • Semantics
    • Semicolon
    • Sensitive Parameter
    • Serialization
    • Session Fixation
    • Session Hijacking
    • Session
    • Class Setter Method
    • Shallow Clone
    • Shard
    • Shared Memory
    • Shell
    • Short Assignations
    • Short Syntax
    • Short Tags
    • Short Ternary Operator
    • Shutdown Function
    • Sign
    • Method Signature
    • Silent Behavior
    • Simple Switch
    • SimpleXML
    • Single Quotes Strings
    • Singleton
    • sleep
    • Simple Network Management Protocol (SNMP)
    • Simple Object Access Protocol (SOAP)
    • Socket
    • SOLID
    • Sort
    • Single Page Application (SPA)
    • Spaceship Operator
    • Special Constant
    • Special Types
    • Standard PHP Library (SPL)
    • sprintf
    • SQL Injection
    • Simple Query Language (SQL)
    • Sqlite3
    • Square Brackets
    • Single Responsability Principle (SRP)
    • SSL
    • Single Sign On (SSO)
    • Standalone Types
    • State
    • Stateful
    • Stateless
    • Statement
    • Static Expression
    • Static Method
    • Static Property
    • Static Variables
    • static
    • stdclass
    • STDOUT
    • Storage Systems
    • Stream
    • Strict Comparison
    • strict_types
    • String Increment
    • String Interpolation
    • String
    • Stringable
    • Strpos() Syndrome
    • Structure
    • Stubs Files
    • Sub (prefix)
    • Subclass
    • Subnamespaces
    • subtype
    • Sunsetting
    • Superglobal Variables
    • supertype
    • Supply Chain Attack
    • Support Vector Machine (SVM)
    • SVMException
    • SVN
    • SWAP
    • Switch Case
    • Switch Default
    • Switch
    • Synchronous
    • Syntax Error
    • System Call
    • System Event
    • System
    • Taint Analysis
    • Task Runner
    • TCP
    • Template
    • Temporary Expression
    • Ternary Operator
    • Test Data Provider
    • Test Pyramid
    • Test
    • testdox
    • Thread
    • Three Dots
    • throw
    • Throwable
    • Tick
    • ransport Layer Security (TLS)
    • toctou : Time Of Check To Time Of Use
    • Token
    • Trailing Comma
    • Trait
    • Transpile
    • Traversable
    • Traversal
    • Tree
    • trigger_error()
    • True
    • Truthy
    • Try-catch
    • Contravariance
    • Covariance
    • Type Coverage
    • Property Type Declaration
    • Type Juggling
    • Type System
    • Typed Property
    • TypeError
    • Type Error
    • Typo
    • Unary Operator
    • Unbacked Enum
    • Undefined
    • Underflow
    • UnexpectedValueException
    • UnhandledMatchError
    • Unicode
    • Union Type
    • Unpacking
    • Unreachable Code
    • Unserialization
    • unset()
    • Unused
    • User Operations For Zend (UOPZ)
    • Upgrade
    • File Upload
    • Universal Resource Identifier (URI)
    • Universal Resource Locator (URL)
    • Use Alias
    • Use In Traits
    • Use
    • Useless
    • Userland
    • UTF-8
    • UUencode Encoding
    • Universally Unique IDentifier (UUID)
    • Validation
    • Value Object
    • ValueError
    • Var
    • var_dump()
    • Variable Arguments
    • Variable Scope
    • Variable Variables
    • Variables
    • variable_order
    • Variadic
    • VCS
    • Vector Database
    • Version
    • View In Presentation
    • SQL Views
    • View
    • Virtual Machine
    • Virtual Property
    • Visibility
    • Value Object (VO)
    • Void
    • Weak References
    • World Wide Weab (WWW)
    • Webscraping
    • Webserver
    • Websocket
    • While
    • Whitespace
    • Class Wither Method
    • Design Pattern Wrapper
    • file://
    • ftp://
    • http://
    • php://
    • Stream Wrapper
    • Wrapper
    • Writable
    • Writing
    • Extensible Markup Language (XML)
    • XMLReader
    • XMLwriter
    • XXTEA
    • YAML Ain’t Markup Language (YAML)
    • yield from Keyword
    • Yield
    • Yoda Condition
    • Zombie Code
    • Zval
  • Thesaurus
  • PHP Dictionary

Related Topics

  • Documentation overview
    • Index
      • Previous: Promise
      • Next: Property Hook
©2022-2025, Damien Seguy - Exakat. | Powered by Sphinx 8.2.3 & Alabaster 1.0.0 | Page source