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 238152 - [Fix Uses] Applying fix uses breaks code
Summary: [Fix Uses] Applying fix uses breaks code
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-08 11:56 UTC by pmaselkowski
Modified: 2014-07-09 13:47 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Project with this bug (267.39 KB, application/x-zip-compressed)
2014-04-10 11:33 UTC, pmaselkowski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pmaselkowski 2013-11-08 11:56:28 UTC
Build: DEV: 201310210001

I have large php file with a lot of use statements. When I use "Fix uses" feature it put some part of `use` string just after php opening tag. Sometimes even in middle of file.

NOTE: File itself is not namespaced.

Additionally see note (don't know if it is related) on line 5.

Here is original `uses` part:

<?php

use Doctrine\ORM\EntityManager;
use Models\ClientsClient;
use Models\ClientsClientPollingAnswer; <-- NOTE: This line have also `els` letters in wrong color (gray, should be cyan)
use Models\WSDL\AddConfirmationsChange;
use Models\WSDL\AddCustomer;
use Models\WSDL\AddCustomerBankAccount;
use Models\WSDL\AddPersonData;
use Models\WSDL\CancelDisposition;
use Models\WSDL\ChangePersonData;
use Models\WSDL\ContactDataXMLType;
use Models\WSDL\CustomerBankAccountXMLType;
use Models\WSDL\CustomerConfirmationDeliveryType;
use Models\WSDL\CustomerListItemXMLType;
use Models\WSDL\DataListParamsXMLType;
use Models\WSDL\DispositionConfirmationFrequencyXMLType;
use Models\WSDL\DispositionInfoXMLType;
use Models\WSDL\DispositionListItemDTOXMLType;
use Models\WSDL\DispositionnDeliveryTypeXMLType;
use Models\WSDL\DispositionType;
use Models\WSDL\DispositionStatus;
use Models\WSDL\DispositionXMLType;
use Models\WSDL\GetDisposition;
use Models\WSDL\GetDispositionList;
use Models\WSDL\GetPerson;
use Models\WSDL\GetRegisterList;
use Models\WSDL\OrderDirection;
use Models\WSDL\PersonDataBaseXMLType;
use Models\WSDL\RegisterIndividual;
use Models\WSDL\Services\Customers;
use Models\WSDL\Services\Dispositions;
use Models\WSDL\Services\Transactions;
use Models\WSDL\Sex;
use Models\WSDL\SuitabilityTestInvestmentAmount;
use Models\WSDL\SuitabilityTestInvestmentFrequency;
use Models\WSDL\SuitabilityTestResult;
use Models\WSDL\SuitabilityTestXMLType;

In the code I added following line:

$data = new SearchPerson;

Which resolves to Models\WSDL\SearchPerson

After applying "Fix uses" it results in:

<?phpstItemDTOXMLTypeager;
use Models\ClientsClient;
use Models\ClientsClientCustomer;
use Models\ClientsClientPollingAnswer;
use Models\WSDL\AddConfirmationsChange;
use Models\WSDL\AddCustomer;
use Models\WSDL\AddCustomerBankAccount;
use Models\WSDL\AddPersonData;
use Models\WSDL\CancelDisposition;
use Models\WSDL\ChangePersonData;
use Models\WSDL\ContactDataXMLType;
use Models\WSDL\CustomerBankAccountXMLType;
use Models\WSDL\CustomerConfirmationDeliveryType;
use Models\WSDL\CustomerListItemXMLType;
use Models\WSDL\DataListParamsXMLType;
use Models\WSDL\DispositionConfirmationFrequencyXMLType;
use Models\WSDL\DispositionInfoXMLType;
use Models\WSDL\DispositionListItemDTOXMLType;
use Models\WSDL\DispositionnDeliveryTypeXMLType;
use Models\WSDL\DispositionStatus;
use Models\WSDL\DispositionType;
use Models\WSDL\DispositionXMLType;
use Models\WSDL\GetDisposition;
use Models\WSDL\GetDispositionList;
use Models\WSDL\GetPerson;
use Models\WSDL\GetRegisterList;
use Models\WSDL\OrderDirection;
use Models\WSDL\PersonDataBaseXMLType;
use Models\WSDL\RegisterIndividual;
use Models\WSDL\SearchPerson;
use Models\WSDL\Services\Customers;
use Models\WSDL\Services\Dispositions;
use Models\WSDL\Services\Transactions;
use Models\WSDL\Sex;
use Models\WSDL\SuitabilityTestInvestmentAmount;
use Models\WSDL\SuitabilityTestInvestmentFrequency;
use Models\WSDL\SuitabilityTestResult;
use Models\WSDL\SuitabilityTestXMLType;
Comment 1 Ondrej Brejla 2013-11-08 14:27:44 UTC
Hmm...really strange. I didn't met such a behavior. Can you attach a sample project, where it can be reproduced? Thanks.

That coloring issue will probably not be related, there will be something wrong with editor infrastructure probably. You are using dev [1] builds? If not, try it there, thanks.

[1] http://bits.netbeans.org/download/trunk/nightly/latest/
Comment 2 pmaselkowski 2013-11-12 12:20:43 UTC
Im using dev builds, just upgraded to Build 201311120002 (previously 201310210001), problem still persists.

Unfortunatelly i can't attach project. I'll try to build some minimal test project where this occurs.
Comment 3 Ondrej Brejla 2013-12-03 09:59:42 UTC
Incomplete until test project provided. Thanks.
Comment 4 pmaselkowski 2014-04-10 11:33:27 UTC
Created attachment 146669 [details]
Project with this bug

Finally stumbled upon this bug again with smaller project and managed to isolate it. It is still apearing in netbeans 8.

Steps to reproduce:
1. Open attached project
2. Open WebUser.php
3. Apply "Fix uses". Window with 5 proposals should pop
4. Click OK
5. After applying uses part of code is broken and causes parse error in php

Also attached screenshots in zip file.
Comment 5 Ondrej Brejla 2014-07-09 13:47:18 UTC
Works properly in the dev build. Has been fixed earlier.