Skip to content
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

Tweak php-cs-fixer config #1402

Merged
merged 4 commits into from
Feb 2, 2023
Merged
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 .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
'phpdoc_to_comment' => true,
'phpdoc_summary' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_separation' => true,
'phpdoc_separation' => ['skip_unlisted_annotations' => true],
'phpdoc_scalar' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_no_empty_return' => true,
Expand Down
2 changes: 2 additions & 0 deletions src/Analysers/TokenAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,8 @@ private function parseNamespaceList(array &$tokens, &$token, Context $parseConte

/**
* Parse a use statement.
*
* @param (int|mixed)[]|string $token
*/
private function parseUseStatement(array &$tokens, &$token, Context $parseContext): array
{
Expand Down
1 change: 1 addition & 0 deletions src/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public function __construct(?LoggerInterface $logger = null)
public function push(Generator $generator): void
{
$this->generator = $generator;
/* @phpstan-ignore-next-line */
if (class_exists(AnnotationRegistry::class, true) && method_exists(AnnotationRegistry::class, 'registerLoader')) {
// keeping track of &this->generator allows to 'disable' the loader after we are done;
// no unload, unfortunately :/
Expand Down
1 change: 1 addition & 0 deletions tests/Analysers/DocBlockParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function testParseContents(): void

public function testDeprecatedAnnotationWarning(): void
{
/* @phpstan-ignore-next-line */
if (!class_exists(AnnotationRegistry::class, true) || !method_exists(AnnotationRegistry::class, 'registerLoader')) {
$this->markTestSkipped('Not supported in doctrine/annotations v2');
}
Expand Down
4 changes: 2 additions & 2 deletions tests/GeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function testRemoveProcessor(): void
{
$generator = new Generator();
$processors = $generator->getProcessors();
$processor = function (Analysis $analysis) {
$processor = function (Analysis $analysis): void {
};
$generator->addProcessor($processor);
$generator->removeProcessor($processor);
Expand Down Expand Up @@ -137,7 +137,7 @@ public function configCases(): iterable
/**
* @dataProvider configCases
*/
public function testConfig(array $config, bool $expected)
public function testConfig(array $config, bool $expected): void
{
$generator = new Generator();
$this->assertOperationIdHash($generator, true);
Expand Down
4 changes: 2 additions & 2 deletions tests/OpenApiTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function getAnalyzer(): AnalyserInterface

public function assertOpenApiLogEntryContains(string $needle, string $message = ''): void
{
$this->expectedLogMessages[] = [function ($entry, $type) use ($needle, $message) {
$this->expectedLogMessages[] = [function ($entry, $type) use ($needle, $message): void {
if ($entry instanceof \Exception) {
$entry = $entry->getMessage();
}
Expand All @@ -114,7 +114,7 @@ public function assertOpenApiLogEntryContains(string $needle, string $message =
*/
protected function assertSpecEquals($actual, $expected, string $message = '', bool $normalized = false): void
{
$formattedValue = function ($value) {
$formattedValue = function ($value): string {
if (is_bool($value)) {
return $value ? 'true' : 'false';
}
Expand Down