phpspec/prophecy — pull request #20 by karolsojko (2013-05-17 11:00:02+00:00)
Title: Added prophesying static methods

I really hate static methods ... I do :)

But sometimes we have to work with 3rd party and this was the case in here.

Example
------------

I had a third party class which looked more or less like this:

```php
class SomeClass
{
public static function getSomething()
{
return 'something';
}
}
```

The Problem
------------------

So as a hater of static methods I wanted to keep my code clean and do something like
```php
$anything = new SomeClass();
$something = $anything->getSomething();
```
Or even better get an instance of `SomeClass` as a `Symfony2` service.

But when I was doing specs of `SomeClass` in `PhpSpec` I did get a fatal error about using `$this in non-object context` when implementing.

As it turned out the prophesized method looked something like this:
```php
//...
public static function getSomething()
{
return $this->getProphecy()->makeProphecyMethodCall(__FUNCTION__, func_get_args());
}
```
So in the PR is my proposition on how to handle this particular scenario by adding static calls to object prophecy in generated class.