Ruleset `fully_qualified_strict_types` is creating invalid code

Open
#17 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
32/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
php
Domain
tooling

Research direction

Start by reproducing the autofix against tests/integration/features/bootstrap/FeatureContext.php, especially the import at line 27 and the shown docblock. Then inspect the fully_qualified_strict_types rule and its tests; done means the global-namespace type remains valid without an unwanted leading backslash while the intended strict-type fix is preserved.

Written by the indexing model from the issue text.

Description

bug

Talk integration tests have this file which imports TableNode:
https://github.com/nextcloud/spreed/blob/0d1fc13e36e40a6cd8dfa80915ea77f06b835f80/tests/integration/features/bootstrap/FeatureContext.php#L27

But the autofixing is breaking the docs by adding a leading \ because the file itself has no namespace

@@ -914,9 +914,9 @@
 	 * @param string $user
 	 * @param string $identifier
 	 * @param string $apiVersion
-	 * @param TableNode|null $formData
+	 * @param \TableNode|null $formData
 	 */
-	public function userCreatesRoom(string $user, string $identifier, string $apiVersion, TableNode $formData = null): void {
+	public function userCreatesRoom(string $user, string $identifier, string $apiVersion, ?TableNode $formData = null): void {
 		$this->userCreatesRoomWith($user, $identifier, 201, $apiVersion, $formData);
 	}
 
Dominant language
PHP
Stars
14
Forks
2
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nextcloud/coding-standard

All issues in nextcloud/coding-standard

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.