Support for complex PHPDoc types in `fully_qualified_strict_types`
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) {}
Related with #5620, all fixes on types must be based on parsed TypeExpression.
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.
I also have a problem with this rule in this update. It removes the inline namespaces even when I use the same class with different namespaces.
Before:
use App\Actions\CreateUrl;
...
CreateUrl::run();
App\Actions\Folder1\CreateUrl::run();
App\Actions\Folder2\CreateUrl::run();
...
After:
use App\Actions\CreateUrl;
...
CreateUrl::run();
CreateUrl::run();
CreateUrl::run();
...
even unioned (A|B) and intersected (A&B) types are not supported
I plan to work on this after #7719
Since this issue has not had any activity within the last 90 days, I have marked it as stale.
The purpose of this action is to enforce backlog review once in a while. This is mostly for maintainers and helps with keeping repository in good condition, because stale issues and PRs can accumulate over time and make it harder for others to find relevant information. It is also possible that some changes has been made to the repo already, and issue or PR became outdated, but wasn't closed for some reason. This action helps with periodic review and closing of such stale items in automated way.
You may let maintainers handle this or verify current relevancy by yourself, to help with re-triage. Any activity will remove stale label so it won't be automatically closed at this point.
I will close it if no further activity occurs within the next 30 days.
Since this issue has not had any activity within the last 90 days, I have marked it as stale.
The purpose of this action is to enforce backlog review once in a while. This is mostly for maintainers and helps with keeping repository in good condition, because stale issues and PRs can accumulate over time and make it harder for others to find relevant information. It is also possible that some changes has been made to the repo already, and issue or PR became outdated, but wasn't closed for some reason. This action helps with periodic review and closing of such stale items in automated way.
You may let maintainers handle this or verify current relevancy by yourself, to help with re-triage. Any activity will remove stale label so it won't be automatically closed at this point.
I will close it if no further activity occurs within the next 30 days.