Hi,
I have tried all possible methods of install rector and only global composer rector-prefixed work, when I run this command:
rector process app src --level symfony30
the output is:
````
0/688 [鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 0%
In ProcessCommand.php line 138:
Processing of "app/cache/dev/appDevDebugProjectContainer.php" file failed.
In Broker.php line 189:
Class appDevDebugProjectContainer was not found while trying to analyse it - autoloading is probably not configured properly.
process [--dry-run] [--autoload-file AUTOLOAD-FILE] [--with-style] [--]
````
so, I removed cache and this time is:
````
0/686 [鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 0%
In ProcessCommand.php line 138:
Processing of "app/AppKernel.php" file failed.
In Broker.php line 189:
Class AppKernel was not found while trying to analyse it - autoloading is probably not configured properly.
process [--dry-run] [--autoload-file AUTOLOAD-FILE] [--with-style] [--]
````
My project is working Symfony 2.8 app and I have to upgrade it to 3.4... could you help?
Hi, exclude all the files that are temporary. I see app/cache/dev
See the docs: https://github.com/rectorphp/rector#exclude-paths-and-rectors
Also, prefered installation is composer dependency or Docker. global composer installation will result in false positives as the paths and behavior is very differnt from composer dependency.
As for prefixed Rector, it's WIP and it doesn't work yet, see: https://github.com/rectorphp/rector/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Awaits-on-prefixed
With docker it's not working too.
my rector.yml file:
yaml
parameters:
autoload_paths:
- 'vendor/autoload.php'
exclude_paths:
- 'app/cache/dev'
- '*/src/*/Tests/*'
When I run docker:
````
docker run -v $(pwd):/project rector/rector:latest process /project/src --level symfony30 --config /project/rector.yaml
Rector No version set (parsed as 1.0.0)@
Config file: /project/rector.yaml
0/1347 [鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 0%
134/1347 [鈻撯枔鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 9%
268/1347 [鈻撯枔鈻撯枔鈻撯枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 19%
402/1347 [鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 29%
536/1347 [鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 39%
670/1347 [鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 49%
804/1347 [鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 59%
938/1347 [鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 69%
1072/1347 [鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻戔枒鈻戔枒鈻戔枒] 79%
1206/1347 [鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枒鈻戔枒] 89%
1340/1347 [鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枒] 99%
1347/1347 [鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔] 100%
[ERROR] Could not process "/project/src/Dgcs/Store/AdminBundle/AdminEvents.php"
file, due to:
"Analyze error: "Class Dgcs\Store\AdminBundle\AdminEvents was not found
while trying to analyse it - autoloading is probably not configured
properly.". Include your files in "parameters > autoload_paths".
See https://github.com/rectorphp/rector#extra-autoloading".
````
and many other autoload error files
@cve did you ever get it working? I have exactly the same issue with the docker image with a symfony project and a very similar config to yours
@REBELinBLUE I didn't
Composer global install is not recomended, as the Rector code is not designed to run well in it
I wasn鈥檛 installing globally and I still had this issue
In that case it's different issue than first reported here.
Please create a new one with steps to reproduce.
@REBELinBLUE Any joy with this? Or was it just closed with no solution?
I didn't have any joy I'm afraid
All classes have to be autoloadable either with composer, or with Rector (see README).
If you're able to reproduce in standalone repository, I can help you.
Any Update on this?
I'm still getting a similiar error:
[ERROR] Could not process
"htdocs/typo3/web/typo3conf/ext/my_ext/Tests/Unit/Domain/Model/ModelTest.php"
file, due to:
"Analyze error: "Class My\Ext\Tests\Unit\Domain\Model\ModelTest was not
found while trying to analyse it - discovering symbols is probably not configured properly.". Include your
files in "$parameters->set(Option::AUTOLOAD_PATHS, [...]);" in "rector.php" config.
See https://github.com/rectorphp/rector#configuration".
rector.php
<?php
declare(strict_types=1);
use Rector\Core\Configuration\Option;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Ssch\TYPO3Rector\Set\Typo3SetList;
use Ssch\TYPO3Rector\Configuration\Typo3Option;
use Ssch\TYPO3Rector\PostRector\NameImportingPostRector;
use Ssch\TYPO3Rector\Rector\v9\v0\InjectAnnotationRector;
return static function (ContainerConfigurator $containerConfigurator): void {
// get parameters
$parameters = $containerConfigurator->parameters();
// Define what rule sets will be applied
$parameters->set(Option::SETS, [
Typo3SetList::TYPO3_104,
]);
// FQN classes are not imported by default. If you don't do it manually after every Rector run, enable it by:
$parameters->set(Typo3Option::AUTO_IMPORT_NAMES, true);
// this will not import root namespace classes, like \DateTime or \Exception
$parameters->set(Option::IMPORT_SHORT_CLASSES, true);
// this will not import classes used in PHP DocBlocks, like in /** @var \Some\Class */
$parameters->set(Option::IMPORT_DOC_BLOCKS, false);
// Define your target version which you want to support
$parameters->set(Option::PHP_VERSION_FEATURES, '7.4');
// If you would like to see the changelog url when a rector is applied
$parameters->set(Typo3Option::OUTPUT_CHANGELOG, true);
// If you set option Typo3Option::AUTO_IMPORT_NAMES to true, you should consider excluding some TYPO3 files.
$parameters->set(Option::SKIP, [
NameImportingPostRector::class => [
'ClassAliasMap.php',
'class.ext_update.php',
'ext_localconf.php',
'ext_emconf.php',
'ext_tables.php',
__DIR__ . '/**/TCA/*',
],
]);
// If you have trouble that rector cannot run because some TYPO3 constants are not defined add an additional constants file
// Have a look at https://github.com/sabbelasichon/typo3-rector/blob/master/typo3.constants.php
$parameters->set(Option::AUTOLOAD_PATHS, [
__DIR__ . '/htdocs/typo3/vendor/ssch/typo3-rector/typo3.constants.php',
__DIR__ . '/htdocs/typo3/vendor/autoload.php',
]);
};
composer.lock
{
"name": "xima-media/xm_skd_vermittlungsdatenbank",
"autoload": {
"psr-4": {
"My\\Ext\\": "Classes/"
}
},
"autoload-dev": {
"psr-4": {
"My\\Ext\\Tests\\": "Tests/"
}
},
...
},
...
Most helpful comment
With docker it's not working too.
my rector.yml file:
yaml parameters: autoload_paths: - 'vendor/autoload.php' exclude_paths: - 'app/cache/dev' - '*/src/*/Tests/*'When I run docker:
````
docker run -v $(pwd):/project rector/rector:latest process /project/src --level symfony30 --config /project/rector.yaml
Rector No version set (parsed as 1.0.0)@
Config file: /project/rector.yaml
134/1347 [鈻撯枔鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 9%
268/1347 [鈻撯枔鈻撯枔鈻撯枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 19%
402/1347 [鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 29%
536/1347 [鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 39%
670/1347 [鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 49%
804/1347 [鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 59%
938/1347 [鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 69%
1072/1347 [鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻戔枒鈻戔枒鈻戔枒] 79%
1206/1347 [鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枒鈻戔枒] 89%
1340/1347 [鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枒] 99%
1347/1347 [鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔] 100%
[ERROR] Could not process "/project/src/Dgcs/Store/AdminBundle/AdminEvents.php"
file, due to:
"Analyze error: "Class Dgcs\Store\AdminBundle\AdminEvents was not found
while trying to analyse it - autoloading is probably not configured
properly.". Include your files in "parameters > autoload_paths".
See https://github.com/rectorphp/rector#extra-autoloading".
````
and many other autoload error files