Uh oh!
There was an error while loading. Please reload this page.
Styleci bridge - #21
Conversation
webmozart
commented
Oct 15, 2015
Thanks for this! :) |
There was a problem hiding this comment.
Risky fixers are not allowed by default on 2.x.
But it's possible you don't need it with your configuration. Will try and remove it if it's true.
webmozart
commented
Oct 15, 2015
When I try this, I get a:
with php-cs-fixer 1.10.1. Is this familiar? |
soullivaneuh
commented
Oct 15, 2015
Well, never get this error. Could you please give me the complete entered command and |
soullivaneuh
commented
Oct 15, 2015
I reproduced it but I didn't find where is the issue yet. You can avoid this error by setting |
soullivaneuh
commented
Oct 15, 2015
More strange thing, the error seems to come from your code: |
webmozart
commented
Oct 15, 2015
Ah, I just realized what the problem is. You are loading the project's autoloader in .php_cs, which may conflict with the libraries bundled with php-cs-fixer (and that seems to be the case right now). |
soullivaneuh
commented
Oct 16, 2015
Yes, this is needed to get the bridge working.
Yeah, but what I don't understand is the location of the error. Regarding php trace, it seems to provide from your code. That makes no sense to me. Any idea? |
soullivaneuh
commented
Oct 16, 2015
Well, I was wrong this is coming from Symfony vendor, not your code. But it's not an error from my lib call, this is hard to debug. |
a0327e5 to
a9e9d32Comparesoullivaneuh
commented
Oct 16, 2015
@webmozart Could you tell me if you still get this error with the following modification? If it's solved, I'll try to make a custom loader on my project to prevent this kind of things. |
a9e9d32 to
9d40846Comparesoullivaneuh
commented
Oct 16, 2015
@webmozart Should be ok this time. :-) I released a new patch version of the bridge with a custom loader to avoid this kind of conflicts. 👍 |
webmozart
commented
Oct 16, 2015
Nice, thanks :) How do you run PHP-CS-Fixer? The tool hangs for me.. there must be an infinite loop somewhere. |
webmozart
commented
Oct 16, 2015
Ah, no! Apparently it just takes a lot of network bandwidth and I'm on a slow connection right now. Why is that so? |
soullivaneuh
commented
Oct 16, 2015
The bridge does not download anything... Oo What is your command? Just run |
soullivaneuh
commented
Oct 20, 2015
ping @webmozart |
webmozart
commented
Oct 20, 2015
Hm, seems to work now. |
soullivaneuh
commented
Oct 20, 2015
I ensure you that no internet connection is done from the bridge. If you have some, this is from another library / tools. |
webmozart
commented
Oct 20, 2015
I just reviewed your autoload.php, but I don't get how this is different now. What's the point of this custom class loader? You are still forwarding everything to the project's autoloader, no? |
soullivaneuh
commented
Oct 20, 2015
Yes, but I only load needed classes on runtime. So, no conflict like you got. |
webmozart
commented
Oct 20, 2015
Can you explain this a bit more? I thought loading the classes at runtime was the purpose of Composer's autoloader? |
soullivaneuh
commented
Oct 20, 2015
I'm not an expert but I don't think so. Seems all classes are registered. That why the |
soullivaneuh
commented
Oct 20, 2015
BTW, this autoload is used only for php-cs-fixer. No side effect with your project. |
webmozart
commented
Oct 20, 2015
Registered, yes, but not loaded. Classes are only loaded when they are used (e.g. |
soullivaneuh
commented
Oct 26, 2015
Well, you're right, I asked Seldaek for more info. I think this is related to // autoload_real.php @generated by Composerclass ComposerAutoloaderInit065a5b652db51bcdb5d3d6134bf669ad
{
privatestatic$loader;
publicstaticfunctionloadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require__DIR__ . '/ClassLoader.php';
}
}
publicstaticfunctiongetLoader()
{
if (null !== self::$loader) {
returnself::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit065a5b652db51bcdb5d3d6134bf669ad', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit065a5b652db51bcdb5d3d6134bf669ad', 'loadClassLoader'));
$map = require__DIR__ . '/autoload_namespaces.php';
foreach ($mapas$namespace => $path) {
$loader->set($namespace, $path);
}
$map = require__DIR__ . '/autoload_psr4.php';
foreach ($mapas$namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require__DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register(true);
$includeFiles = require__DIR__ . '/autoload_files.php';
foreach ($includeFilesas$file) {
composerRequire065a5b652db51bcdb5d3d6134bf669ad($file);
}
return$loader;
}
}
functioncomposerRequire065a5b652db51bcdb5d3d6134bf669ad($file)
{
require$file;
}BTW, removing the |
soullivaneuh
commented
Oct 27, 2015
@webmozart I asked for that. Please see composer/composer#1493 (comment). |
theofidry
commented
Nov 14, 2015
@soullivaneuh any progress? |
soullivaneuh
commented
Nov 17, 2015
@theofidry for me the PR is ready. Waiting @webmozart confirmation since the question asked to Seldaek. |
9d40846 to
bb646cfComparebb646cf to
effd752Comparesoullivaneuh
commented
Jun 29, 2016
Hi @webmozart, going back to this old and tricky PR. :-) I removed the custom autoload requirement. Your issue mentioned in #21 (comment) looks to happen only when running php-cs-fixer from a global composer installation. Tries with the I would just recommend to use the I already have strange errors like this with composer globally installed tools. Recently with PHPUnit, telling me test passes when it should fail because I didn't require Ready to merge for my side. 👍 |
As discussed on Gitter.
cc @theofidry