diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 51622f9..ae69f27 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,11 +8,11 @@ jobs: strategy: matrix: - php-version: ['8.1', '8.2', '8.3'] - + php-version: ["8.1", "8.2", "8.3", "8.4"] + steps: - uses: actions/checkout@v4 - - uses: php-actions/composer@v5 + - uses: php-actions/composer@v6 with: php_version: ${{ matrix.php-version }} args: --ignore-platform-reqs @@ -26,14 +26,14 @@ jobs: XDEBUG_MODE: coverage phpcs: runs-on: ubuntu-latest - + steps: - uses: actions/checkout@v4 - - uses: php-actions/composer@v5 + - uses: php-actions/composer@v6 with: php_version: 8.1 php_extensions: bcmath gmp xdebug - name: Install PHP_CodeSniffer run: | curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar - php phpcs.phar src --standard=ruleset.xml \ No newline at end of file + php phpcs.phar src --standard=ruleset.xml diff --git a/composer.json b/composer.json index bee7ac4..0906073 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ } }, "require": { - "php": "^8.1 || ^8.2 || ^8.3", + "php": "^8.1 || ^8.2 || ^8.3 || ^8.4", "ext-bcmath": "*", "ext-openssl": "*", "ext-curl": "*", diff --git a/composer.lock b/composer.lock index 9cba6b1..2af6008 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f524e8d7e694772cc0d8f8df4a8cd95f", + "content-hash": "ec588010ec8bd4f569dce2950f1f1ac8", "packages": [], "packages-dev": [ { @@ -1634,17 +1634,17 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^8.1 || ^8.2 || ^8.3", + "php": "^8.1 || ^8.2 || ^8.3 || ^8.4", "ext-bcmath": "*", "ext-openssl": "*", "ext-curl": "*", "ext-json": "*", "ext-iconv": "*" }, - "platform-dev": [], + "platform-dev": {}, "plugin-api-version": "2.6.0" } diff --git a/examples.php b/examples.php index 38ded4a..c53738d 100644 --- a/examples.php +++ b/examples.php @@ -18,6 +18,9 @@ try { // Use the EncryptedFilesystemStorage to load the Merchant's encrypted private key with the Master Password. + /** + * @var PrivateKey + */ $privateKey = $storageEngine->load(__DIR__ . '/secure/SecurePathPlusYourClientName.key'); } catch (Exception $ex) { // Check if the loaded keys is a valid key @@ -86,4 +89,4 @@ **/ echo $resultData['data'][0]['pairingCode']; -/** End of request **/ \ No newline at end of file +/** End of request **/ diff --git a/src/BitPayKeyUtils/KeyHelper/KeyInterface.php b/src/BitPayKeyUtils/KeyHelper/KeyInterface.php index 64b790a..f0c07e2 100644 --- a/src/BitPayKeyUtils/KeyHelper/KeyInterface.php +++ b/src/BitPayKeyUtils/KeyHelper/KeyInterface.php @@ -18,4 +18,9 @@ public function generate(); * @return boolean */ public function isValid(); + + /** + * @return string + */ + public function getId(); } diff --git a/src/BitPayKeyUtils/KeyHelper/PublicKey.php b/src/BitPayKeyUtils/KeyHelper/PublicKey.php index 512fb8d..cb39065 100644 --- a/src/BitPayKeyUtils/KeyHelper/PublicKey.php +++ b/src/BitPayKeyUtils/KeyHelper/PublicKey.php @@ -103,7 +103,7 @@ public function getSin() * @return PublicKey * @throws Exception */ - public function generate(PrivateKey $privateKey = null) + public function generate(?PrivateKey $privateKey = null) { if ($privateKey instanceof PrivateKey) { $this->setPrivateKey($privateKey); diff --git a/src/BitPayKeyUtils/Math/BcEngine.php b/src/BitPayKeyUtils/Math/BcEngine.php index 332b3a4..0fc7412 100644 --- a/src/BitPayKeyUtils/Math/BcEngine.php +++ b/src/BitPayKeyUtils/Math/BcEngine.php @@ -16,8 +16,8 @@ public function __construct() } /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String * @return string * @throws Exception * @throws Exception @@ -56,8 +56,8 @@ public function input($x) } /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String * @return int * @throws Exception * @throws Exception @@ -72,8 +72,8 @@ public function cmp($a, $b) } /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String * @return string|null * @throws Exception * @throws Exception @@ -136,8 +136,8 @@ public function invertm($num, $mod) } /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String * @return string|null * @throws Exception * @throws Exception @@ -156,8 +156,8 @@ public function mod($a, $b) } /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String * @return string * @throws Exception * @throws Exception @@ -172,8 +172,8 @@ public function mul($a, $b) } /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String * @return string * @throws Exception * @throws Exception @@ -188,8 +188,8 @@ public function pow($a, $b) } /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String * @return string * @throws Exception * @throws Exception diff --git a/src/BitPayKeyUtils/Math/EngineInterface.php b/src/BitPayKeyUtils/Math/EngineInterface.php index 3416682..db41836 100644 --- a/src/BitPayKeyUtils/Math/EngineInterface.php +++ b/src/BitPayKeyUtils/Math/EngineInterface.php @@ -8,50 +8,50 @@ interface EngineInterface { /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String */ public function add($a, $b); /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String */ public function cmp($a, $b); /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String */ public function div($a, $b); /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String */ public function invertm($a, $b); /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String */ public function mod($a, $b); /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String */ public function mul($a, $b); /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String */ public function pow($a, $b); /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String */ public function sub($a, $b); } diff --git a/src/BitPayKeyUtils/Math/GmpEngine.php b/src/BitPayKeyUtils/Math/GmpEngine.php index a15f87c..0513b26 100644 --- a/src/BitPayKeyUtils/Math/GmpEngine.php +++ b/src/BitPayKeyUtils/Math/GmpEngine.php @@ -5,8 +5,8 @@ class GmpEngine implements EngineInterface { /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String * @return string */ public function add($a, $b) @@ -15,8 +15,8 @@ public function add($a, $b) } /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String * @return string */ public function cmp($a, $b) @@ -25,8 +25,8 @@ public function cmp($a, $b) } /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String * @param int $round * @return string */ @@ -36,8 +36,8 @@ public function div($a, $b, $round = GMP_ROUND_ZERO) } /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String * @return string */ public function invertm($a, $b) @@ -46,8 +46,8 @@ public function invertm($a, $b) } /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String * @return string */ public function mod($a, $b) @@ -56,8 +56,8 @@ public function mod($a, $b) } /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String * @return string */ public function mul($a, $b) @@ -66,8 +66,8 @@ public function mul($a, $b) } /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String * @return string */ public function pow($a, $b) @@ -76,8 +76,8 @@ public function pow($a, $b) } /** - * @param String $a Numeric String - * @param String $b Numeric String + * @param string $a Numeric String + * @param string $b Numeric String * @return string */ public function sub($a, $b) diff --git a/src/BitPayKeyUtils/Util/Error.php b/src/BitPayKeyUtils/Util/Error.php index d981d86..296031f 100644 --- a/src/BitPayKeyUtils/Util/Error.php +++ b/src/BitPayKeyUtils/Util/Error.php @@ -20,9 +20,9 @@ final public function backtrace($print = false, $options = false, $limit = 0) { if ($print == true) { return debug_print_backtrace($options, $limit); - } else { - return debug_backtrace($options, $limit); } + + return debug_backtrace($options, $limit); } /** @@ -33,7 +33,6 @@ final public function backtrace($print = false, $options = false, $limit = 0) * Returns NULL if there hasn't been an error yet. * (PHP 5 >= 5.2.0) * - * @param void * @return array */ final public function last() @@ -57,7 +56,7 @@ final public function last() */ final public function log($message, $message_type = 0, $destination = '', $extra_headers = '') { - return error_log((string)$message, $message_type = 0, $destination = '', $extra_headers = ''); + return error_log((string)$message, $message_type, $destination, $extra_headers); } /** @@ -66,16 +65,16 @@ final public function log($message, $message_type = 0, $destination = '', $extra * parameter is given. * (PHP 4, PHP 5) * - * @param bool + * @param int|null * @return int */ - final public function reporting($level = false) + final public function reporting($level = null) { - if ($level !== false) { + if ($level !== null) { return error_reporting($level); - } else { - return error_reporting(); } + + return error_reporting(); } /** @@ -85,41 +84,38 @@ final public function reporting($level = false) * * @param string * @param string - * @param mixed + * @param callable|null * @param int - * return mixed * @return bool|callable|mixed|null */ - final public function handler($type = 'error', $action = 'restore', $callable_handler = false, $error_types = null) - { + final public function handler( + $type = 'error', + $action = 'restore', + callable | null $callable_handler = null, + $error_types = null + ) { if (empty($error_types)) { - $error_types = E_ALL | E_STRICT; + $error_types = PHP_VERSION_ID < 80400 ? E_ALL | E_STRICT : E_ALL; } switch (strtolower($type)) { case 'error': switch (strtolower($action)) { case 'restore': return restore_error_handler(); - break; case 'set': return set_error_handler($callable_handler, $error_types); - break; default: return false; } - break; case 'exception': switch (strtolower($action)) { case 'restore': return restore_exception_handler(); - break; case 'set': return set_exception_handler($callable_handler); - break; default: return false; } - break; default: return false; } diff --git a/src/BitPayKeyUtils/Util/Fingerprint.php b/src/BitPayKeyUtils/Util/Fingerprint.php index a968e7c..3887f83 100644 --- a/src/BitPayKeyUtils/Util/Fingerprint.php +++ b/src/BitPayKeyUtils/Util/Fingerprint.php @@ -15,7 +15,6 @@ class Fingerprint * takes the hash of that value to use as the env * fingerprint. * - * @param void * @return string */ final public static function generate() diff --git a/src/BitPayKeyUtils/Util/Util.php b/src/BitPayKeyUtils/Util/Util.php index efbbc7d..dbe88a0 100644 --- a/src/BitPayKeyUtils/Util/Util.php +++ b/src/BitPayKeyUtils/Util/Util.php @@ -134,7 +134,7 @@ public static function guid() /** * Encodes a decimal value into hexadecimal. * - * @param string $dec + * @param mixed $dec * @return string * @throws Exception * @throws Exception @@ -142,7 +142,7 @@ public static function guid() public static function encodeHex($dec) { if (!is_string($dec) && !ctype_digit((string)$dec)) { - throw new Exception(sprintf('Argument is expected to be a string of decimal numbers. + throw new Exception(sprintf('Argument is expected to be a string of decimal numbers. You passed in "%s"', gettype($dec))); } @@ -163,7 +163,7 @@ public static function encodeHex($dec) return $hex; } - public static function doubleAndAdd($hex, PointInterface $point, CurveParameterInterface $parameters = null) + public static function doubleAndAdd($hex, PointInterface $point, ?CurveParameterInterface $parameters = null) { if (null === $parameters) { $parameters = new Secp256k1(); @@ -224,8 +224,8 @@ public static function decToBin($dec) $dec = Math::div($dec, 2); //sanity check to avoid infinite loop if (Math::cmp($prevDec, $dec) < 1) { - throw new Exception('Math library has unexpected behavior, - please report the following information to support@bitpay.com. Math Engine is: + throw new Exception('Math library has unexpected behavior, + please report the following information to support@bitpay.com. Math Engine is: ' . Math::getEngineName() . '. PHP Version is: ' . phpversion() . '.'); } } @@ -275,7 +275,7 @@ public static function decodeHex($hex) * @throws Exception * @throws Exception */ - public static function pointDouble(PointInterface $point, CurveParameterInterface $parameters = null) + public static function pointDouble(PointInterface $point, ?CurveParameterInterface $parameters = null) { if ($point->isInfinity()) { return $point; diff --git a/test/unit/BitPayKeyUtils/KeyHelper/PublicKeyTest.php b/test/unit/BitPayKeyUtils/KeyHelper/PublicKeyTest.php index c5f4959..de7522e 100644 --- a/test/unit/BitPayKeyUtils/KeyHelper/PublicKeyTest.php +++ b/test/unit/BitPayKeyUtils/KeyHelper/PublicKeyTest.php @@ -7,6 +7,7 @@ use BitPayKeyUtils\KeyHelper\PrivateKey; use BitPayKeyUtils\KeyHelper\PublicKey; use BitPayKeyUtils\KeyHelper\SinKey; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class PublicKeyTest extends TestCase @@ -16,6 +17,9 @@ class PublicKeyTest extends TestCase public function testCreateFromPrivateKey(): void { + /** + * @var PrivateKey|MockObject + */ $privateKeyMock = $this->createMock(PrivateKey::class); $result = PublicKey::createFromPrivateKey($privateKeyMock); @@ -24,6 +28,9 @@ public function testCreateFromPrivateKey(): void public function testSetPrivateKey(): void { + /** + * @var PrivateKey|MockObject + */ $privateKeyMock = $this->createMock(PrivateKey::class); $testedObject = $this->getTestedClassObject(); @@ -99,6 +106,9 @@ public function testGetSinWhenKeyNotGenerated(): void public function testGetSin(): void { $testedObject = $this->getTestedClassObject(); + /** + * @var PrivateKey|MockObject + */ $privateKeyMock = $this->getValidPrivateKeyMock(); $testedObject->setPrivateKey($privateKeyMock); @@ -110,6 +120,9 @@ public function testGenerate(): void { $testedObject = $this->getTestedClassObject(); + /** + * @var PrivateKey|MockObject + */ $privateKeyMock = $this->getValidPrivateKeyMock(); $result = $testedObject->generate($privateKeyMock); @@ -119,6 +132,9 @@ public function testGenerate(): void public function testGenerateWhenHexNotEmpty(): void { $testedObject = $this->getTestedClassObject(); + /** + * @var PrivateKey|MockObject + */ $privateKeyMock = $this->createMock(PrivateKey::class); $this->setProtectedPropertyValue($testedObject, 'hex', self::EXAMPLE_HEX); $result = $testedObject->generate($privateKeyMock); @@ -129,6 +145,9 @@ public function testGenerateWhenHexNotEmpty(): void public function testGenerateWhenPrivateKeyInvalid(): void { $testedObject = $this->getTestedClassObject(); + /** + * @var PrivateKey|MockObject + */ $privateKeyMock = $this->createMock(PrivateKey::class); $privateKeyMock->expects($this->any())->method('isValid')->willReturn(false); diff --git a/test/unit/BitPayKeyUtils/KeyHelper/SinKeyTest.php b/test/unit/BitPayKeyUtils/KeyHelper/SinKeyTest.php index dea9903..d6c5615 100644 --- a/test/unit/BitPayKeyUtils/KeyHelper/SinKeyTest.php +++ b/test/unit/BitPayKeyUtils/KeyHelper/SinKeyTest.php @@ -7,6 +7,7 @@ use BitPayKeyUtils\KeyHelper\PrivateKey; use BitPayKeyUtils\KeyHelper\PublicKey; use BitPayKeyUtils\KeyHelper\SinKey; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class SinKeyTest extends TestCase @@ -38,6 +39,9 @@ public function test__toStringValue(): void public function testSetPublicKey(): void { + /** + * @var PublicKey|MockObject + */ $publicKey = $this->getMockBuilder(PublicKey::class)->getMock(); self::assertSame($this->sinKey, $this->sinKey->setPublicKey($publicKey)); @@ -81,4 +85,4 @@ private function getAccessibleProperty(string $class, string $property): \Reflec return $property; } -} \ No newline at end of file +} diff --git a/test/unit/BitPayKeyUtils/Storage/EncryptedFilesystemStorageTest.php b/test/unit/BitPayKeyUtils/Storage/EncryptedFilesystemStorageTest.php index 989e3ba..31df45a 100644 --- a/test/unit/BitPayKeyUtils/Storage/EncryptedFilesystemStorageTest.php +++ b/test/unit/BitPayKeyUtils/Storage/EncryptedFilesystemStorageTest.php @@ -5,7 +5,9 @@ namespace BitPayKeyUtils\UnitTest\Storage; use BitPayKeyUtils\KeyHelper\Key; +use BitPayKeyUtils\KeyHelper\KeyInterface; use BitPayKeyUtils\Storage\EncryptedFilesystemStorage; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class EncryptedFilesystemStorageTest extends TestCase @@ -19,10 +21,14 @@ public function testInstanceOf(): void public function testPersist(): void { $encryptedFilesystemStorage = $this->createClassObject(); + /** + * @var KeyInterface|MockObject + */ $keyInterface = $this->getMockBuilder(Key::class)->setMockClassName('KeyMock2')->getMock(); $keyInterface->method('getId')->willReturn(__DIR__ . '/test11.txt'); self::assertFileExists(__DIR__ . '/test11.txt'); - self::assertSame(null, $encryptedFilesystemStorage->persist($keyInterface)); + $encryptedFilesystemStorage->persist($keyInterface); + self::assertFileExists(__DIR__ . '/test11.txt'); } public function testLoadNotFindException(): void diff --git a/test/unit/BitPayKeyUtils/Storage/FilesystemStorageTest.php b/test/unit/BitPayKeyUtils/Storage/FilesystemStorageTest.php index 145b1a0..bfcb0a8 100644 --- a/test/unit/BitPayKeyUtils/Storage/FilesystemStorageTest.php +++ b/test/unit/BitPayKeyUtils/Storage/FilesystemStorageTest.php @@ -6,6 +6,7 @@ use BitPayKeyUtils\KeyHelper\Key; use BitPayKeyUtils\Storage\FilesystemStorage; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class FilesystemStorageTest extends TestCase @@ -20,6 +21,9 @@ public function testInstanceOf(): void public function testPersist(): void { $filesystemStorage = $this->createClassObject(); + /** + * @var Key|MockObject + */ $keyInterface = $this->getMockBuilder(Key::class)->setMockClassName('KeyMock1')->getMock(); $keyInterface->method('getId')->willReturn(__DIR__ . '/test1.txt'); self::assertFileExists(__DIR__ . '/test1.txt'); diff --git a/test/unit/BitPayKeyUtils/Util/ErrorTest.php b/test/unit/BitPayKeyUtils/Util/ErrorTest.php index 788aca8..edd6bf5 100644 --- a/test/unit/BitPayKeyUtils/Util/ErrorTest.php +++ b/test/unit/BitPayKeyUtils/Util/ErrorTest.php @@ -79,14 +79,14 @@ public function testHandlerWithActionSet(): void public function testHandlerWithActionFalse(): void { $testedObject = $this->getTestedClassObject(); - $result = $testedObject->handler('error', false); + $result = $testedObject->handler('error', ''); self::assertFalse($result); } public function testHandlerWithTypeExceptionAndNoAction(): void { $testedObject = $this->getTestedClassObject(); - $result = $testedObject->handler('exception', false); + $result = $testedObject->handler('exception', ''); self::assertFalse($result); } diff --git a/test/unit/BitPayKeyUtils/Util/PointTest.php b/test/unit/BitPayKeyUtils/Util/PointTest.php index 66c06f1..3e01987 100644 --- a/test/unit/BitPayKeyUtils/Util/PointTest.php +++ b/test/unit/BitPayKeyUtils/Util/PointTest.php @@ -61,11 +61,12 @@ public function testSerialize(): void public function testUnserialize(): void { - $expectedValue = '[-2, 3]'; $testedData = 'a:2:{i:0;s:2:"-2";i:1;s:1:"3";}'; $point = $this->createClassObject(); - self::assertSame(null, $point->unserialize($testedData)); + $point->unserialize($testedData); + self::assertSame('-2', $point->getX()); + self::assertSame('3', $point->getY()); } public function test__serialize(): void @@ -78,10 +79,10 @@ public function test__serialize(): void public function test__unserialize(): void { - $expectedValue = ['-2', '3']; - $point = $this->createClassObject(); - self::assertSame(null, $point->__unserialize(['-2', '3'])); + $point->__unserialize(['-2', '3']); + self::assertSame('-2', $point->getX()); + self::assertSame('3', $point->getY()); } private function createClassObject(): Point diff --git a/test/unit/BitPayKeyUtils/Util/UtilTest.php b/test/unit/BitPayKeyUtils/Util/UtilTest.php index 96eccb1..24c0fba 100644 --- a/test/unit/BitPayKeyUtils/Util/UtilTest.php +++ b/test/unit/BitPayKeyUtils/Util/UtilTest.php @@ -6,6 +6,7 @@ use BitPayKeyUtils\Util\Point; use BitPayKeyUtils\Util\Util; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class UtilTest extends TestCase @@ -118,6 +119,9 @@ public function testDecodeHex(): void public function testPointDouble(): void { + /** + * @var Point|MockObject + */ $pointInterface = $this->getMockBuilder(Point::class)->disableOriginalConstructor()->getMock(); $pointInterface->method('getX')->willReturn('5'); $pointInterface->method('getY')->willReturn('3'); @@ -131,10 +135,16 @@ public function testPointDouble(): void public function testPointAdd(): void { + /** + * @var Point|MockObject + */ $pointInterfaceP = $this->getMockBuilder(Point::class)->disableOriginalConstructor()->getMock(); $pointInterfaceP->method('getX')->willReturn('6'); $pointInterfaceP->method('getY')->willReturn('9'); + /** + * @var Point|MockObject + */ $pointInterfaceQ = $this->getMockBuilder(Point::class)->disableOriginalConstructor()->getMock(); $pointInterfaceQ->method('getX')->willReturn('8'); $pointInterfaceQ->method('getY')->willReturn('2'); @@ -148,10 +158,16 @@ public function testPointAdd(): void public function testPointAddSameValues(): void { + /** + * @var Point|MockObject + */ $pointInterfaceP = $this->getMockBuilder(Point::class)->disableOriginalConstructor()->getMock(); $pointInterfaceP->method('getX')->willReturn('5'); $pointInterfaceP->method('getY')->willReturn('3'); + /** + * @var Point|MockObject + */ $pointInterfaceQ = $this->getMockBuilder(Point::class)->disableOriginalConstructor()->getMock(); $pointInterfaceQ->method('getX')->willReturn('5'); $pointInterfaceQ->method('getY')->willReturn('3'); @@ -165,11 +181,17 @@ public function testPointAddSameValues(): void public function testPointAddInfinity(): void { + /** + * @var Point|MockObject + */ $pointInterfaceP = $this->getMockBuilder(Point::class)->disableOriginalConstructor()->getMock(); $pointInterfaceP->method('isInfinity')->willReturn(false); $pointInterfaceP->method('getX')->willReturn('1'); $pointInterfaceP->method('getY')->willReturn('2'); + /** + * @var Point|MockObject + */ $pointInterfaceQ = $this->getMockBuilder(Point::class)->disableOriginalConstructor()->getMock(); $pointInterfaceQ->method('isInfinity')->willReturn(true);