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

Support for complex PHPDoc types in fully_qualified_strict_types #7619

Open
mvorisek opened this issue Dec 25, 2023 · 6 comments
Open

Support for complex PHPDoc types in fully_qualified_strict_types #7619

mvorisek opened this issue Dec 25, 2023 · 6 comments
Labels
kind/feature request topic/fqcn Fully Qualified Class Name usage and conversions topic/phpdoc PHPDoc tags, Doctrine Annotations etc.

Comments

@mvorisek
Copy link
Contributor

mvorisek commented Dec 25, 2023

Feature request

With the latest release - v3.42.0 - the fully_qualified_strict_types rule does fix some phpdoc to imported types, but not all.

The following code:

<?php

use DataTables;
use DataTables\Database;
use DataTables\Editor;
use DataTables\SearchPaneOptions;

/**
 * @param SearchPaneOptions|callable(Database, \DataTables\Editor): (array|bool) $spInput
 */
function searchPaneOptions($spInput = null) {}

is fixed to:

<?php

use DataTables\Database;
use DataTables\SearchPaneOptions;

/**
 * @param SearchPaneOptions|callable(Database, \DataTables\Editor): (array|bool) $spInput
 */
function searchPaneOptions($spInput = null) {}

applied rules: braces_position, no_unused_imports, single_line_empty_body

but I would expect the following result instead:

<?php

use DataTables\Database;
use DataTables\Editor;
use DataTables\SearchPaneOptions;

/**
 * @param SearchPaneOptions|callable(Database, Editor): (array|bool) $spInput
 */
function searchPaneOptions($spInput = null) {}
@mvorisek
Copy link
Contributor Author

mvorisek commented Dec 25, 2023

Related with #5620, all fixes on types must be based on parsed TypeExpression.

@Wirone
Copy link
Member

Wirone commented Dec 27, 2023

It's not a bug, because initial support for phpDoc was introduced only for simple tags, like @tag \F\Q\C\N. At any point it wasn't aiming for full phpDoc support. I am going to convert this into feature request.

@Wirone Wirone added kind/feature request topic/phpdoc PHPDoc tags, Doctrine Annotations etc. topic/fqcn Fully Qualified Class Name usage and conversions and removed kind/bug labels Dec 27, 2023
@Wirone Wirone changed the title fully_qualified_strict_types does not fix callable phpdoc Support for complex PHPDoc types in fully_qualified_strict_types Dec 27, 2023
@alexmandrikdev

This comment has been minimized.

@mvorisek
Copy link
Contributor Author

mvorisek commented Dec 31, 2023

even unioned (A|B) and intersected (A&B) types are not supported

@mvorisek
Copy link
Contributor Author

I plan to work on this after #7719

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature request topic/fqcn Fully Qualified Class Name usage and conversions topic/phpdoc PHPDoc tags, Doctrine Annotations etc.
Projects
None yet
Development

No branches or pull requests

3 participants