Completed
Pull Request — master (#665)
by Dave
03:24
created

Mock::shouldExpect()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
ccs 0
cts 6
cp 0
rs 9.4285
cc 1
eloc 6
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * Mockery
4
 *
5
 * LICENSE
6
 *
7
 * This source file is subject to the new BSD license that is bundled
8
 * with this package in the file LICENSE.txt.
9
 * It is also available through the world-wide-web at this URL:
10
 * http://github.com/padraic/mockery/blob/master/LICENSE
11
 * If you did not receive a copy of the license and are unable to
12
 * obtain it through the world-wide-web, please send an email
13
 * to [email protected] so we can send you a copy immediately.
14
 *
15
 * @category   Mockery
16
 * @package    Mockery
17
 * @copyright  Copyright (c) 2010 Pádraic Brady (http://blog.astrumfutura.com)
18
 * @license    http://github.com/padraic/mockery/blob/master/LICENSE New BSD License
19
 */
20
21
namespace Mockery;
22
23
use Mockery\MockInterface;
24
25
class Mock implements MockInterface
26
{
27
    /**
28
     * Stores an array of all expectation directors for this mock
29
     *
30
     * @var array
31
     */
32
    protected $_mockery_expectations = array();
33
34
    /**
35
     * Stores an inital number of expectations that can be manipulated
36
     * while using the getter method.
37
     *
38
     * @var int
39
     */
40
    protected $_mockery_expectations_count = 0;
41
42
    /**
43
     * Flag to indicate whether we can ignore method calls missing from our
44
     * expectations
45
     *
46
     * @var bool
47
     */
48
    protected $_mockery_ignoreMissing = false;
49
50
    /**
51
     * Flag to indicate whether we can defer method calls missing from our
52
     * expectations
53
     *
54
     * @var bool
55
     */
56
    protected $_mockery_deferMissing = false;
57
58
    /**
59
     * Flag to indicate whether this mock was verified
60
     *
61
     * @var bool
62
     */
63
    protected $_mockery_verified = false;
64
65
    /**
66
     * Given name of the mock
67
     *
68
     * @var string
69
     */
70
    protected $_mockery_name = null;
71
72
    /**
73
     * Order number of allocation
74
     *
75
     * @var int
76
     */
77
    protected $_mockery_allocatedOrder = 0;
78
79
    /**
80
     * Current ordered number
81
     *
82
     * @var int
83
     */
84
    protected $_mockery_currentOrder = 0;
85
86
    /**
87
     * Ordered groups
88
     *
89
     * @var array
90
     */
91
    protected $_mockery_groups = array();
92
93
    /**
94
     * Mock container containing this mock object
95
     *
96
     * @var \Mockery\Container
97
     */
98
    protected $_mockery_container = null;
99
100
    /**
101
     * Instance of a core object on which methods are called in the event
102
     * it has been set, and an expectation for one of the object's methods
103
     * does not exist. This implements a simple partial mock proxy system.
104
     *
105
     * @var object
106
     */
107
    protected $_mockery_partial = null;
108
109
    /**
110
     * Flag to indicate we should ignore all expectations temporarily. Used
111
     * mainly to prevent expectation matching when in the middle of a mock
112
     * object recording session.
113
     *
114
     * @var bool
115
     */
116
    protected $_mockery_disableExpectationMatching = false;
117
118
    /**
119
     * Stores all stubbed public methods separate from any on-object public
120
     * properties that may exist.
121
     *
122
     * @var array
123
     */
124
    protected $_mockery_mockableProperties = array();
125
126
    /**
127
     * @var array
128
     */
129
    protected $_mockery_mockableMethods = array();
130
131
    /**
132
     * Just a local cache for this mock's target's methods
133
     *
134
     * @var ReflectionMethod[]
135
     */
136
    protected static $_mockery_methods;
137
138
    protected $_mockery_allowMockingProtectedMethods = false;
139
140
    protected $_mockery_receivedMethodCalls;
141
142
    /**
143
     * If shouldIgnoreMissing is called, this value will be returned on all calls to missing methods
144
     * @var mixed
145
     */
146
    protected $_mockery_defaultReturnValue = null;
147
148
    /**
149
     * We want to avoid constructors since class is copied to Generator.php
150
     * for inclusion on extending class definitions.
151
     *
152
     * @param \Mockery\Container $container
153
     * @param object $partialObject
154
     * @return void
155
     */
156
    public function mockery_init(\Mockery\Container $container = null, $partialObject = null)
157
    {
158
        if (is_null($container)) {
159
            $container = new \Mockery\Container;
160
        }
161
        $this->_mockery_container = $container;
162
        if (!is_null($partialObject)) {
163
            $this->_mockery_partial = $partialObject;
164
        }
165
166
        if (!\Mockery::getConfiguration()->mockingNonExistentMethodsAllowed()) {
167
            foreach ($this->mockery_getMethods() as $method) {
168
                if ($method->isPublic() && !$method->isStatic()) {
169
                    $this->_mockery_mockableMethods[] = $method->getName();
170
                }
171
            }
172
        }
173
    }
174
175
    /**
176
     * Set expected method calls
177
     *
178
     * @param string $methodName,... one or many methods that are expected to be called in this mock
179
     * @return \Mockery\Expectation
180
     */
181
    public function shouldReceive($methodName)
182
    {
183
        if (func_num_args() < 1) {
184
            throw new \InvalidArgumentException("At least one method name is required");
185
        }
186
187
        foreach (func_get_args() as $method) {
188
            if ("" == $method) {
189
                throw new \InvalidArgumentException("Received empty method name");
190
            }
191
        }
192
193
        /** @var array $nonPublicMethods */
194
        $nonPublicMethods = $this->getNonPublicMethods();
195
196
        $self = $this;
197
        $allowMockingProtectedMethods = $this->_mockery_allowMockingProtectedMethods;
198
199
        $lastExpectation = \Mockery::parseShouldReturnArgs(
200
            $this, func_get_args(), function ($method) use ($self, $nonPublicMethods, $allowMockingProtectedMethods) {
201
                $rm = $self->mockery_getMethod($method);
202
                if ($rm) {
203
                    if ($rm->isPrivate()) {
204
                        throw new \InvalidArgumentException("$method() cannot be mocked as it is a private method");
205
                    }
206
                    if (!$allowMockingProtectedMethods && $rm->isProtected()) {
207
                        throw new \InvalidArgumentException("$method() cannot be mocked as it is a protected method and mocking protected methods is not enabled for the currently used mock object.");
208
                    }
209
                }
210
211
                $director = $self->mockery_getExpectationsFor($method);
212
                if (!$director) {
213
                    $director = new \Mockery\ExpectationDirector($method, $self);
214
                    $self->mockery_setExpectationsFor($method, $director);
215
                }
216
                $expectation = new \Mockery\Expectation($self, $method);
217
                $director->addExpectation($expectation);
218
                return $expectation;
219
            }
220
        );
221
        return $lastExpectation;
222
    }
223
224
    /**
225
     * Shortcut method for setting an expectation that a method should not be called.
226
     *
227
     * @param string $methodName,... one or many methods that are expected not to be called in this mock
228
     * @return \Mockery\Expectation
229
     */
230
    public function shouldNotReceive($methodName)
231
    {
232
        $expectation = call_user_func_array(array($this, 'shouldReceive'), func_get_args());
233
        $expectation->never();
234
        return $expectation;
235
    }
236
237
    /**
238
     * Allows additional methods to be mocked that do not explicitly exist on mocked class
239
     * @param String $method name of the method to be mocked
240
     * @return Mock
241
     */
242
    public function shouldAllowMockingMethod($method)
243
    {
244
        $this->_mockery_mockableMethods[] = $method;
245
        return $this;
246
    }
247
248
    /**
249
     * Set mock to ignore unexpected methods and return Undefined class
250
     * @param mixed $returnValue the default return value for calls to missing functions on this mock
251
     * @return Mock
252
     */
253
    public function shouldIgnoreMissing($returnValue = null)
254
    {
255
        $this->_mockery_ignoreMissing = true;
256
        $this->_mockery_defaultReturnValue = $returnValue;
257
        return $this;
258
    }
259
260
    public function asUndefined()
261
    {
262
        $this->_mockery_ignoreMissing = true;
263
        $this->_mockery_defaultReturnValue = new \Mockery\Undefined;
264
        return $this;
265
    }
266
267
    /**
268
     * @return Mock
269
     */
270
    public function shouldAllowMockingProtectedMethods()
271
    {
272
        $this->_mockery_allowMockingProtectedMethods = true;
273
        return $this;
274
    }
275
276
277
    /**
278
     * Set mock to defer unexpected methods to it's parent
279
     *
280
     * This is particularly useless for this class, as it doesn't have a parent,
281
     * but included for completeness
282
     *
283
     * @return Mock
284
     */
285
    public function shouldDeferMissing()
286
    {
287
        $this->_mockery_deferMissing = true;
288
        return $this;
289
    }
290
291
    /**
292
     * Create an obviously worded alias to shouldDeferMissing()
293
     *
294
     * @return Mock
295
     */
296
    public function makePartial()
297
    {
298
        return $this->shouldDeferMissing();
299
    }
300
301
    /**
302
     * In the event shouldReceive() accepting one or more methods/returns,
303
     * this method will switch them from normal expectations to default
304
     * expectations
305
     *
306
     * @return self
307
     */
308
    public function byDefault()
309
    {
310
        foreach ($this->_mockery_expectations as $director) {
311
            $exps = $director->getExpectations();
312
            foreach ($exps as $exp) {
313
                $exp->byDefault();
314
            }
315
        }
316
        return $this;
317
    }
318
319
    /**
320
     * Capture calls to this mock
321
     */
322
    public function __call($method, array $args)
323
    {
324
        return $this->_mockery_handleMethodCall($method, $args);
325
    }
326
327
    public static function __callStatic($method, array $args)
328
    {
329
        return self::_mockery_handleStaticMethodCall($method, $args);
330
    }
331
332
    /**
333
     * Forward calls to this magic method to the __call method
334
     */
335
    public function __toString()
336
    {
337
        return $this->__call('__toString', array());
338
    }
339
340
    /**
341
     * Iterate across all expectation directors and validate each
342
     *
343
     * @throws \Mockery\CountValidator\Exception
344
     * @return void
345
     */
346
    public function mockery_verify()
347
    {
348
        if ($this->_mockery_verified) {
349
            return;
350
        }
351
        if (isset($this->_mockery_ignoreVerification)
352
            && $this->_mockery_ignoreVerification == true) {
353
            return;
354
        }
355
        $this->_mockery_verified = true;
356
        foreach ($this->_mockery_expectations as $director) {
357
            $director->verify();
358
        }
359
    }
360
361
    /**
362
     * Tear down tasks for this mock
363
     *
364
     * @return void
365
     */
366
    public function mockery_teardown()
367
    {
368
    }
369
370
    /**
371
     * Fetch the next available allocation order number
372
     *
373
     * @return int
374
     */
375
    public function mockery_allocateOrder()
376
    {
377
        $this->_mockery_allocatedOrder += 1;
378
        return $this->_mockery_allocatedOrder;
379
    }
380
381
    /**
382
     * Set ordering for a group
383
     *
384
     * @param mixed $group
385
     * @param int $order
386
     */
387
    public function mockery_setGroup($group, $order)
388
    {
389
        $this->_mockery_groups[$group] = $order;
390
    }
391
392
    /**
393
     * Fetch array of ordered groups
394
     *
395
     * @return array
396
     */
397
    public function mockery_getGroups()
398
    {
399
        return $this->_mockery_groups;
400
    }
401
402
    /**
403
     * Set current ordered number
404
     *
405
     * @param int $order
406
     */
407
    public function mockery_setCurrentOrder($order)
408
    {
409
        $this->_mockery_currentOrder = $order;
410
        return $this->_mockery_currentOrder;
411
    }
412
413
    /**
414
     * Get current ordered number
415
     *
416
     * @return int
417
     */
418
    public function mockery_getCurrentOrder()
419
    {
420
        return $this->_mockery_currentOrder;
421
    }
422
423
    /**
424
     * Validate the current mock's ordering
425
     *
426
     * @param string $method
427
     * @param int $order
428
     * @throws \Mockery\Exception
429
     * @return void
430
     */
431
    public function mockery_validateOrder($method, $order)
432
    {
433
        if ($order < $this->_mockery_currentOrder) {
434
            $exception = new \Mockery\Exception\InvalidOrderException(
435
                'Method ' . __CLASS__ . '::' . $method . '()'
436
                . ' called out of order: expected order '
437
                . $order . ', was ' . $this->_mockery_currentOrder
438
            );
439
            $exception->setMock($this)
440
                ->setMethodName($method)
441
                ->setExpectedOrder($order)
442
                ->setActualOrder($this->_mockery_currentOrder);
443
            throw $exception;
444
        }
445
        $this->mockery_setCurrentOrder($order);
446
    }
447
448
    /**
449
     * Gets the count of expectations for this mock
450
     *
451
     * @return int
452
     */
453
    public function mockery_getExpectationCount()
454
    {
455
        $count = $this->_mockery_expectations_count;
456
        foreach ($this->_mockery_expectations as $director) {
457
            $count += $director->getExpectationCount();
458
        }
459
        return $count;
460
    }
461
462
    /**
463
     * Return the expectations director for the given method
464
     *
465
     * @var string $method
466
     * @return \Mockery\ExpectationDirector|null
467
     */
468
    public function mockery_setExpectationsFor($method, \Mockery\ExpectationDirector $director)
469
    {
470
        $this->_mockery_expectations[$method] = $director;
471
    }
472
473
    /**
474
     * Return the expectations director for the given method
475
     *
476
     * @var string $method
477
     * @return \Mockery\ExpectationDirector|null
478
     */
479
    public function mockery_getExpectationsFor($method)
480
    {
481
        if (isset($this->_mockery_expectations[$method])) {
482
            return $this->_mockery_expectations[$method];
483
        }
484
    }
485
486
    /**
487
     * Find an expectation matching the given method and arguments
488
     *
489
     * @var string $method
490
     * @var array $args
491
     * @return \Mockery\Expectation|null
492
     */
493
    public function mockery_findExpectation($method, array $args)
494
    {
495
        if (!isset($this->_mockery_expectations[$method])) {
496
            return null;
497
        }
498
        $director = $this->_mockery_expectations[$method];
499
500
        return $director->findExpectation($args);
501
    }
502
503
    /**
504
     * Return the container for this mock
505
     *
506
     * @return \Mockery\Container
507
     */
508
    public function mockery_getContainer()
509
    {
510
        return $this->_mockery_container;
511
    }
512
513
    /**
514
     * Return the name for this mock
515
     *
516
     * @return string
517
     */
518
    public function mockery_getName()
519
    {
520
        return __CLASS__;
521
    }
522
523
    /**
524
     * @return array
525
     */
526
    public function mockery_getMockableProperties()
527
    {
528
        return $this->_mockery_mockableProperties;
529
    }
530
531
    public function __isset($name)
532
    {
533
        if (false === stripos($name, '_mockery_') && method_exists(get_parent_class($this), '__isset')) {
534
            return parent::__isset($name);
535
        }
536
537
        return false;
538
    }
539
540
    public function mockery_getExpectations()
541
    {
542
        return $this->_mockery_expectations;
543
    }
544
545
    /**
546
     * Calls a parent class method and returns the result. Used in a passthru
547
     * expectation where a real return value is required while still taking
548
     * advantage of expectation matching and call count verification.
549
     *
550
     * @param string $name
551
     * @param array $args
552
     * @return mixed
553
     */
554
    public function mockery_callSubjectMethod($name, array $args)
555
    {
556
        return call_user_func_array('parent::' . $name, $args);
557
    }
558
559
    /**
560
     * @return string[]
561
     */
562
    public function mockery_getMockableMethods()
563
    {
564
        return $this->_mockery_mockableMethods;
565
    }
566
567
    /**
568
     * @return bool
569
     */
570
    public function mockery_isAnonymous()
571
    {
572
        $rfc = new \ReflectionClass($this);
573
        $onlyImplementsMock = count($rfc->getInterfaces()) == 1;
574
        return (false === $rfc->getParentClass()) && $onlyImplementsMock;
575
    }
576
577
    public function __wakeup()
578
    {
579
        /**
580
         * This does not add __wakeup method support. It's a blind method and any
581
         * expected __wakeup work will NOT be performed. It merely cuts off
582
         * annoying errors where a __wakeup exists but is not essential when
583
         * mocking
584
         */
585
    }
586
587
    public function __destruct()
588
    {
589
        /**
590
         * Overrides real class destructor in case if class was created without original constructor
591
         */
592
    }
593
594
    public function mockery_getMethod($name)
595
    {
596
        foreach ($this->mockery_getMethods() as $method) {
597
            if ($method->getName() == $name) {
598
                return $method;
599
            }
600
        }
601
602
        return null;
603
    }
604
605
    /**
606
     * @param string $name Method name.
607
     *
608
     * @return mixed Generated return value based on the declared return value of the named method.
609
     */
610
    public function mockery_returnValueForMethod($name)
611
    {
612
        if (version_compare(PHP_VERSION, '7.0.0-dev') < 0) {
613
            return;
614
        }
615
616
        $rm = $this->mockery_getMethod($name);
617
        if (!$rm || !$rm->hasReturnType()) {
618
            return;
619
        }
620
621
        $type = (string) $rm->getReturnType();
622
        switch ($type) {
623
            case '':       return;
624
            case 'string': return '';
625
            case 'int':    return 0;
626
            case 'float':  return 0.0;
627
            case 'bool':   return false;
628
            case 'array':  return [];
629
630
            case 'callable':
631
            case 'Closure':
632
                return function () {};
633
634
            case 'Traversable':
635
            case 'Generator':
636
                // Remove eval() when minimum version >=5.5
637
                $generator = eval('return function () { yield; };');
638
                return $generator();
639
640
            case 'self':
641
                return \Mockery::mock($rm->getDeclaringClass()->getName());
642
643
            case 'void':
644
                return null;
645
646
            default:
647
                return \Mockery::mock($type);
648
        }
649
    }
650
651
    public function shouldHaveReceived($method, $args = null)
652
    {
653
        $expectation = new \Mockery\VerificationExpectation($this, $method);
654
        if (null !== $args) {
655
            $expectation->withArgs($args);
0 ignored issues
show
Documentation introduced by
$args is of type null, but the function expects a array|object<Closure>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
656
        }
657
        $expectation->atLeast()->once();
658
        $director = new \Mockery\VerificationDirector($this->_mockery_getReceivedMethodCalls(), $expectation);
659
        $this->_mockery_expectations_count++;
660
        $director->verify();
661
        return $director;
662
    }
663
664
    public function shouldNotHaveReceived($method, $args = null)
665
    {
666
        $expectation = new \Mockery\VerificationExpectation($this, $method);
667
        if (null !== $args) {
668
            $expectation->withArgs($args);
0 ignored issues
show
Documentation introduced by
$args is of type null, but the function expects a array|object<Closure>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
669
        }
670
        $expectation->never();
671
        $director = new \Mockery\VerificationDirector($this->_mockery_getReceivedMethodCalls(), $expectation);
672
        $this->_mockery_expectations_count++;
673
        $director->verify();
674
        return null;
675
    }
676
677
    protected static function _mockery_handleStaticMethodCall($method, array $args)
678
    {
679
        try {
680
            $associatedRealObject = \Mockery::fetchMock(__CLASS__);
681
            return $associatedRealObject->__call($method, $args);
682
        } catch (\BadMethodCallException $e) {
683
            throw new \BadMethodCallException(
684
                'Static method ' . $associatedRealObject->mockery_getName() . '::' . $method
685
                . '() does not exist on this mock object'
686
            );
687
        }
688
    }
689
690
    protected function _mockery_getReceivedMethodCalls()
691
    {
692
        return $this->_mockery_receivedMethodCalls ?: $this->_mockery_receivedMethodCalls = new \Mockery\ReceivedMethodCalls();
693
    }
694
695
    protected function _mockery_handleMethodCall($method, array $args)
696
    {
697
        $this->_mockery_getReceivedMethodCalls()->push(new \Mockery\MethodCall($method, $args));
698
699
        $rm = $this->mockery_getMethod($method);
700
        if ($rm && $rm->isProtected() && !$this->_mockery_allowMockingProtectedMethods) {
701
            if ($rm->isAbstract()) {
702
                return;
703
            }
704
705
            try {
706
                $prototype = $rm->getPrototype();
707
                if ($prototype->isAbstract()) {
708
                    return;
709
                }
710
            } catch (\ReflectionException $re) {
711
                // noop - there is no hasPrototype method
712
            }
713
714
            return call_user_func_array("parent::$method", $args);
715
        }
716
717
        if (isset($this->_mockery_expectations[$method])
718
        && !$this->_mockery_disableExpectationMatching) {
719
            $handler = $this->_mockery_expectations[$method];
720
721
            try {
722
                return $handler->call($args);
723
            } catch (\Mockery\Exception\NoMatchingExpectationException $e) {
724
                if (!$this->_mockery_ignoreMissing && !$this->_mockery_deferMissing) {
725
                    throw $e;
726
                }
727
            }
728
        }
729
730
        if (!is_null($this->_mockery_partial) && method_exists($this->_mockery_partial, $method)) {
731
            return call_user_func_array(array($this->_mockery_partial, $method), $args);
732
        } elseif ($this->_mockery_deferMissing && is_callable("parent::$method")
733
            && (!$this->hasMethodOverloadingInParentClass() || method_exists(get_parent_class($this), $method))) {
734
            return call_user_func_array("parent::$method", $args);
735
        } elseif ($method == '__toString') {
736
            // __toString is special because we force its addition to the class API regardless of the
737
            // original implementation.  Thus, we should always return a string rather than honor
738
            // _mockery_ignoreMissing and break the API with an error.
739
            return sprintf("%s#%s", __CLASS__, spl_object_hash($this));
740
        } elseif ($this->_mockery_ignoreMissing) {
741
            if (\Mockery::getConfiguration()->mockingNonExistentMethodsAllowed() || (method_exists($this->_mockery_partial, $method) || is_callable("parent::$method"))) {
742
                if ($this->_mockery_defaultReturnValue instanceof \Mockery\Undefined) {
743
                    return call_user_func_array(array($this->_mockery_defaultReturnValue, $method), $args);
744
                } elseif (null === $this->_mockery_defaultReturnValue) {
745
                    return $this->mockery_returnValueForMethod($method);
746
                } else {
747
                    return $this->_mockery_defaultReturnValue;
748
                }
749
            }
750
        }
751
752
        $message = 'Method ' . __CLASS__ . '::' . $method .
753
            '() does not exist on this mock object';
754
755
        if (!is_null($rm)) {
756
            $message = 'Received ' . __CLASS__ .
757
                '::' . $method . '(), but no expectations were specified';
758
        }
759
760
        throw new \BadMethodCallException(
761
            $message
762
        );
763
    }
764
765
    /**
766
     * Uses reflection to get the list of all
767
     * methods within the current mock object
768
     *
769
     * @return array
770
     */
771
    protected function mockery_getMethods()
772
    {
773
        if (static::$_mockery_methods) {
774
            return static::$_mockery_methods;
775
        }
776
777
        if (isset($this->_mockery_partial)) {
778
            $reflected = new \ReflectionObject($this->_mockery_partial);
779
        } else {
780
            $reflected = new \ReflectionClass($this);
781
        }
782
783
        return static::$_mockery_methods = $reflected->getMethods();
0 ignored issues
show
Documentation Bug introduced by
It seems like $reflected->getMethods() of type array<integer,object<ReflectionMethod>> is incompatible with the declared type array<integer,object<Mockery\ReflectionMethod>> of property $_mockery_methods.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
784
    }
785
786
    private function hasMethodOverloadingInParentClass()
787
    {
788
        // if there's __call any name would be callable
789
        return is_callable('parent::' . uniqid(__FUNCTION__));
790
    }
791
792
    /**
793
     * @return array
794
     */
795
    private function getNonPublicMethods()
796
    {
797
        return array_map(
798
            function ($method) {
799
                return $method->getName();
800
            },
801
            array_filter($this->mockery_getMethods(), function ($method) {
802
                return !$method->isPublic();
803
            })
804
        );
805
    }
806
}
807