This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 243825 - Copy paste does not import "use" statement
Summary: Copy paste does not import "use" statement
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-14 15:21 UTC by magnetik
Modified: 2014-04-14 15:21 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description magnetik 2014-04-14 15:21:27 UTC
Hi,

When editing Java, copy pasting codes between two files auto import the "import" statements at the beginning of the file.

This feature could be ported to PHP and copy pasting code with classes could automatically add the "use" statement to the file.


Example:

FILE A:
	<?php

	use Foo\Bar;

	class A
	{
		protected $member;
		
		function __construct()
		{
			$this->member = new Bar();
		}
	}
FILE B:
<?php

class B
{
}
?>
	
	
I select the constructor and copy it, and paste it in the class B in file B.

Result is :
<?php
	class B
	{
		function __construct()
		{
			$this->member = new Bar();
		}
	}

So it does not work.
	
EXPECTED result :
	<?php
	use Foo\Bar;

	class B
	{
		function __construct()
		{
			$this->member = new Bar();
		}
	}


This issue is like #155422 but for PHP.

Thanks