Skip to content

Add missing @no-named-arguments annotations and ensure there won't be new missing ones anymore #6238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: 11.5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
tools: none

- name: Run PHP-CS-Fixer
run: ./tools/php-cs-fixer fix --dry-run --show-progress=dots --using-cache=no --verbose
run: ./tools/php-cs-fixer check --show-progress=dots --using-cache=no --verbose

static-analysis:
name: Static Analysis
Expand Down
8 changes: 8 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
file that was distributed with this source code.
EOF;

require __DIR__ . '/tools/.php-cs-fixer/vendor/kubawerlos/php-cs-fixer-custom-fixers/bootstrap.php';

$finder = PhpCsFixer\Finder::create()
->files()
->in(__DIR__ . '/src')
Expand All @@ -29,6 +31,7 @@

$config = new PhpCsFixer\Config;
$config->setFinder($finder)
->registerCustomFixers(new PhpCsFixerCustomFixers\Fixers)
->setRiskyAllowed(true)
->setRules([
'align_multiline_comment' => true,
Expand Down Expand Up @@ -371,6 +374,11 @@
],
'void_return' => true,
'whitespace_after_comma_in_array' => true,
PhpCsFixerCustomFixers\Fixer\PhpdocTagNoNamedArgumentsFixer::name() => [
'directory' => __DIR__ . '/src/',
'description' => 'Parameter names are not covered by the backward compatibility promise for PHPUnit'
]

]);

$config->setCacheFile(__DIR__ . '/.php-cs-fixer.cache/' . json_decode((string) @file_get_contents('composer.json'), true)["extra"]["branch-alias"]["dev-main"] ?? 'unknown');
Expand Down
3 changes: 3 additions & 0 deletions src/Event/Exception/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
*/
namespace PHPUnit\Event;

/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*/
interface Exception extends \PHPUnit\Exception
{
}
3 changes: 3 additions & 0 deletions src/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

use Throwable;

/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*/
interface Exception extends Throwable
{
}
3 changes: 3 additions & 0 deletions src/Framework/TestRunner/ChildProcessResultProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
use PHPUnit\Runner\CodeCoverage;
use PHPUnit\TestRunner\TestResult\PassedTests;

/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*/
final readonly class ChildProcessResultProcessor
{
private Facade $eventFacade;
Expand Down
3 changes: 3 additions & 0 deletions src/Metadata/Exception/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
*/
namespace PHPUnit\Metadata;

/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*/
interface Exception extends \PHPUnit\Exception
{
}
3 changes: 3 additions & 0 deletions src/Metadata/Exception/InvalidVersionRequirementException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

use RuntimeException;

/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*/
final class InvalidVersionRequirementException extends RuntimeException implements Exception
{
}
3 changes: 3 additions & 0 deletions src/Metadata/Exception/NoVersionRequirementException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

use RuntimeException;

/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*/
final class NoVersionRequirementException extends RuntimeException implements Exception
{
}
3 changes: 3 additions & 0 deletions src/TextUI/Output/Default/UnexpectedOutputPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
use PHPUnit\Event\UnknownSubscriberTypeException;
use PHPUnit\TextUI\Output\Printer;

/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*/
final readonly class UnexpectedOutputPrinter implements PrintedUnexpectedOutputSubscriber
{
private Printer $printer;
Expand Down
6 changes: 6 additions & 0 deletions tools/.php-cs-fixer/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"require-dev": {
"kubawerlos/php-cs-fixer-custom-fixers": "^3.27",
"php-cs-fixer/shim": "^3.75"
}
}
123 changes: 123 additions & 0 deletions tools/.php-cs-fixer/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions tools/.php-cs-fixer/vendor/autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

// autoload.php @generated by Composer

if (PHP_VERSION_ID < 50600) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
throw new RuntimeException($err);
}

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit3457f0272a028217b66ee19b6e4c5737::getLoader();
119 changes: 119 additions & 0 deletions tools/.php-cs-fixer/vendor/bin/php-cs-fixer
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#!/usr/bin/env php
<?php

/**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../php-cs-fixer/shim/php-cs-fixer)
* using a stream wrapper to prevent the shebang from being output on PHP<8
*
* @generated
*/

namespace Composer;

$GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';

if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
/**
* @internal
*/
final class BinProxyWrapper
{
private $handle;
private $position;
private $realpath;

public function stream_open($path, $mode, $options, &$opened_path)
{
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 17);
$this->realpath = realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = fopen($this->realpath, $mode);
$this->position = 0;

return (bool) $this->handle;
}

public function stream_read($count)
{
$data = fread($this->handle, $count);

if ($this->position === 0) {
$data = preg_replace('{^#!.*\r?\n}', '', $data);
}

$this->position += strlen($data);

return $data;
}

public function stream_cast($castAs)
{
return $this->handle;
}

public function stream_close()
{
fclose($this->handle);
}

public function stream_lock($operation)
{
return $operation ? flock($this->handle, $operation) : true;
}

public function stream_seek($offset, $whence)
{
if (0 === fseek($this->handle, $offset, $whence)) {
$this->position = ftell($this->handle);
return true;
}

return false;
}

public function stream_tell()
{
return $this->position;
}

public function stream_eof()
{
return feof($this->handle);
}

public function stream_stat()
{
return array();
}

public function stream_set_option($option, $arg1, $arg2)
{
return true;
}

public function url_stat($path, $flags)
{
$path = substr($path, 17);
if (file_exists($path)) {
return stat($path);
}

return false;
}
}
}

if (
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
return include("phpvfscomposer://" . __DIR__ . '/..'.'/php-cs-fixer/shim/php-cs-fixer');
}
}

return include __DIR__ . '/..'.'/php-cs-fixer/shim/php-cs-fixer';
5 changes: 5 additions & 0 deletions tools/.php-cs-fixer/vendor/bin/php-cs-fixer.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=%~dp0/php-cs-fixer
SET COMPOSER_RUNTIME_BIN_DIR=%~dp0
php "%BIN_TARGET%" %*
Loading