TypeError
class TypeError extends Error (View source)
There are three scenarios where a TypeError may be thrown.
The first is where the argument type being passed to a function does not match its corresponding declared parameter type. The second is where a value being returned from a function does not match the declared function return type. The third is where an invalid number of arguments are passed to a built-in PHP function (strict mode only).
Properties
protected | $message | The error message |
from Error |
protected | $code | The error code |
from Error |
protected | $file | The filename where the error happened |
from Error |
protected | $line | The line where the error happened |
from Error |
Methods
Construct the error object.
Details
in
Error at line 431
__construct(string $message = "", int $code = 0, null|Throwable $previous = null)
Construct the error object.
in
Error at line 444
final string
getMessage()
Gets the message
in
Error at line 457
final int
getCode()
Gets the exception code
in
Error at line 465
final string
getFile()
Gets the file in which the exception occurred
in
Error at line 473
final int
getLine()
Gets the line on which the object was instantiated
in
Error at line 484
final array
getTrace()
Gets the stack trace
in
Error at line 492
final string
getTraceAsString()
Gets the stack trace as a string
in
Error at line 500
final null|Throwable
getPrevious()
Returns the previous Throwable
in
Error at line 508
string
__toString()
Gets a string representation of the thrown object
in
Error at line 528
void
__wakeup()
No description