-
-
Notifications
You must be signed in to change notification settings - Fork 742
Closed
rectorphp/rector-src
#3288Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | 0.15.4 |
For files where the PHP open tag is not in the first line the \Rector\Config\RectorConfig::importNames() config will produce invalid code:
Minimal PHP Code Causing Issue
#!/usr/local/bin/php -q
<?php
require(__DIR__ . '/../../vendor/autoload.php');
$dotenv = \Dotenv\Dotenv::createUnsafeMutable(__DIR__ . '/../../');
$dotenv->load();
// ... more code ...
Current Behaviour
---------- begin diff ----------
@@ @@
+use Dotenv\Dotenv;
#!/usr/local/bin/php -q
<?php
@@ @@
require(__DIR__ . '/../../vendor/autoload.php');
-$dotenv = \Dotenv\Dotenv::createUnsafeMutable(__DIR__ . '/../../');
+$dotenv = Dotenv::createUnsafeMutable(__DIR__ . '/../../');
$dotenv->load();
// ... more code ...
----------- end diff -----------
Expected Behaviour
#!/usr/local/bin/php -q
<?php
use Dotenv\Dotenv;
require(__DIR__ . '/../../vendor/autoload.php');
$dotenv = Dotenv::createUnsafeMutable(__DIR__ . '/../../');
$dotenv->load();
// ... more code ...
Reactions are currently unavailable