Skip to content

feat: Add method to manage withRouting options#61

Open
artengin wants to merge 80 commits into
masterfrom
create-addRoutingOption-method
Open

feat: Add method to manage withRouting options#61
artengin wants to merge 80 commits into
masterfrom
create-addRoutingOption-method

Conversation

@artengin

@artengin artengin commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

refs: #62

AZabolotnikov and others added 30 commits January 22, 2026 16:15
# Conflicts:
#	src/Visitors/PropertyVisitors/AbstractPropertyVisitor.php
…rate-withSchedule

# Conflicts:
#	src/Visitors/AppBootstrapVisitors/AbstractAppBootstrapVisitor.php

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

if ($this->isParentNode($node) && $this->shouldInsertNode($node)) {
return $this->insertNode($node);

P1 Badge Restrict parent-method edits to Application::configure chain

The generic parent-node rewrite path still runs on any method named withExceptions/withSchedule/withRouting, even when that call is not part of an Application::configure(...)->...->create() chain. In bootstrap/app.php files that contain another object with a same-named method (for example helper builders or factories), this visitor will mutate the unrelated call as well, which can silently alter behavior and produce incorrect generated code. Add the same bootstrap-chain guard used in the create branch before calling insertNode() on existing parent calls.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2e17f0f21d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/ValueOptions/ScheduleOption.php

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c80678846b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/Visitors/AppBootstrapVisitors/AbstractAppBootstrapVisitor.php
public string $method,
public array $arguments = [],
) {
$this->validateMethod($this->method);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate ScheduleOption argument arity during construction

ScheduleOption currently validates only method names, so options with required parameters can be constructed with empty arguments (e.g., new ScheduleOption('dailyAt') or new ScheduleOption('between')). The generator then emits calls like ->dailyAt() that are syntactically valid but fail with ArgumentCountError when Laravel evaluates the schedule callback. Adding required-parameter validation here would prevent generating broken bootstrap code.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The library is responsible for generating syntactically valid code, not for enforcing Laravel's runtime contracts. Ensuring correct arguments is the caller's responsibility, just as with any code generation tool.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0609ce7fbf

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/Visitors/AppBootstrapVisitors/AbstractAppBootstrapVisitor.php
@artengin

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f90a7991f2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/Support/ValueNodeFactory.php Outdated
Comment thread src/Visitors/AppBootstrapVisitors/AbstractAppBootstrapVisitor.php

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5d9abb8a46

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/Visitors/AppBootstrapVisitors/AddScheduleCommand.php Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

if ($this->isParentNode($node) && $this->shouldInsertNode($node)) {
return $this->insertNode($node);

P2 Badge Scope parent-call updates to the bootstrap chain

When the bootstrap file contains any other fluent call named withRouting, withSchedule, or withExceptions, this branch still updates that unrelated call because only the create() insertion path is guarded by isApplicationBootstrapChain(). For example, addRoutingOption('health', ...) will rewrite an $other->withRouting(...) call in the same file before/alongside the real Application::configure(...)->create() chain. Please apply the same chain check before calling insertNode() so unrelated builders are not mutated.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 043fac8155

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


protected function parsePHPCode(string $code): array
{
$nodes = new ParserFactory()->createForHostVersion()->parse("<?php\n{$code};");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve InvalidPHPCodeException for bad snippets

When a caller passes invalid preformatted code, for example an invalid renderBody to addExceptionsRender(), this shared parser now lets PhpParser\Error escape instead of translating it to the package's InvalidPHPCodeException as PreformattedCode did before. That breaks the public error contract and the existing invalid-body test/callers that catch InvalidPHPCodeException; wrap this parse in the same catch before returning the nodes.

Useful? React with 👍 / 👎.

);

foreach ($this->options as $option) {
$arguments = array_map(fn ($argument) => new Arg(NodeValueFactory::make($argument)->node), $option->arguments);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Emit callback option arguments as expressions

Fresh evidence beyond the earlier thread is that this version maps every schedule option argument through NodeValueFactory::make(), whose string branch builds a string literal, so raw snippets are not inserted as raw code. With new ScheduleOption('when', ['fn () => User::count() > 0']), the generated bootstrap contains ->when('fn () => User::count() > 0'); callback-based scheduler options such as when/skip then receive a non-callable string instead of the closure expression when the schedule is evaluated.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants