Skip to content

Commit

Permalink
Commit generated code
Browse files Browse the repository at this point in the history
By doing this there is no error when composer installing or updating. This doesn't matter most of the time. But on slower hardware this is hella slow.
  • Loading branch information
WyriHaximus committed Dec 31, 2024
1 parent 8393144 commit d4ec151
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
var/*
!var/.gitkeep
src/Generated/*
!src/Generated/.gitkeep
vendor/
etc/qa/.phpunit.result.cache
Empty file removed src/Generated/.gitkeep
Empty file.
32 changes: 32 additions & 0 deletions src/Generated/AbstractList.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace Mammatus\Cron\Generated;

use Mammatus\Cron\Action;

// phpcs:disable
/**
* @internal
* Autogenerated file, do not edit. Changes will be overwritten on the next composer (install|update)
*/
abstract readonly class AbstractList
{
/** @return iterable<string, Action> */
final protected function crons(): iterable
{
/**
* @see \Mammatus\Cron\BuildIn\Noop
*
* @psalm-suppress MixedArgument Because we addOns argument comes from json_decode, Psalm doesn't like it. TODO: Drop the need for json_encode/json_decode
*/
yield 'internal-no.op-Mammatus-Cron-BuildIn-Noop' => new Action(
type: 'internal',
name: 'no.op',
schedule: '* * * * *',
class: \Mammatus\Cron\BuildIn\Noop::class,
addOns: \json_decode('[]', true), /** @phpstan-ignore-line */
);
}
}
41 changes: 41 additions & 0 deletions src/Generated/AbstractManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);

namespace Mammatus\Cron\Generated;

use WyriHaximus\React\Cron;
use WyriHaximus\React\Cron\Action;
use WyriHaximus\React\Mutex\Contracts\MutexInterface;

// phpcs:disable
/**
* @internal
* Autogenerated file, do not edit. Changes will be overwritten on the next composer (install|update)
*/
abstract class AbstractManager
{
private ?Cron $cron = null;

final protected function cron(MutexInterface $mutex): Cron
{
if ($this->cron instanceof Cron) {
return $this->cron;
}

$this->cron = Cron::createWithMutex(
$mutex,
/** @see \Mammatus\Cron\BuildIn\Noop */
new Action(
'cron_no.op',
120,
'* * * * *',
fn () => $this->perform(\Mammatus\Cron\BuildIn\Noop::class),
),
);

return $this->cron;
}

abstract protected function perform(string $class): void;
}

0 comments on commit d4ec151

Please sign in to comment.