diff --git a/fixtures/WithArguments.php b/fixtures/WithArguments.php index eb03aab72..fa787e5da 100644 --- a/fixtures/WithArguments.php +++ b/fixtures/WithArguments.php @@ -4,7 +4,7 @@ class WithArguments { - public function methodWithArgs(\ArrayAccess $arg_1, array $arg_2 = [], \ArrayAccess $arg_3 = null) + public function methodWithArgs(\ArrayAccess $arg_1, array $arg_2 = [], ?\ArrayAccess $arg_3 = null) { } diff --git a/fixtures/WithCallableArgument.php b/fixtures/WithCallableArgument.php index 7d6d5f8f4..278aca20e 100644 --- a/fixtures/WithCallableArgument.php +++ b/fixtures/WithCallableArgument.php @@ -4,7 +4,7 @@ class WithCallableArgument { - public function methodWithArgs(callable $arg_1, callable $arg_2 = null) + public function methodWithArgs(callable $arg_1, ?callable $arg_2 = null) { } } diff --git a/src/Prophecy/Argument/Token/ExactValueToken.php b/src/Prophecy/Argument/Token/ExactValueToken.php index e041cc3ca..a3d09ae78 100644 --- a/src/Prophecy/Argument/Token/ExactValueToken.php +++ b/src/Prophecy/Argument/Token/ExactValueToken.php @@ -36,7 +36,7 @@ class ExactValueToken implements TokenInterface * * @param mixed $value */ - public function __construct($value, StringUtil $util = null, ComparatorFactory $comparatorFactory = null) + public function __construct($value, ?StringUtil $util = null, ?ComparatorFactory $comparatorFactory = null) { $this->value = $value; $this->util = $util ?: new StringUtil(); diff --git a/src/Prophecy/Argument/Token/IdenticalValueToken.php b/src/Prophecy/Argument/Token/IdenticalValueToken.php index 067d8775e..dbe253d97 100644 --- a/src/Prophecy/Argument/Token/IdenticalValueToken.php +++ b/src/Prophecy/Argument/Token/IdenticalValueToken.php @@ -32,7 +32,7 @@ class IdenticalValueToken implements TokenInterface * * @param mixed $value */ - public function __construct($value, StringUtil $util = null) + public function __construct($value, ?StringUtil $util = null) { $this->value = $value; $this->util = $util ?: new StringUtil(); diff --git a/src/Prophecy/Argument/Token/ObjectStateToken.php b/src/Prophecy/Argument/Token/ObjectStateToken.php index 49dea6838..bb0586395 100644 --- a/src/Prophecy/Argument/Token/ObjectStateToken.php +++ b/src/Prophecy/Argument/Token/ObjectStateToken.php @@ -37,8 +37,8 @@ class ObjectStateToken implements TokenInterface public function __construct( $methodName, $value, - StringUtil $util = null, - ComparatorFactory $comparatorFactory = null + ?StringUtil $util = null, + ?ComparatorFactory $comparatorFactory = null ) { $this->name = $methodName; $this->value = $value; diff --git a/src/Prophecy/Call/Call.php b/src/Prophecy/Call/Call.php index 625f62ae6..486b03a20 100644 --- a/src/Prophecy/Call/Call.php +++ b/src/Prophecy/Call/Call.php @@ -49,7 +49,7 @@ class Call * @param null|int $line */ public function __construct($methodName, array $arguments, $returnValue, - Exception $exception = null, $file, $line) + ?Exception $exception, $file, $line) { $this->methodName = $methodName; $this->arguments = $arguments; diff --git a/src/Prophecy/Call/CallCenter.php b/src/Prophecy/Call/CallCenter.php index e2d0b98f2..d485fd2d4 100644 --- a/src/Prophecy/Call/CallCenter.php +++ b/src/Prophecy/Call/CallCenter.php @@ -43,7 +43,7 @@ class CallCenter * * @param StringUtil $util */ - public function __construct(StringUtil $util = null) + public function __construct(?StringUtil $util = null) { $this->util = $util ?: new StringUtil; $this->unexpectedCalls = new SplObjectStorage(); diff --git a/src/Prophecy/Doubler/CachedDoubler.php b/src/Prophecy/Doubler/CachedDoubler.php index f6f2ce66a..df892d3b7 100644 --- a/src/Prophecy/Doubler/CachedDoubler.php +++ b/src/Prophecy/Doubler/CachedDoubler.php @@ -26,7 +26,7 @@ class CachedDoubler extends Doubler */ private static $classes = array(); - protected function createDoubleClass(ReflectionClass $class = null, array $interfaces) + protected function createDoubleClass(?ReflectionClass $class, array $interfaces) { $classId = $this->generateClassId($class, $interfaces); if (isset(self::$classes[$classId])) { @@ -42,7 +42,7 @@ protected function createDoubleClass(ReflectionClass $class = null, array $inter * * @return string */ - private function generateClassId(ReflectionClass $class = null, array $interfaces) + private function generateClassId(?ReflectionClass $class, array $interfaces) { $parts = array(); if (null !== $class) { diff --git a/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php b/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php index f4c3d8b58..50299e7d5 100644 --- a/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php +++ b/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php @@ -30,7 +30,7 @@ class MagicCallPatch implements ClassPatchInterface private $tagRetriever; - public function __construct(MethodTagRetrieverInterface $tagRetriever = null) + public function __construct(?MethodTagRetrieverInterface $tagRetriever = null) { $this->tagRetriever = null === $tagRetriever ? new ClassAndInterfaceTagRetriever() : $tagRetriever; } diff --git a/src/Prophecy/Doubler/Doubler.php b/src/Prophecy/Doubler/Doubler.php index 88e153093..9cc4337ee 100644 --- a/src/Prophecy/Doubler/Doubler.php +++ b/src/Prophecy/Doubler/Doubler.php @@ -40,8 +40,8 @@ class Doubler */ private $instantiator; - public function __construct(ClassMirror $mirror = null, ClassCreator $creator = null, - NameGenerator $namer = null) + public function __construct(?ClassMirror $mirror = null, ?ClassCreator $creator = null, + ?NameGenerator $namer = null) { $this->mirror = $mirror ?: new ClassMirror; $this->creator = $creator ?: new ClassCreator; @@ -87,7 +87,7 @@ public function registerClassPatch(ClassPatchInterface $patch) * * @throws \Prophecy\Exception\InvalidArgumentException */ - public function double(ReflectionClass $class = null, array $interfaces, array $args = null) + public function double(?ReflectionClass $class, array $interfaces, ?array $args = null) { foreach ($interfaces as $interface) { if (!$interface instanceof ReflectionClass) { @@ -127,7 +127,7 @@ public function double(ReflectionClass $class = null, array $interfaces, array $ * * @return class-string */ - protected function createDoubleClass(ReflectionClass $class = null, array $interfaces) + protected function createDoubleClass(?ReflectionClass $class, array $interfaces) { $name = $this->namer->name($class, $interfaces); $node = $this->mirror->reflect($class, $interfaces); diff --git a/src/Prophecy/Doubler/Generator/ClassCreator.php b/src/Prophecy/Doubler/Generator/ClassCreator.php index 79f3b95de..1ebc32c88 100644 --- a/src/Prophecy/Doubler/Generator/ClassCreator.php +++ b/src/Prophecy/Doubler/Generator/ClassCreator.php @@ -23,7 +23,7 @@ class ClassCreator { private $generator; - public function __construct(ClassCodeGenerator $generator = null) + public function __construct(?ClassCodeGenerator $generator = null) { $this->generator = $generator ?: new ClassCodeGenerator; } diff --git a/src/Prophecy/Doubler/LazyDouble.php b/src/Prophecy/Doubler/LazyDouble.php index 96ca25bb7..e794293cb 100644 --- a/src/Prophecy/Doubler/LazyDouble.php +++ b/src/Prophecy/Doubler/LazyDouble.php @@ -125,7 +125,7 @@ public function addInterface($interface) * * @return void */ - public function setArguments(array $arguments = null) + public function setArguments(?array $arguments = null) { $this->arguments = $arguments; } diff --git a/src/Prophecy/Doubler/NameGenerator.php b/src/Prophecy/Doubler/NameGenerator.php index b62006493..b99366474 100644 --- a/src/Prophecy/Doubler/NameGenerator.php +++ b/src/Prophecy/Doubler/NameGenerator.php @@ -34,7 +34,7 @@ class NameGenerator * * @return string */ - public function name(ReflectionClass $class = null, array $interfaces) + public function name(?ReflectionClass $class, array $interfaces) { $parts = array(); diff --git a/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php b/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php index c4eccfcdc..7b6153524 100644 --- a/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php +++ b/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php @@ -25,7 +25,7 @@ final class ClassAndInterfaceTagRetriever implements MethodTagRetrieverInterface */ private $classRetriever; - public function __construct(MethodTagRetrieverInterface $classRetriever = null) + public function __construct(?MethodTagRetrieverInterface $classRetriever = null) { if (null !== $classRetriever) { $this->classRetriever = $classRetriever; diff --git a/src/Prophecy/Prediction/CallPrediction.php b/src/Prophecy/Prediction/CallPrediction.php index a6b95a3bd..cc853771f 100644 --- a/src/Prophecy/Prediction/CallPrediction.php +++ b/src/Prophecy/Prediction/CallPrediction.php @@ -28,7 +28,7 @@ class CallPrediction implements PredictionInterface { private $util; - public function __construct(StringUtil $util = null) + public function __construct(?StringUtil $util = null) { $this->util = $util ?: new StringUtil; } diff --git a/src/Prophecy/Prediction/CallTimesPrediction.php b/src/Prophecy/Prediction/CallTimesPrediction.php index 19554f30a..9aa30ca8f 100644 --- a/src/Prophecy/Prediction/CallTimesPrediction.php +++ b/src/Prophecy/Prediction/CallTimesPrediction.php @@ -32,7 +32,7 @@ class CallTimesPrediction implements PredictionInterface /** * @param int $times */ - public function __construct($times, StringUtil $util = null) + public function __construct($times, ?StringUtil $util = null) { $this->times = intval($times); $this->util = $util ?: new StringUtil; diff --git a/src/Prophecy/Prediction/NoCallsPrediction.php b/src/Prophecy/Prediction/NoCallsPrediction.php index b1b4f9fdd..dee384c19 100644 --- a/src/Prophecy/Prediction/NoCallsPrediction.php +++ b/src/Prophecy/Prediction/NoCallsPrediction.php @@ -26,7 +26,7 @@ class NoCallsPrediction implements PredictionInterface { private $util; - public function __construct(StringUtil $util = null) + public function __construct(?StringUtil $util = null) { $this->util = $util ?: new StringUtil; } diff --git a/src/Prophecy/Prophecy/ObjectProphecy.php b/src/Prophecy/Prophecy/ObjectProphecy.php index d10332f71..582a405ff 100644 --- a/src/Prophecy/Prophecy/ObjectProphecy.php +++ b/src/Prophecy/Prophecy/ObjectProphecy.php @@ -49,9 +49,9 @@ class ObjectProphecy implements ProphecyInterface */ public function __construct( LazyDouble $lazyDouble, - CallCenter $callCenter = null, - RevealerInterface $revealer = null, - ComparatorFactory $comparatorFactory = null + ?CallCenter $callCenter = null, + ?RevealerInterface $revealer = null, + ?ComparatorFactory $comparatorFactory = null ) { $this->lazyDouble = $lazyDouble; $this->callCenter = $callCenter ?: new CallCenter; @@ -103,7 +103,7 @@ public function willImplement($interface) * * @return $this */ - public function willBeConstructedWith(array $arguments = null) + public function willBeConstructedWith(?array $arguments = null) { $this->lazyDouble->setArguments($arguments); diff --git a/src/Prophecy/Prophet.php b/src/Prophecy/Prophet.php index 16c781347..2b2c77d13 100644 --- a/src/Prophecy/Prophet.php +++ b/src/Prophecy/Prophet.php @@ -44,9 +44,9 @@ class Prophet private $prophecies = array(); public function __construct( - Doubler $doubler = null, - RevealerInterface $revealer = null, - StringUtil $util = null + ?Doubler $doubler = null, + ?RevealerInterface $revealer = null, + ?StringUtil $util = null ) { if (null === $doubler) { $doubler = new CachedDoubler();