Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit257bdff

Browse files
feature#51703 [PhpUnitBridge] Add some more native types (d-eff-it)
This PR was merged into the 7.0 branch.Discussion----------[PhpUnitBridge] Add some more native types| Q | A| ------------- | ---| Branch? | 7.0 <!-- see below -->| Bug fix? | no| New feature? | no <!-- please update src/**/CHANGELOG.md files -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tickets | ~ <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead -->| License | MIT| Doc PR | <!-- required for new features --><!--Replace this notice by a short README for your feature/bugfix.This will help reviewers and should be a good start for the documentation.Additionally (seehttps://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should followhttps://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (seehttps://symfony.com/bc).-->Commits-------1db15fa [PhpUnitBridge] Add some more native types
2 parentsf3c9644 +1db15fa commit257bdff

File tree

8 files changed

+48
-170
lines changed

8 files changed

+48
-170
lines changed

‎src/Symfony/Bridge/PhpUnit/ClassExistsMock.php‎

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ class ClassExistsMock
2424
* Configures the classes to be checked upon existence.
2525
*
2626
* @param array $classes Mocked class names as keys (case-sensitive, without leading root namespace slash) and booleans as values
27-
*
28-
* @return void
2927
*/
30-
publicstaticfunctionwithMockedClasses(array$classes)
28+
publicstaticfunctionwithMockedClasses(array$classes):void
3129
{
3230
self::$classes =$classes;
3331
}
@@ -36,59 +34,42 @@ public static function withMockedClasses(array $classes)
3634
* Configures the enums to be checked upon existence.
3735
*
3836
* @param array $enums Mocked enums names as keys (case-sensitive, without leading root namespace slash) and booleans as values
39-
*
40-
* @return void
4137
*/
42-
publicstaticfunctionwithMockedEnums(array$enums)
38+
publicstaticfunctionwithMockedEnums(array$enums):void
4339
{
4440
self::$enums =$enums;
4541
self::$classes +=$enums;
4642
}
4743

48-
/**
49-
* @return bool
50-
*/
51-
publicstaticfunctionclass_exists($name,$autoload =true)
44+
publicstaticfunctionclass_exists($name,$autoload =true):bool
5245
{
5346
$name =ltrim($name,'\\');
5447

5548
returnisset(self::$classes[$name]) ? (bool)self::$classes[$name] :\class_exists($name,$autoload);
5649
}
5750

58-
/**
59-
* @return bool
60-
*/
61-
publicstaticfunctioninterface_exists($name,$autoload =true)
51+
publicstaticfunctioninterface_exists($name,$autoload =true):bool
6252
{
6353
$name =ltrim($name,'\\');
6454

6555
returnisset(self::$classes[$name]) ? (bool)self::$classes[$name] :\interface_exists($name,$autoload);
6656
}
6757

68-
/**
69-
* @return bool
70-
*/
71-
publicstaticfunctiontrait_exists($name,$autoload =true)
58+
publicstaticfunctiontrait_exists($name,$autoload =true):bool
7259
{
7360
$name =ltrim($name,'\\');
7461

7562
returnisset(self::$classes[$name]) ? (bool)self::$classes[$name] :\trait_exists($name,$autoload);
7663
}
7764

78-
/**
79-
* @return bool
80-
*/
81-
publicstaticfunctionenum_exists($name,$autoload =true)
65+
publicstaticfunctionenum_exists($name,$autoload =true):bool
8266
{
8367
$name =ltrim($name,'\\');
8468

8569
returnisset(self::$enums[$name]) ? (bool)self::$enums[$name] :\enum_exists($name,$autoload);
8670
}
8771

88-
/**
89-
* @return void
90-
*/
91-
publicstaticfunctionregister($class)
72+
publicstaticfunctionregister($class):void
9273
{
9374
$self =static::class;
9475

‎src/Symfony/Bridge/PhpUnit/ClockMock.php‎

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ class ClockMock
1919
{
2020
privatestatic$now;
2121

22-
/**
23-
* @return bool|null
24-
*/
25-
publicstaticfunctionwithClockMock($enable =null)
22+
publicstaticfunctionwithClockMock($enable =null): ?bool
2623
{
2724
if (null ===$enable) {
2825
returnnull !==self::$now;
@@ -33,10 +30,7 @@ public static function withClockMock($enable = null)
3330
returnnull;
3431
}
3532

36-
/**
37-
* @return int
38-
*/
39-
publicstaticfunctiontime()
33+
publicstaticfunctiontime():int
4034
{
4135
if (null ===self::$now) {
4236
return\time();
@@ -45,10 +39,7 @@ public static function time()
4539
return (int)self::$now;
4640
}
4741

48-
/**
49-
* @return int
50-
*/
51-
publicstaticfunctionsleep($s)
42+
publicstaticfunctionsleep($s):int
5243
{
5344
if (null ===self::$now) {
5445
return\sleep($s);
@@ -59,10 +50,7 @@ public static function sleep($s)
5950
return0;
6051
}
6152

62-
/**
63-
* @return void
64-
*/
65-
publicstaticfunctionusleep($us)
53+
publicstaticfunctionusleep($us):void
6654
{
6755
if (null ===self::$now) {
6856
\usleep($us);
@@ -71,6 +59,9 @@ public static function usleep($us)
7159
}
7260
}
7361

62+
/**
63+
* @return string|float
64+
*/
7465
publicstaticfunctionmicrotime($asFloat =false)
7566
{
7667
if (null ===self::$now) {
@@ -84,10 +75,7 @@ public static function microtime($asFloat = false)
8475
returnsprintf('%0.6f00 %d',self::$now - (int)self::$now, (int)self::$now);
8576
}
8677

87-
/**
88-
* @return string
89-
*/
90-
publicstaticfunctiondate($format,$timestamp =null)
78+
publicstaticfunctiondate($format,$timestamp =null):string
9179
{
9280
if (null ===$timestamp) {
9381
$timestamp =self::time();
@@ -96,10 +84,7 @@ public static function date($format, $timestamp = null)
9684
return\date($format,$timestamp);
9785
}
9886

99-
/**
100-
* @return string
101-
*/
102-
publicstaticfunctiongmdate($format,$timestamp =null)
87+
publicstaticfunctiongmdate($format,$timestamp =null):string
10388
{
10489
if (null ===$timestamp) {
10590
$timestamp =self::time();
@@ -124,10 +109,7 @@ public static function hrtime($asNumber = false)
124109
return [(int)self::$now, (int)$ns];
125110
}
126111

127-
/**
128-
* @return void
129-
*/
130-
publicstaticfunctionregister($class)
112+
publicstaticfunctionregister($class):void
131113
{
132114
$self =static::class;
133115

‎src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php‎

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,7 @@ private function getConfiguration()
278278
return$this->configuration = Configuration::fromUrlEncodedString((string)$mode);
279279
}
280280

281-
/**
282-
* @param string $str
283-
* @param bool $red
284-
*
285-
* @return string
286-
*/
287-
privatestaticfunctioncolorize($str,$red)
281+
privatestaticfunctioncolorize(string$str,bool$red):string
288282
{
289283
if (!self::hasColorSupport()) {
290284
return$str;
@@ -296,12 +290,9 @@ private static function colorize($str, $red)
296290
}
297291

298292
/**
299-
* @param string[] $groups
300-
* @param Configuration $configuration
301-
*
302-
* @throws \InvalidArgumentException
293+
* @param string[] $groups
303294
*/
304-
privatefunctiondisplayDeprecations($groups,$configuration)
295+
privatefunctiondisplayDeprecations(array$groups,Configuration$configuration):void
305296
{
306297
$cmp =function ($a,$b) {
307298
return$b->count() -$a->count();
@@ -397,10 +388,8 @@ private static function getPhpUnitErrorHandler(): callable
397388
*
398389
* Reference: Composer\XdebugHandler\Process::supportsColor
399390
* https://github.com/composer/xdebug-handler
400-
*
401-
* @return bool
402391
*/
403-
privatestaticfunctionhasColorSupport()
392+
privatestaticfunctionhasColorSupport():bool
404393
{
405394
if (!\defined('STDOUT')) {
406395
returnfalse;

‎src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Configuration.php‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Configuration
7070
* @param string $baselineFile The path to the baseline file
7171
* @param string|null $logFile The path to the log file
7272
*/
73-
privatefunction__construct(array$thresholds = [],$regex ='',$verboseOutput = [],$ignoreFile ='',$generateBaseline =false,$baselineFile ='',$logFile =null)
73+
privatefunction__construct(array$thresholds = [],string$regex ='',array$verboseOutput = [],string$ignoreFile ='',bool$generateBaseline =false,string$baselineFile ='',string$logFile =null)
7474
{
7575
$groups = ['total','indirect','direct','self'];
7676

@@ -279,10 +279,7 @@ public function writeBaseline(): void
279279
file_put_contents($this->baselineFile,json_encode($map, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES));
280280
}
281281

282-
/**
283-
* @param string $message
284-
*/
285-
publicfunctionshouldDisplayStackTrace($message):bool
282+
publicfunctionshouldDisplayStackTrace(string$message):bool
286283
{
287284
return'' !==$this->regex &&preg_match($this->regex,$message);
288285
}
@@ -308,10 +305,9 @@ public function getLogFile(): ?string
308305
}
309306

310307
/**
311-
* @param string $serializedConfiguration an encoded string, for instance
312-
* max[total]=1234&max[indirect]=42
308+
* @param string $serializedConfiguration An encoded string, for instance max[total]=1234&max[indirect]=42
313309
*/
314-
publicstaticfunctionfromUrlEncodedString($serializedConfiguration):self
310+
publicstaticfunctionfromUrlEncodedString(string$serializedConfiguration):self
315311
{
316312
parse_str($serializedConfiguration,$normalizedConfiguration);
317313
foreach (array_keys($normalizedConfiguration)as$key) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp