Skip to content

Commit

Permalink
Update symfony flex recipes (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrech authored Oct 22, 2024
1 parent 764599d commit 61f0609
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 52 deletions.
8 changes: 6 additions & 2 deletions bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ 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_dir(dirname(__DIR__).'/vendor')) {
throw new LogicException('Dependencies are missing. Try running "composer install".');
}

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);
Expand Down
10 changes: 7 additions & 3 deletions bin/phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ if (!ini_get('date.timezone')) {
}

if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
if (PHP_VERSION_ID >= 80000) {
require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit';
} else {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
}
} else {
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
Expand Down
1 change: 1 addition & 0 deletions config/packages/monolog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ when@prod:
deprecation:
type: error_log
channels: [deprecation]
formatter: monolog.formatter.json
6 changes: 0 additions & 6 deletions config/packages/nelmio_security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ nelmio_security:
content_type:
nosniff: true

# forces Microsoft's XSS-Protection with
# its block mode
xss_protection:
enabled: true
mode_block: true

# Send a full URL in the `Referer` header when performing a same-origin request,
# only send the origin of the document to secure destination (HTTPS->HTTPS),
# and send no header to a less secure destination (HTTPS->HTTP).
Expand Down
2 changes: 0 additions & 2 deletions config/packages/routing.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
framework:
router:
utf8: true

# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
#default_uri: http://localhost
Expand Down
2 changes: 1 addition & 1 deletion config/packages/twig.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
twig:
default_path: '%kernel.project_dir%/templates'
file_name_pattern: '*.twig'
globals:
bugsnag_api_key: '%env(BUGSNAG_KEY)%'
bugsnag_release_stage: '%env(BUGSNAG_STAGE)%'
Expand Down
2 changes: 0 additions & 2 deletions config/packages/validator.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
framework:
validation:
email_validation_mode: html5

# Enables validator auto-mapping support.
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
#auto_mapping:
Expand Down
4 changes: 3 additions & 1 deletion config/routes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ sitemap:
template: content/sitemap.xml.twig

controllers:
resource: ../src/Controller/
resource:
path: ../src/Controller/
namespace: JoliCode\SecretSanta\Controller
type: attribute
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ parameters:

# Make tests analyses working with Symfony's PHPUnit bridge
bootstrapFiles:
- vendor/bin/.phpunit/phpunit-9.5-0/vendor/autoload.php
- vendor/bin/.phpunit/phpunit-9.6-0/vendor/autoload.php

typeAliases:
ContextData: '''
Expand Down
6 changes: 1 addition & 5 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
<server name="SYMFONY_PHPUNIT_VERSION" value="9.5" />
<server name="SYMFONY_PHPUNIT_VERSION" value="9.6" />
</php>

<testsuites>
Expand All @@ -33,10 +33,6 @@
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>

<!-- Run `composer require symfony/panther` before enabling this extension -->
<!--
<extensions>
<extension class="Symfony\Component\Panther\ServerExtension" />
</extensions>
-->
</phpunit>
53 changes: 28 additions & 25 deletions symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,16 @@
"version": "2.3.5"
},
"nelmio/security-bundle": {
"version": "2.4",
"version": "3.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"branch": "main",
"version": "2.4",
"ref": "65726efb67ff51d89de38195bc0d230fa811f64d"
}
"ref": "71045833e4f882ad9de8c95fe47efb99a1eec2f7"
},
"files": [
"config/packages/nelmio_security.yaml"
]
},
"netresearch/jsonmapper": {
"version": "v1.6.0"
Expand Down Expand Up @@ -202,12 +205,12 @@
"version": "v6.0.0"
},
"symfony/console": {
"version": "5.3",
"version": "7.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"branch": "main",
"version": "5.3",
"ref": "da0c8be8157600ad34f10ff0c9cc91232522e047"
"ref": "1781ff40d8a17d87cf53f8d4cf0c8346ed2bb461"
},
"files": [
"bin/console"
Expand Down Expand Up @@ -271,12 +274,12 @@
"version": "v6.0.1"
},
"symfony/framework-bundle": {
"version": "6.1",
"version": "7.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "5.4",
"ref": "3cd216a4d007b78d8554d44a5b1c0a446dab24fb"
"version": "7.0",
"ref": "6356c19b9ae08e7763e4ba2d9ae63043efc75db5"
},
"files": [
"config/packages/cache.yaml",
Expand Down Expand Up @@ -314,12 +317,12 @@
"version": "v6.0.1"
},
"symfony/monolog-bundle": {
"version": "3.8",
"version": "3.10",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "3.7",
"ref": "213676c4ec929f046dfde5ea8e97625b81bc0578"
"ref": "aff23899c4440dd995907613c1dd709b6f59503f"
},
"files": [
"config/packages/monolog.yaml"
Expand All @@ -332,12 +335,12 @@
"version": "v6.0.1"
},
"symfony/phpunit-bridge": {
"version": "5.3",
"version": "7.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "5.3",
"ref": "97cb3dc7b0f39c7cfc4b7553504c9d7b7795de96"
"branch": "main",
"version": "6.3",
"ref": "a411a0480041243d97382cac7984f7dce7813c08"
},
"files": [
".env.test",
Expand Down Expand Up @@ -374,12 +377,12 @@
"version": "v6.0.0"
},
"symfony/routing": {
"version": "6.1",
"version": "7.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.1",
"ref": "a44010c0d06989bd4f154aa07d2542d47caf5b83"
"version": "7.0",
"ref": "21b72649d5622d8f7da329ffb5afb232a023619d"
},
"files": [
"config/packages/routing.yaml",
Expand Down Expand Up @@ -417,25 +420,25 @@
"version": "v6.0.1"
},
"symfony/twig-bundle": {
"version": "6.1",
"version": "7.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "5.4",
"ref": "bb2178c57eee79e6be0b297aa96fc0c0def81387"
"version": "6.4",
"ref": "cab5fd2a13a45c266d45a7d9337e28dee6272877"
},
"files": [
"config/packages/twig.yaml",
"templates/base.html.twig"
]
},
"symfony/validator": {
"version": "6.1",
"version": "7.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "5.3",
"ref": "c32cfd98f714894c4f128bb99aa2530c1227603c"
"version": "7.0",
"ref": "8c1c4e28d26a124b0bb273f537ca8ce443472bfd"
},
"files": [
"config/packages/validator.yaml"
Expand Down
2 changes: 1 addition & 1 deletion templates/base.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en" xmlns:og="http://ogp.me/ns#">
<head>
<meta charset="utf-8">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=2">
Expand Down
8 changes: 5 additions & 3 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@

require dirname(__DIR__) . '/vendor/autoload.php';

if (file_exists(dirname(__DIR__) . '/config/bootstrap.php')) {
require dirname(__DIR__) . '/config/bootstrap.php';
} elseif (method_exists(Dotenv::class, 'bootEnv')) {
if (method_exists(Dotenv::class, 'bootEnv')) {
(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
}

if ($_SERVER['APP_DEBUG']) {
umask(0o000);
}

0 comments on commit 61f0609

Please sign in to comment.