laravel/pint

Pint Removes Partial Imports

BrandonSurowiec opened this issue ยท 3 comments

Pint Version

1.10.5

PHP Version

8.1.18

Description

I have a partial namespace that I've imported in my local project, Slate\Fields. Pint thinks it is not in use and removes it, but I have many partial references like Fields\Html, which is perfectly valid PHP. I import partial namespaces to prevents me from having to import every FQCN like Slate\Fields\HTML. (I know, use an IDE to import them all...) Pint does not agree that it is in use. ๐Ÿ˜…

image

Steps To Reproduce

<?php

namespace App;

use Illuminate\Support;

class Example
{
    function example()
	{
	    return Support\Str::studly('pint');
	}
}

Run pint.

Heya. I can't reproduce this with latest pint. The example file stays the same for me.

@driesvints You're right.. I'm a noob. I need to remember that on the root namespace, any partial non-imported namespace inherits the root namespace so it expands just fine.. (Note to self, don't file bug reports in the middle of the night, go to sleep instead. ๐Ÿ˜‚)

@BrandonSurowiec don't worry about it ๐Ÿ™‚