diff --git a/generator/src/ComposerJsonEditor.php b/generator/src/ComposerJsonEditor.php index 8e3b76a5..7ff7a55c 100644 --- a/generator/src/ComposerJsonEditor.php +++ b/generator/src/ComposerJsonEditor.php @@ -1,5 +1,6 @@ getArgument('module'); diff --git a/generator/src/DocPage.php b/generator/src/DocPage.php index d55204e5..c202724b 100644 --- a/generator/src/DocPage.php +++ b/generator/src/DocPage.php @@ -1,5 +1,7 @@ rmGenerated(); diff --git a/generator/src/Method.php b/generator/src/Method.php index d3406fd4..4f7b3418 100644 --- a/generator/src/Method.php +++ b/generator/src/Method.php @@ -1,5 +1,7 @@ type = new PhpStanType($type, $writeOnly); } - /** - * @return string - */ public function getName(): string { return $this->name; diff --git a/generator/src/PhpStanFunctions/PhpStanType.php b/generator/src/PhpStanFunctions/PhpStanType.php index bf0e8fdb..814660e5 100644 --- a/generator/src/PhpStanFunctions/PhpStanType.php +++ b/generator/src/PhpStanFunctions/PhpStanType.php @@ -1,5 +1,6 @@ assertEquals($datetime->getTimestamp(), $safeDatime->getTimestamp()); } - public function testSerialize() + public function testSerialize(): void { $timezone = new \DateTimeZone('Pacific/Chatham'); $safeDatetime = DateTimeImmutable::createFromFormat('d-m-Y', '20-03-2006', $timezone); diff --git a/generator/tests/DateTimeTest.php b/generator/tests/DateTimeTest.php index ce4bf502..6f5b2d13 100644 --- a/generator/tests/DateTimeTest.php +++ b/generator/tests/DateTimeTest.php @@ -1,5 +1,6 @@ assertEquals('Exceptions/ApcException.php', DeprecateCommand::getExceptionFilePath('apc')); } diff --git a/generator/tests/DocPageTest.php b/generator/tests/DocPageTest.php index f8a1e7d6..842d932e 100644 --- a/generator/tests/DocPageTest.php +++ b/generator/tests/DocPageTest.php @@ -1,12 +1,14 @@ assertTrue($fopen->detectFalsyFunction()); } - public function testDetectNullsyFunction() + public function testDetectNullsyFunction(): void { $implode = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/strings/functions/implode.xml'); $this->assertFalse($implode->detectNullsyFunction()); } - public function testDetectEmptyFunction() + public function testDetectEmptyFunction(): void { $pgHost = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/pgsql/functions/pg-host.xml'); diff --git a/generator/tests/GeneratedFilesTest.php b/generator/tests/GeneratedFilesTest.php index 021c3b70..f165679e 100644 --- a/generator/tests/GeneratedFilesTest.php +++ b/generator/tests/GeneratedFilesTest.php @@ -1,5 +1,7 @@ assertSame('foobar', sprintf('foo%s', 'bar')); $this->assertSame('foobarbaz', sprintf('foo%s%s', 'bar', 'baz')); - set_error_handler(function () { + set_error_handler(function (): void { }); try { $this->expectException(\ArgumentCountError::class); @@ -32,7 +34,7 @@ public function testSprintf() } } - public function testPregMatch() + public function testPregMatch(): void { require_once __DIR__ . '/../../generated/pcre.php'; require_once __DIR__ . '/../../lib/Exceptions/SafeExceptionInterface.php'; @@ -46,7 +48,7 @@ public function testPregMatch() $this->assertSame($originalMatches, $matches); } - public function testObjects() + public function testObjects(): void { require_once __DIR__ . '/../../lib/special_cases.php'; require_once __DIR__ . '/../../lib/Exceptions/SafeExceptionInterface.php'; @@ -76,7 +78,7 @@ public function testObjects() * Tests that the limit parameter is nullable. * See https://github.com/thecodingmachine/safe/issues/56 */ - public function testPregSplit() + public function testPregSplit(): void { require_once __DIR__ . '/../../generated/pcre.php'; require_once __DIR__ . '/../../lib/Exceptions/SafeExceptionInterface.php'; @@ -90,7 +92,7 @@ public function testPregSplit() /** * Tests that parameters with "time()" default value are correctly handled. */ - public function testStrtotime() + public function testStrtotime(): void { require_once __DIR__ . '/../../generated/datetime.php'; require_once __DIR__ . '/../../lib/Exceptions/SafeExceptionInterface.php'; @@ -98,7 +100,7 @@ public function testStrtotime() $this->assertSame(\strtotime('+1 day'), strtotime('+1 day')); - set_error_handler(function () { + set_error_handler(function (): void { }); try { $this->expectException(DatetimeException::class); @@ -111,7 +113,7 @@ public function testStrtotime() /** * Tests that parameters signature can be not passed. See https://github.com/thecodingmachine/safe/issues/86 */ - public function testOpenSslSign() + public function testOpenSslSign(): void { require_once __DIR__ . '/../../generated/openssl.php'; require_once __DIR__ . '/../../lib/Exceptions/SafeExceptionInterface.php'; @@ -123,7 +125,7 @@ public function testOpenSslSign() $this->assertSame($signature, $signatureSafe); } - public function testOpenSslEncrypt() + public function testOpenSslEncrypt(): void { $result = \openssl_encrypt( 'test', diff --git a/generator/tests/MethodTest.php b/generator/tests/MethodTest.php index 82723aae..0cfe4d4e 100644 --- a/generator/tests/MethodTest.php +++ b/generator/tests/MethodTest.php @@ -1,5 +1,7 @@ getMethodSynopsis(); @@ -16,7 +18,7 @@ public function testGetFunctionName() $this->assertEquals('preg_match', $name); } - public function testGetFunctionType() + public function testGetFunctionType(): void { $docPage = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/pcre/functions/preg-match.xml'); $xmlObject = $docPage->getMethodSynopsis(); @@ -25,7 +27,7 @@ public function testGetFunctionType() $this->assertEquals('int', $type); } - public function testGetFunctionParam() + public function testGetFunctionParam(): void { $docPage = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/pcre/functions/preg-match.xml'); $xmlObject = $docPage->getMethodSynopsis(); @@ -35,7 +37,7 @@ public function testGetFunctionParam() $this->assertEquals('pattern', $params[0]->getParameterName()); } - public function testGetTypeHintFromRessource() + public function testGetTypeHintFromResource(): void { $docPage = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/strings/functions/sprintf.xml'); $xmlObject = $docPage->getMethodSynopsis(); @@ -74,7 +76,7 @@ public function testGetTypeHintFromRessource() $this->assertEquals('\HashContext', $params[0]->getSignatureType()); } - public function testImapOpen5Parameter() + public function testImapOpen5Parameter(): void { $docPage = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/imap/functions/imap-open.xml'); $xmlObject = $docPage->getMethodSynopsis(); @@ -84,7 +86,7 @@ public function testImapOpen5Parameter() $this->assertEquals('array', $params[5]->getSignatureType()); } - public function testGetInitializer() + public function testGetInitializer(): void { $docPage = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/apache/functions/apache-getenv.xml'); $xmlObject = $docPage->getMethodSynopsis(); diff --git a/generator/tests/PhpStanFunctions/PhpStanFunctionMapReaderTest.php b/generator/tests/PhpStanFunctions/PhpStanFunctionMapReaderTest.php index 2af9fd3f..e6141016 100644 --- a/generator/tests/PhpStanFunctions/PhpStanFunctionMapReaderTest.php +++ b/generator/tests/PhpStanFunctions/PhpStanFunctionMapReaderTest.php @@ -1,5 +1,7 @@ getFunctionsPaths(); @@ -16,7 +18,7 @@ public function testGetMethodsPaths() $this->assertArrayNotHasKey(__DIR__.'/../doc/doc-en/en/reference/spl/appenditerator/getarrayiterator.xml', $paths); } - public function testGetFunctionsPaths() + public function testGetFunctionsPaths(): void { $scanner = new Scanner(__DIR__ . '/../doc/doc-en/en/reference/'); $paths = $scanner->getMethodsPaths(); diff --git a/generator/tests/SpecialCasesTest.php b/generator/tests/SpecialCasesTest.php index e5f97232..b4f17d3c 100644 --- a/generator/tests/SpecialCasesTest.php +++ b/generator/tests/SpecialCasesTest.php @@ -1,5 +1,7 @@ assertSame('\\stdClass', Type::toRootNamespace('stdClass')); $this->assertSame('\\SimpleXMLElement', Type::toRootNamespace('SimpleXMLElement')); diff --git a/generator/tests/rector/src/test.php b/generator/tests/rector/src/test.php index 61b4bee7..5cb4b09a 100644 --- a/generator/tests/rector/src/test.php +++ b/generator/tests/rector/src/test.php @@ -1,3 +1,5 @@ format(\DATE_ATOM), $safeImmutableDate->format(\DATE_ATOM)); } - public function createFromInterfaces(): array + public static function createFromInterfaces(): array { return [ [new \DateTime('2022-11-29T14:17:34+00:00')],