-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setup the fixtures for the Symfony support #271
Conversation
/cc @TomasVotruba IIRC you were the one needing the Symfony support the most for Rector or other :) |
This would be great 👍 :) Indeed, mainly for At the moment I have to do it with regular expression like this: https://github.com/rectorphp/prefixer/blob/a10a2a005673e72b4beec4f4611b3b5651e2ca92/src/Worker/PrefixConfigsWorker.php#L29-L33 I still need it for |
dcc3c57
to
9e76ab8
Compare
Let's go with the YAML and XML support first. The PHP one should already somewhat be there and for the Neon one I'm not sure but I'll be happy to add it afterwards. |
Agreed 👍 , I'd be to happy to test it ASAP. As for prefixing Symfony WTFs, I've found that container dump needs to be prefixed extra, since it's string: https://github.com/rectorphp/prefixer/blob/master/src/PrefixFixer.php#L50-L61 |
Yeah I noticed too. I couldn’t test on all versions of the container but I
added a patcher (the SymfonyPatcher) to deal with that.
The patcher is always registered. It’s defined in a way that should not be
an issue but if is problematic maybe an option to disable it will be
required in the future
…On Wed 31 Oct 2018 at 09:43, Tomáš Votruba ***@***.***> wrote:
Agreed, I'd be to happy to test it ASAP.
As for Symfony WTFs, I've found that container dump needs to be prefixed
extra, since it's string:
https://github.com/rectorphp/prefixer/blob/master/src/PrefixFixer.php#L50-L61
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#271 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AE76gQk25oVOzgQwVpqgvuKB9kfhBkYaks5uqWK5gaJpZM4X80U5>
.
|
I'm giving this try after year and still end up with same error. Here is the code we use: rectorphp/rector#2373 Autoconfigure configs are not prefixed: services:
_defaults:
public: true
autowire: true
Rector\NetteToSymfony\:
resource: '../src'
exclude:
- '../src/Rector/**/*Rector.php'
- '../src/Route/RouteInfo.php'
- '../src/Event/EventInfo.php' They should be with services:
_defaults:
public: true
autowire: true
Rector\NetteToSymfony\:
resource: 'phar://../src'
exclude:
- 'phar://../src/Rector/**/*Rector.php'
- 'phar://../src/Route/RouteInfo.php'
- 'phar://../src/Event/EventInfo.php' Because when I run: ../tmp/rector.phar I get this error: [ERROR] The
"phar:///var/www/rector/tmp/rector.phar/src/HttpKernel/../../config/../packages/
NetteToSymfony/config/../src/Route/RouteInfo.php" directory does not exist in
phar:///var/www/rector/tmp/rector.phar/src/HttpKernel/../../config/../packages/
NetteToSymfony/config/config.yaml (which is being imported from
"phar:///var/www/rector/tmp/rector.phar/src/HttpKernel/../../config/config.yaml"). It's interesting this fails only on exclude and not on resource I vaguelly recall it was somehow fixed in Symfony, but exclude might have been missed |
Box version 3.8.3@43f13de 2019-11-03 17:18:32 UTC |
After short exploration... it seems it's another Symfony bug. This was similar fix, might be related: symfony/symfony@b61c8fc |
@TomasVotruba it's been a while so I may remember wrong, but it looks weird to me. The bug you report makes sense to me in the context of the bundled application, i.e. the PHAR of Rector, compiles its containers. This should not happen, see https://github.com/humbug/box/blob/master/doc/symfony.md#symfony-support for a more detailed explanation as to why |
It's a Symfony bug: https://github.com/symfony/symfony/blob/c62bb82e27974ef4e389da523f0de451b6632266/src/Symfony/Component/Finder/Finder.php#L589 Not sure where exactly it stars thought |
It might be but I'm point is the reason why you're hitting that bug in the first place might be the real issue here, at least for your case. If the Symfony compiler compiles within the PHAR, it can never work because the PHAR is supposed to be read only (cf. the doc linked above) |
Oh. So what would be the solution? |
There are no assets, just services |
I'm not really following how that is related. I'm suggesting - I don't know if that's the real issue, that when you package Rector in the PHAR and then use it, because it has not been packaged "properly" (as a Symfony app requires a bit more tweaking up-front), it attemps to compile the container which will 200% fail and will never ever work by design. A PHAR is a ready-only environment so compiling the container which dumps various files in its cache directory won't work out. The suggestions in the article are to prevent that:
The article is a "standard" way to do so with a regular minimal Symfony app (and is tested within Box). It might however need adjustments depending on how you use the framework |
Rector doesn't have any env variables. That's why I don't get it. There were 2 issues with Symfony config resource/exclude bugs in PHAR. Nothing more yet. I've found saint workarounds that compensate bugs. Finally the container is build and app run, yay: Now more testing is coming :) |
Closes #182