kotfire/vscode-php-add-property

Superfluous spaces inserted in generated properties

Closed this issue · 3 comments

Hello

Thanks for releasing a new version with support for typed properties and maintaining this extension!

I noticed a small bug: two spaces are inserted between the type and the name of the property in the constructor:

<?php

/**
 * @var string
 */
private string $test;

/**
 * Constructor.
 * @param string $test
 */
public function __construct(string  $test)
{
    $this->test = $test;
}

There are two spaces between string and $test here.

I mainly noticed this since my linter complains about this.

This isn't a new bug since the latest release, but I figured I'd wait to report it as I thought it may have already been fixed in the new release :-).

Thanks!

Hey, thank you for opening this issue.

Could you provide the input file content and your settings so I can try to replicate it?

Thanks for your response and sure!

I can reproduce it with the following input file:

<?php

final class OfCourse
{
    /**
     * @var string
     */
    private string $myProp;
}

The cursor is on myProp when I select Add Existing PHP Property, which results in an additional space being generated.

My settings for this package:

"phpAddProperty.constructor.breakIntoMultilineIfLengthExceeded.enabled": true,
"phpAddProperty.constructor.docblock.enable": true,
"phpAddProperty.constructor.docblock.stopForDescription": false,
"phpAddProperty.constructor.docblock.withParameter": true,
"phpAddProperty.property.docblock.add": true,
"phpAddProperty.property.docblock.withParameter": true,
"phpAddProperty.property.docblock.multiline": true,
"phpAddProperty.property.types": true

Fixed in v1.1.0