PhpSpec\Listener\MethodReturnedNullListener::afterExample PHP Method

afterExample() public method

public afterExample ( ExampleEvent $exampleEvent )
$exampleEvent PhpSpec\Event\ExampleEvent
    public function afterExample(ExampleEvent $exampleEvent)
    {
        $exception = $exampleEvent->getException();
        if (!$exception instanceof NotEqualException) {
            return;
        }
        if ($exception->getActual() !== null) {
            return;
        }
        if (is_object($exception->getExpected()) || is_array($exception->getExpected()) || is_resource($exception->getExpected())) {
            return;
        }
        if (!$this->lastMethodCallEvent) {
            return;
        }
        $class = get_class($this->lastMethodCallEvent->getSubject());
        $method = $this->lastMethodCallEvent->getMethod();
        if (!$this->methodAnalyser->methodIsEmpty($class, $method)) {
            return;
        }
        $key = $class . '::' . $method;
        if (!array_key_exists($key, $this->nullMethods)) {
            $this->nullMethods[$key] = array('class' => $this->methodAnalyser->getMethodOwnerName($class, $method), 'method' => $method, 'expected' => array());
        }
        $this->nullMethods[$key]['expected'][] = $exception->getExpected();
    }