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
39 changes: 13 additions & 26 deletions .github/workflows/split_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,29 @@ jobs:
PHP_EXTENSIONS: 'pdo_sqlite, openswoole, pkcs11'
PHP_EXTENSIONS_CACHE_KEY: cache-extensions-pdo_sqlite-openswoole-pkcs11
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v4
-
name: 'Setup cache environment'
- name: 'Setup cache environment'
id: cache-extensions
uses: shivammathur/cache-extensions@v1
with:
php-version: 8.4
extensions: '${{ env.PHP_EXTENSIONS }}'
key: '${{ env.PHP_EXTENSIONS_CACHE_KEY }}'
-
name: 'Cache extensions'
- name: 'Cache extensions'
uses: actions/cache@v4
with:
path: '${{ steps.cache-extensions.outputs.dir }}'
key: '${{ steps.cache-extensions.outputs.key }}'
-
name: 'Setup PHP 8.4'
- name: 'Setup PHP 8.4'
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
coverage: none
extensions: '${{ env.PHP_EXTENSIONS }}'
-
name: 'Install Composer dependencies'
- name: 'Install Composer dependencies'
uses: ramsey/composer-install@v3
-
id: output_data
- id: output_data
run: 'echo "matrix=$(bin/monorepo export-packages)" >> $GITHUB_OUTPUT'
outputs:
matrix: '${{ steps.output_data.outputs.matrix }}'
Expand All @@ -56,30 +50,23 @@ jobs:
DIR: 'packages/${{ matrix.mapping.dir }}'
TAG: '${{ matrix.tag }}'
steps:
-
uses: actions/checkout@v4
-
run: 'git fetch --prune --unshallow'
-
name: 'Remove Git Extra Header'
- uses: actions/checkout@v4
- run: 'git fetch --prune --unshallow'
- name: 'Remove Git Extra Header'
run: 'git config -l | grep ''http\..*\.extraheader'' | cut -d= -f1 | xargs -L1 git config --unset-all'
-
name: 'Resolve current branch'
- name: 'Resolve current branch'
id: branch_name
run: 'echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT'
-
name: 'Add Repo Remote'
- name: 'Add Repo Remote'
run: 'git remote add split-remote https://natepage:${{ secrets.MONOREPO_GITHUB_TOKEN }}@github.com/eonx-com/${{ matrix.mapping.repo }}.git'
-
name: 'Split packages/${{ matrix.mapping.dir }}'
- name: 'Split packages/${{ matrix.mapping.dir }}'
env:
BRANCH: '${{ steps.branch_name.outputs.branch }}'
run: |
git checkout -b "local-$BRANCH-checkout" "$BRANCH"
git subtree split --prefix="packages/${{ matrix.mapping.dir }}" --branch="local-$BRANCH" "$BRANCH"
git push --force split-remote local-$BRANCH:$BRANCH
-
if: "contains(github.event.head_commit.message, '[Release]')"
- if: "contains(github.event.head_commit.message, '[Release]')"
name: 'Release eonx-com/${{ matrix.mapping.repo }}:${{ matrix.tag }}'
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"illuminate/routing": "^11.0",
"jetbrains/phpstorm-attributes": "^1.0",
"laravel/framework": "^11.44.1",
"laravel/lumen-framework": "^11.0",
"laravel/lumen-framework": "^11.2",
"league/commonmark": "^2.7",
"mockery/mockery": "^1.6",
"natepage/php-pkcs11-ide-helper": "^1.0",
Expand Down
2 changes: 1 addition & 1 deletion monorepo/Application/MonorepoApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

final class MonorepoApplication extends Application
{
public const TAG_COMMAND = 'console.command';
public const string TAG_COMMAND = 'console.command';

/**
* @param iterable<\Symfony\Component\Console\Command\Command> $commands
Expand Down
6 changes: 3 additions & 3 deletions monorepo/Command/CleanUpPackagesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ protected function execute(InputInterface $input, OutputInterface $output): int

private function getComposerLockFiles(): Finder
{
return (new Finder())
return new Finder()
->in([__DIR__ . '/../../packages'])
->files()
->name('composer.lock');
}

private function getVarDirs(): Finder
{
return (new Finder())
return new Finder()
->in([__DIR__ . '/../../packages'])
->directories()
->name('var');
}

private function getVendorDirs(): Finder
{
return (new Finder())
return new Finder()
->in([__DIR__ . '/../../packages'])
->directories()
->name('vendor');
Expand Down
2 changes: 1 addition & 1 deletion monorepo/Command/ExportPackagesAsJsonCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

private function getComposerJsonFiles(): Finder
{
return (new Finder())
return new Finder()
->in([__DIR__ . '/../../packages'])
->name('composer.json');
}
Expand Down
2 changes: 1 addition & 1 deletion monorepo/Command/GlobalizePackageRepositoriesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private function getComposerJsonFileContents(SplFileInfo $composerJsonFile): arr

private function getComposerJsonFiles(): Finder
{
return (new Finder())
return new Finder()
->in([__DIR__ . '/../../packages'])
->name('composer.json');
}
Expand Down
2 changes: 1 addition & 1 deletion monorepo/Command/LocalizePackageRepositoriesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private function getComposerJsonFileContents(SplFileInfo $composerJsonFile): arr

private function getComposerJsonFiles(): Finder
{
return (new Finder())
return new Finder()
->in([__DIR__ . '/../../packages'])
->name('composer.json');
}
Expand Down
2 changes: 1 addition & 1 deletion monorepo/Kernel/MonorepoKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

final class MonorepoKernel extends Kernel
{
public const NAMESPACE = 'EonX\\EasyMonorepo\\';
public const string NAMESPACE = 'EonX\\EasyMonorepo\\';

/**
* @return \Symfony\Component\HttpKernel\Bundle\BundleInterface[]
Expand Down
4 changes: 2 additions & 2 deletions monorepo/ReleaseWorker/PackagesListInReadmeReleaseWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

final readonly class PackagesListInReadmeReleaseWorker implements ReleaseWorkerInterface
{
private const GITHUB_URL = 'https://github.com/';
private const string GITHUB_URL = 'https://github.com/';

private Filesystem $filesystem;

Expand Down Expand Up @@ -45,7 +45,7 @@ public function work(Version $version): void

private function getPackagesList(): iterable
{
$composerFiles = (new Finder())
$composerFiles = new Finder()
->in([__DIR__ . '/../../packages'])
->name('composer.json')
->sortByName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

final readonly class UpdateTagInGithubWorkflowReleaseWorker implements ReleaseWorkerInterface
{
private const WORKFLOW_FILENAME = __DIR__ . '/../../.github/workflows/split_packages.yml';
private const string WORKFLOW_FILENAME = __DIR__ . '/../../.github/workflows/split_packages.yml';

private Filesystem $filesystem;

Expand Down
9 changes: 5 additions & 4 deletions packages/EasyActivity/bundle/EasyActivityBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ public function prependExtension(ContainerConfigurator $container, ContainerBuil
/** @var array $resolvedConfigs */
$resolvedConfigs = $resolvingBag->resolveValue($configs);

$config = (new Processor())->processConfiguration(
new Configuration($this, $builder, $this->extensionAlias),
$resolvedConfigs
);
$config = new Processor()
->processConfiguration(
new Configuration($this, $builder, $this->extensionAlias),
$resolvedConfigs
);

$easyDoctrinePrependedConfig = [
'deferred_dispatcher_entities' => \array_diff(\array_keys($config['subjects']), $easyDoctrineEntities),
Expand Down
2 changes: 2 additions & 0 deletions packages/EasyActivity/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ The [ActivityLogEntry class][2] defines the data that can be recorded in an acti
See [Usage][3] for information on using the EasyActivity package.

[1]: config.md

[2]: activity-log-entry.md

[3]: usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

final readonly class DefaultActivitySubjectDataResolver implements ActivitySubjectDataResolverInterface
{
public const CONTEXT_KEY_SUBJECT_DATA_SERIALIZATION = 'easy_activity_subject_data_serialization';
public const string CONTEXT_KEY_SUBJECT_DATA_SERIALIZATION = 'easy_activity_subject_data_serialization';

public const CONTEXT_KEY_SUBJECT_OLD_DATA_SERIALIZATION = 'easy_activity_subject_old_data_serialization';
public const string CONTEXT_KEY_SUBJECT_OLD_DATA_SERIALIZATION = 'easy_activity_subject_old_data_serialization';

public function __construct(
private ActivitySubjectDataSerializerInterface $serializer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

final readonly class DefaultActorResolver implements ActorResolverInterface
{
public const DEFAULT_ACTOR_TYPE = 'system';
public const string DEFAULT_ACTOR_TYPE = 'system';

public function resolve(object $object): ActorInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

final readonly class ActivityLogEntryMessage implements WithLockDataInterface
{
private const LOCK_RESOURCE = 'activity_log_%s_%s';
private const string LOCK_RESOURCE = 'activity_log_%s_%s';

private const LOCK_TTL_SEC = 3600.0;
private const float LOCK_TTL_SEC = 3600.0;

public function __construct(
private ActivityLogEntry $logEntry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ final class CircularReferenceHandlerTest extends AbstractUnitTestCase
{
public function testInvokeSucceedsWithId(): void
{
$article = (new Article())->setId((string)(new NilUuid()));
$article = new Article()
->setId((string)(new NilUuid()));
/** @var \EonX\EasyActivity\Common\CircularReferenceHandler\CircularReferenceHandlerInterface $sut */
$sut = self::getService(ConfigServiceId::CircularReferenceHandler->value);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public function testCreateSucceeds(): void

$result = $sut->create(
ActivityAction::Create,
(new Article())->setId((string)(new NilUuid())),
new Article()
->setId((string)(new NilUuid())),
['title' => [null, 'New Title']]
);

Expand Down Expand Up @@ -95,13 +96,13 @@ public function testCreateSucceedsWithCollections(): void
{
self::bootKernel(['environment' => 'default_subject_config']);
$sut = self::getService(ActivityLogEntryFactoryInterface::class);
$comment1 = (new Comment())
$comment1 = new Comment()
->setId((string)(new NilUuid()))
->setMessage('Test 1');
$comment2 = (new Comment())
$comment2 = new Comment()
->setId('00000000-0000-0000-0000-000000000001')
->setMessage('Test 2');
$article = (new Article())
$article = new Article()
->setId('00000000-0000-0000-0000-000000000002')
->setTitle('Related objects')
->setContent('Content')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public static function provideDataForSerializeSucceeds(): iterable
'expectedResult' => '{"author":{"name":"John Doe"},"content":"text"}',
];

$comment = (new Comment())
$comment = new Comment()
->setId((string)(new NilUuid()))
->setMessage('some-message');
$article = new Article();
Expand Down Expand Up @@ -204,7 +204,7 @@ public static function provideDataForSerializeSucceeds(): iterable
),
];

$authorExtra = (new AuthorExtra())
$authorExtra = new AuthorExtra()
->setPhone('1234567890');

yield 'Default config with nested object' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function testLoggerDoesNothingWhenSubjectIsNotDefinedInConfig(): void
self::bootKernel();
$this->initDatabase();
$entityManager = self::getEntityManager();
$article = (new Article())
$article = new Article()
->setTitle('Resolver')
->setContent('Test actor resolver');
$entityManager->persist($article);
Expand Down Expand Up @@ -268,10 +268,14 @@ public function testLoggerSucceedsWithCollections(): void
$article = new Article();
$article->setTitle('Test collections');
$article->setContent('Content');
$commentA = (new Comment())->setMessage('comment 1');
$commentB = (new Comment())->setMessage('comment 2');
$commentC = (new Comment())->setMessage('comment 3');
$commentD = (new Comment())->setMessage('comment 4');
$commentA = new Comment()
->setMessage('comment 1');
$commentB = new Comment()
->setMessage('comment 2');
$commentC = new Comment()
->setMessage('comment 3');
$commentD = new Comment()
->setMessage('comment 4');
$article->addComment($commentA);
$article->addComment($commentB);
$article->addComment($commentC);
Expand All @@ -287,7 +291,8 @@ public function testLoggerSucceedsWithCollections(): void
$entityManager->flush();
$commentA->setMessage('comment 1 updated');
$entityManager->flush();
$commentE = (new Comment())->setMessage('comment 5');
$commentE = new Comment()
->setMessage('comment 5');
$article->addComment($commentE);
$entityManager->flush();

Expand Down
19 changes: 7 additions & 12 deletions packages/EasyApiPlatform/bundle/EasyApiPlatformBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function loadExtension(array $config, ContainerConfigurator $container, C
public function prependExtension(ContainerConfigurator $container, ContainerBuilder $builder): void
{
/** @var string $apiPlatformBundleViewsFolder */
$apiPlatformBundleViewsFolder = (new FileLocator(__DIR__ . '/templates/bundles'))
$apiPlatformBundleViewsFolder = new FileLocator(__DIR__ . '/templates/bundles')
->locate('ApiPlatformBundle');

$builder->prependExtensionConfig('twig', [
Expand All @@ -63,17 +63,12 @@ public function prependExtension(ContainerConfigurator $container, ContainerBuil
]);

if ($this->isBundleEnabled('EasyErrorHandlerBundle', $builder)) {
$easyErrorHandlerEnabled = true;
/** @var array $config */
foreach ($builder->getExtensionConfig('easy_api_platform') as $config) {
if (($config['easy_error_handler']['enabled'] ?? true) !== true) {
$easyErrorHandlerEnabled = false;

break;
}
}

if ($easyErrorHandlerEnabled) {
$easyErrorHandlerDisabled = \array_any(
$builder->getExtensionConfig('easy_api_platform'),
// @phpstan-ignore offsetAccess.nonOffsetAccessible
static fn ($config): bool => ($config['easy_error_handler']['enabled'] ?? true) !== true
);
if ($easyErrorHandlerDisabled === false) {
$builder->prependExtensionConfig('api_platform', [
'defaults' => [
'denormalization_context' => [
Expand Down
6 changes: 3 additions & 3 deletions packages/EasyApiPlatform/bundle/config/definition.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
->children();

$easyErrorHandlerDefinition->append(
(new NodeBuilder())
new NodeBuilder()
->arrayNode('custom_serializer_exceptions')
->info('Custom serializer exceptions to be handled by '
. ApiPlatformErrorResponseBuilderInterface::class)
Expand All @@ -54,7 +54,7 @@
);

$easyErrorHandlerDefinition->append(
(new NodeBuilder())
new NodeBuilder()
->variableNode('validation_error_code')
->validate()
->ifTrue(
Expand All @@ -69,7 +69,7 @@

if (\class_exists(EasyBugsnagBundle::class)) {
$easyErrorHandlerDefinition->append(
(new NodeBuilder())
new NodeBuilder()
->booleanNode('report_exceptions_to_bugsnag')
->info('Report exceptions handled by '
. ApiPlatformErrorResponseBuilderInterface::class . ' to Bugsnag')
Expand Down
Loading
Loading