Top "Magic-methods" questions

Magic methods are implicitly invoked by a programming language when some event or language construct is used.

Why PHP uses static methods in object context?

I have the following code (like, for real, this is my real code) : <?php class Foobar { public static function …

php static-methods magic-methods
Built-in magic variable names/attributes

Background: For those not familiar with it, Sublime Text (and TextMate) provides syntax highlighting and other features through scopes which …

python syntax sublimetext built-in magic-methods
__callStatic(): instantiating objects from static context?

I am confused about how "static" and "dynamic" functions and objects in PHP work together especially with regards to __callStatic(). …

php static instantiation magic-methods
Triggering __call() in PHP even when method exists

The PHP documentation says the following about the __call() magic method: __call() is triggered when invoking inaccessible methods in an …

php magic-methods
Check if a property exists on magically set properties

There is a lot of SO questions about the subject, notably this one, but it does not help me. There …

php properties isset magic-methods
Magic Methods php, __call __get and __set?

my question is, say we have a class: class SomeClass{ private $someProperty; public function __call($name,$arguments){ echo "Hello World"; } …

php get set call magic-methods
Is it possible, using PHPUnit mock objects, to expect a call to a magic __call() method?

I've got a mock object in a test. The real object, PageRepository, implements a magic method using __call(), so if …

php symfony phpunit magic-methods
Python dictionary "plus-equal" behavior

I'm trying to understand the exact mechanism behind updating a python dictionary using d[key] += diff. I have some helper …

python dictionary operators magic-methods mutators
How to implement __isset() magic method in PHP?

I'm trying to make functions like empty() and isset() work with data returned by methods. What I have so far: …

php class isset magic-methods