forked from SymfonyCasts/symfony-ux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpre-turbo-upgrading-recipes.diff
455 lines (442 loc) · 15.6 KB
/
pre-turbo-upgrading-recipes.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
diff --git a/bin/console b/bin/console
index 8fe9d49..c933dc5 100755
--- a/bin/console
+++ b/bin/console
@@ -3,41 +3,15 @@
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
-use Symfony\Component\Console\Input\ArgvInput;
-use Symfony\Component\Dotenv\Dotenv;
-use Symfony\Component\ErrorHandler\Debug;
-if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
- echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
+if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
+ throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}
-set_time_limit(0);
+require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
-require dirname(__DIR__).'/vendor/autoload.php';
+return function (array $context) {
+ $kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
-if (!class_exists(Application::class) || !class_exists(Dotenv::class)) {
- throw new LogicException('You need to add "symfony/framework-bundle" and "symfony/dotenv" as Composer dependencies.');
-}
-
-$input = new ArgvInput();
-if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
- putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
-}
-
-if ($input->hasParameterOption('--no-debug', true)) {
- putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
-}
-
-(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
-
-if ($_SERVER['APP_DEBUG']) {
- umask(0000);
-
- if (class_exists(Debug::class)) {
- Debug::enable();
- }
-}
-
-$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
-$application = new Application($kernel);
-$application->run($input);
+ return new Application($kernel);
+};
diff --git a/composer.json b/composer.json
index 7ec497e..11d9b6a 100644
--- a/composer.json
+++ b/composer.json
@@ -23,6 +23,7 @@
"symfony/property-access": "5.3.*",
"symfony/property-info": "5.3.*",
"symfony/proxy-manager-bridge": "5.3.*",
+ "symfony/runtime": "5.3.*",
"symfony/security-bundle": "5.3.*",
"symfony/serializer": "5.3.*",
"symfony/twig-bundle": "5.3.*",
diff --git a/composer.lock b/composer.lock
index e082575..d612fad 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "6ba98cd7ac74f3e02e0f1f2e11e397ca",
+ "content-hash": "ee6ab3f5a6a0751c72b2b9208e2e66c8",
"packages": [
{
"name": "composer/package-versions-deprecated",
@@ -4795,6 +4795,83 @@
],
"time": "2021-05-16T13:08:56+00:00"
},
+ {
+ "name": "symfony/runtime",
+ "version": "v5.3.0-RC1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/runtime.git",
+ "reference": "dc32e06d482c29bbdb55d6afd7fd5e4b6136d56c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/runtime/zipball/dc32e06d482c29bbdb55d6afd7fd5e4b6136d56c",
+ "reference": "dc32e06d482c29bbdb55d6afd7fd5e4b6136d56c",
+ "shasum": ""
+ },
+ "require": {
+ "composer-plugin-api": "^1.0|^2.0",
+ "php": ">=7.2.5",
+ "symfony/polyfill-php80": "^1.15"
+ },
+ "conflict": {
+ "symfony/dotenv": "<5.1"
+ },
+ "require-dev": {
+ "composer/composer": "^1.0.2|^2.0",
+ "symfony/console": "^4.4|^5",
+ "symfony/dotenv": "^5.1",
+ "symfony/http-foundation": "^4.4|^5",
+ "symfony/http-kernel": "^4.4|^5"
+ },
+ "type": "composer-plugin",
+ "extra": {
+ "class": "Symfony\\Component\\Runtime\\Internal\\ComposerPlugin"
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Runtime\\": "",
+ "Symfony\\Runtime\\Symfony\\Component\\": "Internal/"
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "[email protected]"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Enables decoupling PHP applications from global state",
+ "homepage": "https://symfony.com",
+ "support": {
+ "source": "https://github.com/symfony/runtime/tree/v5.3.0-RC1"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2021-05-09T17:16:51+00:00"
+ },
{
"name": "symfony/security-bundle",
"version": "v5.3.0-RC1",
diff --git a/config/packages/doctrine_migrations.yaml b/config/packages/doctrine_migrations.yaml
index 61e6612..a0a17a0 100644
--- a/config/packages/doctrine_migrations.yaml
+++ b/config/packages/doctrine_migrations.yaml
@@ -3,3 +3,4 @@ doctrine_migrations:
# namespace is arbitrary but should be different from App\Migrations
# as migrations classes should NOT be autoloaded
'DoctrineMigrations': '%kernel.project_dir%/migrations'
+ enable_profiler: '%kernel.debug%'
diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml
index cad7f78..7853e9e 100644
--- a/config/packages/framework.yaml
+++ b/config/packages/framework.yaml
@@ -2,7 +2,7 @@
framework:
secret: '%env(APP_SECRET)%'
#csrf_protection: true
- #http_method_override: true
+ http_method_override: false
# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.
@@ -10,8 +10,15 @@ framework:
handler_id: null
cookie_secure: auto
cookie_samesite: lax
+ storage_factory_id: session.storage.factory.native
#esi: true
#fragments: true
php_errors:
log: true
+
+when@test:
+ framework:
+ test: true
+ session:
+ storage_factory_id: session.storage.factory.mock_file
diff --git a/config/packages/prod/deprecations.yaml b/config/packages/prod/deprecations.yaml
index 920a061..60026a1 100644
--- a/config/packages/prod/deprecations.yaml
+++ b/config/packages/prod/deprecations.yaml
@@ -5,4 +5,4 @@
# deprecation:
# type: stream
# channels: [deprecation]
-# path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log"
+# path: php://stderr
diff --git a/config/packages/prod/monolog.yaml b/config/packages/prod/monolog.yaml
index bfe69c0..2c02ad8 100644
--- a/config/packages/prod/monolog.yaml
+++ b/config/packages/prod/monolog.yaml
@@ -8,8 +8,9 @@ monolog:
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
nested:
type: stream
- path: "%kernel.logs_dir%/%kernel.environment%.log"
+ path: php://stderr
level: debug
+ formatter: monolog.formatter.json
console:
type: console
process_psr_3_messages: false
diff --git a/config/packages/test/doctrine.yaml b/config/packages/test/doctrine.yaml
new file mode 100644
index 0000000..2ace640
--- /dev/null
+++ b/config/packages/test/doctrine.yaml
@@ -0,0 +1,4 @@
+doctrine:
+ dbal:
+ # "TEST_TOKEN" is typically set by ParaTest
+ dbname: 'main_test%env(default::TEST_TOKEN)%'
diff --git a/config/packages/test/framework.yaml b/config/packages/test/framework.yaml
deleted file mode 100644
index d051c84..0000000
--- a/config/packages/test/framework.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-framework:
- test: true
- session:
- storage_id: session.storage.mock_file
diff --git a/config/routes/dev/framework.yaml b/config/routes/dev/framework.yaml
deleted file mode 100644
index bcbbf13..0000000
--- a/config/routes/dev/framework.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-_errors:
- resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
- prefix: /_error
diff --git a/config/routes/framework.yaml b/config/routes/framework.yaml
new file mode 100644
index 0000000..0fc74bb
--- /dev/null
+++ b/config/routes/framework.yaml
@@ -0,0 +1,4 @@
+when@dev:
+ _errors:
+ resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
+ prefix: /_error
diff --git a/config/services.yaml b/config/services.yaml
index c7296dd..ef07b76 100644
--- a/config/services.yaml
+++ b/config/services.yaml
@@ -2,7 +2,7 @@
# Files in the packages/ subdirectory configure your dependencies.
# Put parameters here that don't need to change on each machine where the app is deployed
-# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
+# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters:
services:
@@ -21,11 +21,5 @@ services:
- '../src/Kernel.php'
- '../src/Tests/'
- # controllers are imported separately to make sure services can be injected
- # as action arguments even if you don't extend any base controller class
- App\Controller\:
- resource: '../src/Controller/'
- tags: ['controller.service_arguments']
-
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones
diff --git a/public/index.php b/public/index.php
index 3bcee0b..9982c21 100644
--- a/public/index.php
+++ b/public/index.php
@@ -1,22 +1,9 @@
<?php
use App\Kernel;
-use Symfony\Component\Dotenv\Dotenv;
-use Symfony\Component\ErrorHandler\Debug;
-use Symfony\Component\HttpFoundation\Request;
-require dirname(__DIR__).'/vendor/autoload.php';
+require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
-(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
-
-if ($_SERVER['APP_DEBUG']) {
- umask(0000);
-
- Debug::enable();
-}
-
-$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
-$request = Request::createFromGlobals();
-$response = $kernel->handle($request);
-$response->send();
-$kernel->terminate($request, $response);
+return function (array $context) {
+ return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
+};
diff --git a/symfony.lock b/symfony.lock
index ea59cff..3273540 100644
--- a/symfony.lock
+++ b/symfony.lock
@@ -33,16 +33,17 @@
"version": "v0.5.3"
},
"doctrine/doctrine-bundle": {
- "version": "2.0",
+ "version": "2.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
- "version": "2.0",
- "ref": "368794356c1fb634e58b38ad2addb36933f2e73e"
+ "version": "2.3",
+ "ref": "c9e656a395646ea4fad2bd3e2b3816028baf9026"
},
"files": [
"config/packages/doctrine.yaml",
"config/packages/prod/doctrine.yaml",
+ "config/packages/test/doctrine.yaml",
"src/Entity/.gitignore",
"src/Repository/.gitignore"
]
@@ -60,12 +61,12 @@
]
},
"doctrine/doctrine-migrations-bundle": {
- "version": "2.2",
+ "version": "3.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
- "version": "2.2",
- "ref": "baaa439e3e3179e69e3da84b671f0a3e4a2f56ad"
+ "version": "3.1",
+ "ref": "ee609429c9ee23e22d6fa5728211768f51ed2818"
},
"files": [
"config/packages/doctrine_migrations.yaml",
@@ -160,12 +161,12 @@
"version": "v5.2.1"
},
"symfony/console": {
- "version": "5.1",
+ "version": "5.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
- "version": "5.1",
- "ref": "c6d02bdfba9da13c22157520e32a602dbee8a75c"
+ "version": "5.3",
+ "ref": "da0c8be8157600ad34f10ff0c9cc91232522e047"
},
"files": [
"bin/console"
@@ -177,7 +178,7 @@
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.1",
- "ref": "f8863cbad2f2e58c4b65fa1eac892ab189971bea"
+ "ref": "0ce7a032d344fb7b661cd25d31914cd703ad445b"
},
"files": [
"config/packages/dev/debug.yaml"
@@ -229,19 +230,18 @@
"version": "v5.2.1"
},
"symfony/framework-bundle": {
- "version": "5.2",
+ "version": "5.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
- "version": "5.2",
- "ref": "6ec87563dcc85cd0c48856dcfbfc29610506d250"
+ "version": "5.3",
+ "ref": "8af7647cd89416f68e41df5c343a5e531d2bf025"
},
"files": [
"config/packages/cache.yaml",
"config/packages/framework.yaml",
- "config/packages/test/framework.yaml",
"config/preload.php",
- "config/routes/dev/framework.yaml",
+ "config/routes/framework.yaml",
"config/services.yaml",
"public/index.php",
"src/Controller/.gitignore",
@@ -273,12 +273,12 @@
"version": "v5.2.1"
},
"symfony/monolog-bundle": {
- "version": "3.3",
+ "version": "3.7",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
- "version": "3.3",
- "ref": "d7249f7d560f6736115eee1851d02a65826f0a56"
+ "version": "3.7",
+ "ref": "329f6a5ef2e7aa033f802be833ef8d1268dd0848"
},
"files": [
"config/packages/dev/monolog.yaml",
@@ -340,13 +340,16 @@
"config/routes.yaml"
]
},
+ "symfony/runtime": {
+ "version": "v5.3.0-beta4"
+ },
"symfony/security-bundle": {
- "version": "5.1",
+ "version": "5.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
- "version": "5.1",
- "ref": "0a4bae19389d3b9cba1ca0102e3b2bccea724603"
+ "version": "5.3",
+ "ref": "8b35bfc00a7716db4ca5a764a4b338476ca3a704"
},
"files": [
"config/packages/security.yaml"
@@ -444,7 +447,7 @@
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.9",
- "ref": "579d8de06df2ceb34d39e84e84c0c051b9b5ac68"
+ "ref": "9399a0bfc6ee7a0c019f952bca46d6a6045dd451"
},
"files": [
"assets/app.js",