Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,6 @@ docker-command: ## to run command shell in php container

docker-console: ## to run command with console symfony in php container
docker-compose exec -T php sh -c "bin/console $(c)"

docker-shell: ## to open a shell in the php container
docker-compose exec php bash
81 changes: 38 additions & 43 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"name": "bolt/core",
"type": "library",
"description": "🧿 Bolt 5 Core",
"description": "🧿 Bolt 6 Core",
"license": "MIT",
"require": {
"php": ">=8.1",
"php": ">=8.2",
"ext-json": "*",
"ext-mbstring": "*",
"ext-pdo": "*",
"composer-runtime-api": "^2",
"api-platform/core": "^2.6",
"api-platform/core": "^2.7",
"babdev/pagerfanta-bundle": "^4.5",
"beberlei/doctrineextensions": "^1.3",
"bolt/yaml-migrations": "^2.0",
"bolt/common": "^3.0.5",
"bolt/yaml-migrations": "^2.0",
"cocur/slugify": "^4.0",
"composer/composer": "^2.0",
"composer/package-versions-deprecated": "^1.11",
Expand All @@ -37,47 +37,46 @@
"nelmio/cors-bundle": "^2.1",
"nesbot/carbon": "^3.8",
"pagerfanta/doctrine-orm-adapter": "^4.7",
"php-translation/symfony-bundle": "^0.15",
"php-translation/symfony-bundle": "^0.16.1",
"phpdocumentor/reflection-docblock": "^5.3",
"psr/event-dispatcher": "^1.0",
"scienta/doctrine-json-functions": "^4.4",
"sensio/framework-extra-bundle": "^6.2",
"siriusphp/upload": "^4.0",
"squirrelphp/twig-php-syntax": "^1.6",
"symfony/asset": "^5.4",
"symfony/cache": "^5.4",
"symfony/console": "^5.4",
"symfony/debug-bundle": "^5.4",
"symfony/dependency-injection": "^5.4",
"symfony/dotenv": "^5.4",
"symfony/error-handler": "^5.4",
"symfony/event-dispatcher": "^5.4",
"symfony/expression-language": "^5.4",
"symfony/flex": "^1.17 || ^2.0",
"symfony/form": "^5.4",
"symfony/framework-bundle": "^5.4",
"symfony/http-client": "^5.4",
"symfony/mailer": "^5.4",
"symfony/mime": "^5.4",
"symfony/monolog-bridge": "^5.4",
"symfony/asset": "^6.4",
"symfony/cache": "^6.4",
"symfony/console": "^6.4",
"symfony/debug-bundle": "^6.4",
"symfony/dependency-injection": "^6.4",
"symfony/dotenv": "^6.4",
"symfony/error-handler": "^6.4",
"symfony/event-dispatcher": "^6.4",
"symfony/expression-language": "^6.4",
"symfony/flex": "^2.0",
"symfony/form": "^6.4",
"symfony/framework-bundle": "^6.4",
"symfony/http-client": "^6.4",
"symfony/mailer": "^6.4",
"symfony/mime": "^6.4",
"symfony/monolog-bridge": "^6.4",
"symfony/monolog-bundle": "^3.7",
"symfony/password-hasher": "^5.4",
"symfony/password-hasher": "^6.4",
"symfony/polyfill-php72": "^1.23",
"symfony/polyfill-php84": "^1.31",
"symfony/security-bundle": "^5.4",
"symfony/security-csrf": "^5.4",
"symfony/serializer": "^5.4",
"symfony/stopwatch": "^5.4",
"symfony/string": "^5.4",
"symfony/translation": "^5.4",
"symfony/twig-bridge": "^5.4",
"symfony/twig-bundle": "^5.4",
"symfony/validator": "^5.4",
"symfony/var-dumper": "^5.4",
"symfony/var-exporter": "^5.4",
"symfony/web-profiler-bundle": "^5.4",
"symfony/security-bundle": "^6.4",
"symfony/security-csrf": "^6.4",
"symfony/serializer": "^6.4",
"symfony/stopwatch": "^6.4",
"symfony/string": "^6.4",
"symfony/translation": "^6.4",
"symfony/twig-bridge": "^6.4",
"symfony/twig-bundle": "^6.4",
"symfony/validator": "^6.4",
"symfony/var-dumper": "^6.4",
"symfony/var-exporter": "^6.4",
"symfony/web-profiler-bundle": "^6.4",
"symfony/webpack-encore-bundle": "^2.2",
"symfony/yaml": "^5.4",
"symfony/yaml": "^6.4",
"symfonycasts/reset-password-bundle": "^1.9",
"twig/extra-bundle": "^3.3",
"twig/html-extra": "^3.3",
Expand All @@ -88,10 +87,6 @@
"webonyx/graphql-php": "^14.9",
"xemlock/htmlpurifier-html5": "^0.1.11"
},
"conflict": {
"doctrine/dbal": "^3.0",
"cocur/slugify": "4.5.0"
},
"require-dev": {
"ext-curl": "*",
"ext-pdo_sqlite": "*",
Expand All @@ -112,8 +107,8 @@
"phpunit/phpunit": "^9.6",
"rector/rector": "2.1.7",
"se/selenium-server-standalone": "^3.141",
"symfony/browser-kit": "^5.4",
"symfony/css-selector": "^5.4",
"symfony/browser-kit": "^6.4",
"symfony/css-selector": "^6.4",
"symplify/easy-coding-standard": "^12.5"
},
"config": {
Expand All @@ -132,7 +127,7 @@
"public-dir": "public",
"symfony": {
"allow-contrib": true,
"require": "^5.4"
"require": "^6.4"
}
},
"autoload": {
Expand Down
3 changes: 1 addition & 2 deletions config/bundles.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
\ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
DAMA\DoctrineTestBundle\DAMADoctrineTestBundle::class => ['test' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Expand All @@ -11,7 +11,6 @@
Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true],
Knp\DoctrineBehaviors\DoctrineBehaviorsBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['all' => true],
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Expand Down
1 change: 1 addition & 0 deletions config/packages/api_platform.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
api_platform:
metadata_backward_compatibility_layer: false
enable_swagger_ui: false # route redirected manually to /bolt/api
graphql:
graphiql:
Expand Down
3 changes: 0 additions & 3 deletions config/packages/framework_extra.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions config/routes/api_platform.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
api_platform:
resource: .
type: api_platform
prefix: /api

api_entrypoint:
path: '%bolt.backend_url%/api'
controller: api_platform.swagger.action.ui
4 changes: 0 additions & 4 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,3 @@ services:
class: Jasny\Twig\ArrayExtension
tags:
- { name: twig.extension }

Bolt\Api\ContentDataPersister:
decorates: 'api_platform.doctrine.orm.data_persister'

6 changes: 3 additions & 3 deletions config/services_bolt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ services:
Bolt\ConfigurationNoticesWidget\:
resource: '../vendor/bolt/configuration-notices-widget/src/*'
exclude: '../vendor/bolt/configuration-notices-widget/src/{Entity,Exception}'
Bolt\WeatherWidget\:
resource: '../vendor/bolt/weatherwidget/src/*'
exclude: '../vendor/bolt/weatherwidget/src/{Entity,Exception}'
Bolt\NewsWidget\:
resource: '../vendor/bolt/newswidget/src/*'
exclude: '../vendor/bolt/newswidget/src/{Entity,Exception}'
Bolt\WeatherWidget\:
resource: '../vendor/bolt/weatherwidget/src/*'
exclude: '../vendor/bolt/weatherwidget/src/{Entity,Exception}'
4 changes: 2 additions & 2 deletions docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# https://github.com/docker-library/php/blob/master/8.1/bookworm/fpm/Dockerfile
FROM php:8.1-fpm-bookworm
# https://github.com/docker-library/php/blob/master/8.2/bookworm/fpm/Dockerfile
FROM php:8.2-fpm-bookworm

ENV PHP_MEMORYLIMIT=2048M
ENV PHP_TIMEZONE=Europe/Warsaw
Expand Down
24 changes: 0 additions & 24 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -5509,30 +5509,6 @@
'count' => 1,
'path' => __DIR__ . '/src/Twig/Node/SetcontentNode.php',
];
$ignoreErrors[] = [
'message' => '#^Method Bolt\\\\Twig\\\\Notifications\\:\\:danger\\(\\) has no return type specified\\.$#',
'identifier' => 'missingType.return',
'count' => 1,
'path' => __DIR__ . '/src/Twig/Notifications.php',
];
$ignoreErrors[] = [
'message' => '#^Method Bolt\\\\Twig\\\\Notifications\\:\\:info\\(\\) has no return type specified\\.$#',
'identifier' => 'missingType.return',
'count' => 1,
'path' => __DIR__ . '/src/Twig/Notifications.php',
];
$ignoreErrors[] = [
'message' => '#^Method Bolt\\\\Twig\\\\Notifications\\:\\:success\\(\\) has no return type specified\\.$#',
'identifier' => 'missingType.return',
'count' => 1,
'path' => __DIR__ . '/src/Twig/Notifications.php',
];
$ignoreErrors[] = [
'message' => '#^Method Bolt\\\\Twig\\\\Notifications\\:\\:warning\\(\\) has no return type specified\\.$#',
'identifier' => 'missingType.return',
'count' => 1,
'path' => __DIR__ . '/src/Twig/Notifications.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot call method get\\(\\) on Illuminate\\\\Support\\\\Collection\\|null\\.$#',
'identifier' => 'method.nonObject',
Expand Down
6 changes: 4 additions & 2 deletions public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@
}

if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
Request::setTrustedProxies(
explode(',', $trustedProxies),
Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO ^ Request::HEADER_X_FORWARDED_HOST);
}

if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}

$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$kernel = new Kernel($_SERVER['APP_ENV'], (bool)$_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
Expand Down
32 changes: 30 additions & 2 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,51 @@

use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\Config\RectorConfig;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\Symfony\Bridge\Symfony\Routing\SymfonyRoutesProvider;
use Rector\Symfony\Contract\Bridge\Symfony\Routing\SymfonyRoutesProviderInterface;

return RectorConfig::configure()
->withCache('./var/cache/rector', FileCacheStorage::class)
->withPaths(['./src'])
->withImportNames()
->withParallel(timeoutSeconds: 180, jobSize: 10)
->withSymfonyContainerXml(__DIR__ . '/var/cache/dev/App_KernelDevDebugContainer.xml')
->withSymfonyContainerPhp(__DIR__ . '/tests/rector/symfony-container.php')
->withSymfonyContainerXml(__DIR__ . '/var/cache/dev/Bolt_KernelDevDebugContainer.xml')
->withSymfonyContainerPhp(__DIR__ . '/tests/symfony-container.php')
->registerService(SymfonyRoutesProvider::class, SymfonyRoutesProviderInterface::class)
->withPhpSets()
->withPreparedSets(
typeDeclarations: true,
symfonyCodeQuality: true,
)
->withComposerBased(
twig: true,
doctrine: true,
phpunit: true,
symfony: true,

)
->withSets([
DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,

])
->withRules([
\Rector\Symfony\Configs\Rector\ClassMethod\AddRouteAnnotationRector::class,
\Rector\Symfony\Symfony60\Rector\FuncCall\ReplaceServiceArgumentRector::class,
\Rector\Symfony\Symfony60\Rector\MethodCall\GetHelperControllerToServiceRector::class,
\Rector\Symfony\Symfony61\Rector\Class_\CommandConfigureToAttributeRector::class,
\Rector\Symfony\Symfony61\Rector\Class_\CommandPropertyToAttributeRector::class,
\Rector\Symfony\Symfony61\Rector\Class_\MagicClosureTwigExtensionToNativeMethodsRector::class,
\Rector\Symfony\Symfony61\Rector\StaticPropertyFetch\ErrorNamesPropertyToConstantRector::class,
\Rector\Symfony\Symfony62\Rector\Class_\MessageHandlerInterfaceToAttributeRector::class,
\Rector\Symfony\Symfony62\Rector\Class_\MessageSubscriberInterfaceToAttributeRector::class,
\Rector\Symfony\Symfony62\Rector\Class_\SecurityAttributeToIsGrantedAttributeRector::class,
\Rector\Symfony\Symfony62\Rector\ClassMethod\ClassMethod\ArgumentValueResolverToValueResolverRector::class,
\Rector\Symfony\Symfony62\Rector\ClassMethod\ParamConverterAttributeToMapEntityAttributeRector::class,
\Rector\Symfony\Symfony62\Rector\MethodCall\SimplifyFormRenderingRector::class,
\Rector\Symfony\Symfony63\Rector\Class_\ParamAndEnvAttributeRector::class,
\Rector\Symfony\Symfony63\Rector\Class_\SignalableCommandInterfaceReturnTypeRector::class
]
)
->withSkip([
Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector::class => [
Expand Down
29 changes: 16 additions & 13 deletions src/Api/ContentDataPersister.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
<?php

namespace Bolt\Api;

use ApiPlatform\Core\DataPersister\ContextAwareDataPersisterInterface;
use ApiPlatform\Doctrine\Common\State\PersistProcessor;
use ApiPlatform\Doctrine\Common\State\RemoveProcessor;
use ApiPlatform\Metadata\GraphQl\Operation;
use Bolt\Configuration\Config;
use Bolt\Configuration\Content\FieldType;
use Bolt\Entity\Content;
use Bolt\Repository\FieldRepository;

class ContentDataPersister implements ContextAwareDataPersisterInterface
readonly class ContentDataPersister
{
public function __construct(
private readonly ContextAwareDataPersisterInterface $decorated,
private readonly Config $config
private PersistProcessor $persistProcessor,
private RemoveProcessor $removeProcessor,
private Config $config
) {
}

public function supports($data, array $context = []): bool
{
return $this->decorated->supports($data, $context);
}

public function persist($data, array $context = []): void
public function persist($data): void
{
if ($data instanceof Content) {
$contentTypes = $this->config->get('contenttypes');
Expand All @@ -42,11 +40,16 @@
}
}

$this->decorated->persist($data, $context);
$this->persistProcessor->process($data, new Operation());
}

public function remove($data): void
{
$this->removeProcessor->process($data, new Operation());
}

public function remove($data, array $context = []): void
public function process(mixed $data, \ApiPlatform\Metadata\Operation $operation, array $uriVariables = [], array $context = [])

Check failure on line 51 in src/Api/ContentDataPersister.php

View workflow job for this annotation

GitHub Actions / PHPStan - PHP 8.3

Method Bolt\Api\ContentDataPersister::process() has parameter $uriVariables with no value type specified in iterable type array.

Check failure on line 51 in src/Api/ContentDataPersister.php

View workflow job for this annotation

GitHub Actions / PHPStan - PHP 8.3

Method Bolt\Api\ContentDataPersister::process() has parameter $context with no value type specified in iterable type array.

Check failure on line 51 in src/Api/ContentDataPersister.php

View workflow job for this annotation

GitHub Actions / PHPStan - PHP 8.3

Method Bolt\Api\ContentDataPersister::process() has no return type specified.

Check failure on line 51 in src/Api/ContentDataPersister.php

View workflow job for this annotation

GitHub Actions / PHPStan - PHP 8.2

Method Bolt\Api\ContentDataPersister::process() has parameter $uriVariables with no value type specified in iterable type array.

Check failure on line 51 in src/Api/ContentDataPersister.php

View workflow job for this annotation

GitHub Actions / PHPStan - PHP 8.2

Method Bolt\Api\ContentDataPersister::process() has parameter $context with no value type specified in iterable type array.

Check failure on line 51 in src/Api/ContentDataPersister.php

View workflow job for this annotation

GitHub Actions / PHPStan - PHP 8.2

Method Bolt\Api\ContentDataPersister::process() has no return type specified.
{
$this->decorated->remove($data, $context);
// TODO: Implement process() method.
}
}
Loading
Loading