A minor typo meant grid tables didn't end correctly, causing many subsequent lines to be considered as part of the table. This caused 646 random errors while rendering the Symfony documentation (as the first 2 characters of each subsequent line was stripped, this created weird reSt syntax).
Fixes #253
Auto wiring in Symfony is very scoped. In https://symfony.com/doc/current/service_container/autowiring.html, I think we explain quite explicitly in which cases it works, rather than listing all cases where it does not work.
Again, I also still do not understand what behavior would have been expected in your example. Knowing this can help us understanding if we can add it, if we should improve the documentation or if there is nothing to be done.
For example: Would you have expected Symfony to infer the value of $arguments
based on the types in the parent constructor?
Autowiring needs information to know what it has to wire. mixed ...$arguments
doesn't hold any information (like, which types are expected, how many arguments are expected, etc). I can't see autowiring ever supporting something like that.
Please provide a full minimal reproducer of your use-case + what would be expected.
-1 this is not about consistent or not. You don't want to resolve parameters inside the password value, whereas you want to do that in paths.
Hi! This topic has been discussed a couple times before already. Your posts does a good job in describing an alternative "solution", but it doesn't really explain the problem with the current situation
In #24168, we decided to add the ctype polyfill: PHP on Alpine - commonly used in containers - does not come with the ctype extension. The polyfill makes usage of the Symfony components in an Alpine container environment seamless.
In #31305, we discussed adding ext-*
requirements to the composer.json
. Given the many open questions in that issue, we've decided to not do this.
Unless something changed and we can add answers/arguments to either prior discussion, or there are good practical reasons to not require symfony/polyfill-ctype
, I'm -1 for changing this.
Add the Scheduler component
[Scheduler] Rework the component
[ErrorHandler] Fixed tests
minor #49707 [ErrorHandler] Fixed tests (lyrixx)
This PR was merged into the 6.3 branch.
[ErrorHandler] Fixed tests
| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR |
bb8b73ea22 [ErrorHandler] Fixed tests
feature #47112 [Messenger] Add a scheduler component (upyx, fabpot)
This PR was merged into the 6.3 branch.
[Messenger] Add a scheduler component
| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | no | License | MIT | Doc PR | TBD
There is no easy way to schedule periodical tasks. There are few useful tools which I touched:
They are complicated. They doesn't allow to set time with precision in seconds (at least it isn't easy). They require difficult tricks to set not linear periods (like on sunset in Tokyo). ~They are~ Part of them inefficient with infrequent tasks because resources are needed on every run (e.g. Kubernetes CronJob creates and destroes an entire container).
I use a custom transport of Messenger that generates messages periodically. It's a simple solution to run periodical jobs without external software. It's especially helpful in environments where additional runners are impossible or very painful (like Kubernetes). Configuration is very flexible and accurate, it's possible to configure any rules when to run or not to run.
Compared to crond
: there is no need to install something external, precision of schedule in microseconds instead of minutes, it's possible to set any periods.
# messenger.yaml
framework:
messenger:
transports:
schedule_default: 'schedule://default'
Few types of messages:
class SomeJob {}
class OtherJob {}
A handlers:
#[AsMessageHandler]
class SomeJobHandler {
public function __invoke(SomeJob $job) {
// do job or delegate it to other service
}
}
#[AsMessageHandler]
class OtherJobHandler {
public function __invoke(OtherJob $job) {
// do job or delegate it to other service
}
}
A schedules are provided by locators. It's possible to create many locators and/or provide many schedules by the same locator:
class ExampleLocator implements ScheduleLocatorInterface
{
public function get(string $id): ScheduleConfig
{
// once after an hour from now
$deferForAnHour = new \DatePeriod(
new \DateTimeImmutable('now'),
new \DateInterval('PT1H'),
1,
\DatePeriod::EXCLUDE_START_DATE
);
return (new ScheduleConfig())
->add(new OnceTrigger(new \DateTimeImmutable()), new WarmUpJob()) // once on every worker's start
->add(PeriodicalTrigger::create('P1D', '2022-01-01T03:00:00Z'), new SomeJob()) // every night at 3 a.m. (UTC)
->add(PeriodicalTrigger::fromPeriod($deferForAnHour), new OtherJob())
;
}
public function has(string $id): bool
{
return 'default' === $id;
}
}
To run schedule:
bin/console messenger:consume schedule_default
It's easy to run jobs manually:
#[AsCommand(name: 'some', description: 'Manually runs SomeJob')]
class SomeCommand extends Command {
public function __construct(private MessageBusInterface $bus) {
}
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->bus->dispatch(new SomeJob());
}
}
class GoodJob {
public function __construct(public readonly ?LoggerInterface $logger) {
}
}
#[AsMessageHandler]
class GoodHandler {
public function __construct(private readonly LoggerInterface $logger) {
}
public function __invoke(GoodJob $job){
// compute $result
($job->logger ?? $this->logger)->info('The result is: {result}', ['result' => $result])
}
}
#[AsCommand(name: 'job', description: 'Manually runs job')]
class SomeCommand extends Command {
public function __construct(private MessageBusInterface $bus) {
}
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->bus->dispatch(new GoodJob(new ConsoleLogger($output))); // result will be printed in console
}
}
A minimal configuration:
# messenger.yaml
framework:
messenger:
transports:
schedule_default: 'schedule://default'
More complex example:
# messenger.yaml
framework:
messenger:
transports:
schedule_default:
dsn: 'schedule://default'
options:
cache: 'app.cache'
lock: 'default'
Example HA configuration with redis:
framework:
cache:
default_redis_provider: '%env(REDIS_DSN)%'
lock:
redis: '%env(REDIS_DSN)%'
messenger:
transports:
schedule_default:
dsn: 'schedule://default'
options:
cache: 'cache.redis'
lock:
resource: 'redis'
ttl: 60
auto_release: true
None
This PR contains an implementation.
CHANGELOG
s & README
sa18127b789 [Scheduler] Rework the component 6d9311f087 Add the Scheduler component
explicitly set the HTTP method override option to false
minor #49715 [FrameworkBundle] explicitly set the HTTP method override option to false (xabbuh)
This PR was merged into the 6.2 branch.
[FrameworkBundle] explicitly set the HTTP method override option to false
| Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR |
489f9ca64d explicitly set the HTTP method override option to false
[Scheduler] Fix some minor bugs
Merge branch '6.2' into 6.3
[Scheduler] Remove unused variable in AddScheduleMessengerPass
minor #49717 [Scheduler] Remove unused variable in AddScheduleMessengerPass (onEXHovia)
This PR was merged into the 6.3 branch.
[Scheduler] Remove unused variable in AddScheduleMessengerPass
| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | n/a | License | MIT | Doc PR | n/a
09df772306 [Scheduler] Remove unused variable in AddScheduleMessengerPass
[Notifier] Add "retry" and "expire" options to Pushover bridge
minor #49695 [Notifier] Add "retry" and "expire" options to Pushover bridge (vlepeule)
This PR was squashed before being merged into the 6.3 branch.
[Notifier] Add "retry" and "expire" options to Pushover bridge
| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | -
Add "retry" and "expire" options to handle "Emergency Priority", according to Pushover API documentation :
To send an emergency-priority notification, the priority parameter must be set to 2 and the retry and expire parameters must be supplied.
2feabc641c [Notifier] Add "retry" and "expire" options to Pushover bridge
minor #49716 [Scheduler] Fix some minor bugs (fabpot)
This PR was merged into the 6.3 branch.
[Scheduler] Fix some minor bugs
| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | n/a | License | MIT | Doc PR | n/a
9fc7cf53dd [Scheduler] Fix some minor bugs
[WebProfilerBundle] replace helper with _self in serializer.html.twig
bug #49690 [WebProfilerBundle] replace helper with _self in serializer.html.twig (k0d3r1s)
This PR was merged into the 6.3 branch.
[WebProfilerBundle] replace helper with _self in serializer.html.twig
| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #49686 | License | MIT
While waiting for reply, here is a fix for bug in #49686.
Ashelper
was removed, now _self
must be used, these looks like forgotten places
b27aab980b [WebProfilerBundle] replace helper with _self in serializer.html.twig
Add CI check ensuring interfaces have return types
[Console] fix clear of section with question
Added condition to always return the real Authenticator
[Serializer] Replace the MissingConstructorArgumentsException class with MissingConstructorArgumentException
feat(property-access): allow escaping in PropertyPath
[Validator] Add a NoSuspiciousCharacters
constraint to validate a string is not a spoof attempt
[HttpFoundation] Deprecate passing invalid URI to Request::create
Fixes: #47084
Passing an invalid URI to Request::create triggers an undefined code path. In PHP7 the false value returned by parse_url would quietly be treated as a an array through type coercion leading to unexpected results. In PHP8 this triggers a deprecation exposing the bug.
[WebProfilerBundle] Tweak Mailer panel rendering
bug #49400 [WebProfilerBundle] Tweak Mailer panel rendering (1ed)
This PR was squashed before being merged into the 6.2 branch.
[WebProfilerBundle] Tweak Mailer panel rendering
| Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | -
Before
After
126678b9ae [WebProfilerBundle] Tweak Mailer panel rendering
improve deprecation message
do not drop embed label classes
[Messenger][Cache] fixed CallbackInterface support in async expiration handler
re-add missing use statement
fix tests
minor #49423 [Translation] fix tests (xabbuh)
This PR was merged into the 6.2 branch.
[Translation] fix tests
| Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR |
04d8cad01b fix tests
remove invalid test
minor #49424 [Notifier] remove invalid test (xabbuh)
This PR was merged into the 6.2 branch.
[Notifier] remove invalid test
| Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR |
cde3ab5726 remove invalid test
fix some version constraints
minor #49425 fix some version constraints (xabbuh)
This PR was merged into the 6.2 branch.
fix some version constraints
| Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR |
731d99c586 fix some version constraints
[WebProfilerBundle] Render original (not encoded) email headers
Merge branch '6.2' into 6.3
Do not register links as link targets
Not sure if it's 100% related to this one, but when rendering the Symfony docs on this branch (rebased on #252) there are some invalidly detected references.
Examples:
``choice``: renders one, two (default) or three select inputs (hour, minute,
everything after :
is detected as a single reference (there is no reference on the line).
When using different values for `model_timezone`_ and ``view_timezone``,
this whole line is detected as a single reference (instead of only model_timezone
)
**type**: ``integer`` **default**: Locale-specific (usually around ``3``)
Locale-specific (usually around ``3``)
is detected as reference
Securing by an Expression
gives an error "invalid cross reference: ecuring by an Expression"
The command and handler are extremely simple, but makes the usage API of this library a bit more tidy (the service generating the docs now only needs the CommandBus
, instead of CommandBus
+Compiler
).
Add CompileDocumentsCommand
I'm not aware of the 2 spaces rule, afaik the spec always talk about "indented lines" by which they mean "at least 1 space more than the current indentation level".
I would be in favor of strictly following Sphinx/reStructuredText, rather than improving upon them (for one, to make a transition easier for projects that still use Sphinx). I agree that indentation in reStructuredText is a bit of a bad DX - I've had to fix it multiple times in the Symfony docs as well - but that's an issue of the spec, and not this parser imho.
(red = <ol
>, blue = <dl>
, green = <blockquote>
)
I just threw all your examples in Sphinx and it looks like we're actually 100% spec compatible :)
I guess you mean OL everywhere you say UL :wink:
To make it more interesting: when I add whitelines, suddenly I do not get a DL, but a blockquote around the nested UL :)
This sounds expected to me. The only difference, syntactically, between a blockquote and a definition list is a blank line between the unindented and indented line in reSt.
When browsing the releases of any of the split repos (https://github.com/symfony/http-kernel/releases/tag/v6.0.6 for example), the link to the PR/issue doesn't exist, only the ID. This makes it more difficult to browse to the issue from these split repos.
This also impacts dependabot updates about symfony packages, because it does show the links, but the ID doesn't exist in the split repo, only in this main one, thus the link ends up with a 404.
No response
Thanks the feedback! I've forwarded this internally.
Let's close here, as it isn't (and never will be) actionable by the community.
Do not register links as link targets
The `...`_
syntax is a reference. The class was registering these as link targets in the meta. This resulted in many "duplicate link target" warnings when rendering the Symfony docs on 0.6 (as link targets cannot be duplicated across a project, but references can).
Interesting, I've been maintaining something similar (as a start of a symfony-tools/docs-builder port that uses this library) to better test out guides for the Symfony docs: https://github.com/wouterj/symfony-docs-guides/tree/main/lib/docs-builder
Fix compat with latest version + test references branch