Skip to content

feat: improve API with newInstance method and optional FileUploadFactory#7

Merged
koriym merged 5 commits into1.xfrom
feature/newinstance-api-improvement
Jul 6, 2025
Merged

feat: improve API with newInstance method and optional FileUploadFactory#7
koriym merged 5 commits into1.xfrom
feature/newinstance-api-improvement

Conversation

@koriym
Copy link
Member

@koriym koriym commented Jul 6, 2025

Summary

  • Rename create() to newInstance() for clearer method naming and better API consistency
  • Make FileUploadFactory optional with automatic default instantiation for easier setup
  • Update README with comprehensive DI examples including TicketFactory and AddressService
  • Fix syntax errors in documentation and improve code examples

API Changes

Before

$input = $inputQuery->create(UserInput::class, $query);

After

$input = $inputQuery->newInstance(UserInput::class, $query);

DI Improvements

  • FileUploadFactory is now optional - automatically creates default instance if not provided
  • Simplified constructor usage while maintaining full DI flexibility

Documentation Enhancements

  • Added practical DI examples with TicketFactory and AddressService
  • Fixed markdown syntax errors
  • Improved code samples with real-world use cases
  • Added immutable object creation examples

Test Plan

  • All existing tests updated to use newInstance()
  • FileUpload functionality works with optional factory
  • DI examples compile and work correctly
  • Documentation renders properly without syntax errors

🤖 Generated with Claude Code

Summary by Sourcery

Replace the legacy create() method with newInstance(), make the FileUploadFactory optional by providing a default instance, update all code samples and tests to reflect the new API, and enrich the documentation with expanded DI examples and a comprehensive CSV import demo.

New Features:

  • Introduce newInstance() method in place of create() across the API
  • Allow FileUploadFactory to be optional with automatic default instantiation
  • Add a CSV import demo showcasing AgeGroup and AgeInput examples

Enhancements:

  • Simplify InputQuery constructor by removing mandatory FileUploadFactory dependency
  • Extend DI examples with TicketFactory and AddressService usage

Documentation:

  • Update README and all documentation to use newInstance() and include new DI and CSV examples
  • Fix markdown syntax errors and improve code samples throughout docs

Tests:

  • Update existing tests to call newInstance() instead of create()
  • Verify file upload functionality works with the optional FileUploadFactory

Summary by CodeRabbit

  • New Features

    • Introduced new classes for CSV input processing, including age group tracking and validated age input, enabling advanced CSV demo scenarios.
    • Added a comprehensive CSV processing demo with dependency injection and service integration.
    • Added interfaces and classes demonstrating complex input objects with dependency injection and validation.
    • Introduced a null implementation for file upload factory to handle missing optional dependencies.
  • Documentation

    • Updated all documentation and code examples to use newInstance() instead of create() for input object instantiation.
    • Enhanced examples with nested and dependency-injected input objects and removed outdated project metadata sections.
  • Bug Fixes

    • Improved .gitignore to exclude common OS and upload-related files from version control.
  • Refactor

    • Renamed the method for creating input objects from create() to newInstance() throughout the codebase and tests.
    • Simplified file upload factory method return types to a common abstract base class.
  • Tests

    • Updated all test cases to use the new newInstance() method for input creation.

- Rename create() to newInstance() for clearer method naming
- Make FileUploadFactory optional with automatic default instantiation
- Update README with comprehensive DI examples and newInstance usage
- Fix syntax errors in documentation
- Update tests and framework integration examples

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jul 6, 2025

Reviewer's Guide

This PR overhauls the input creation API by renaming the core method, simplifying file upload factory setup, updating all usage sites and tests, enriching documentation with new DI examples, and adding a comprehensive CSV demo module to illustrate advanced usage patterns.

Class diagram for InputQuery API changes

classDiagram
    class InputQueryInterface {
        +getArguments(ReflectionMethod method, array query): array
        -create(string class, array query): object
        +newInstance(string class, array query): object
    }
    class InputQuery {
        -InjectorInterface injector
        -FileUploadFactoryInterface|null fileUploadFactory
        +__construct(InjectorInterface injector, FileUploadFactoryInterface|null fileUploadFactory = null)
        +newInstance(string class, array query): object
        +getArguments(ReflectionMethod method, array query): array
    }
    InputQueryInterface <|.. InputQuery
    InputQuery o-- FileUploadFactoryInterface
    class FileUploadFactoryInterface
    class FileUploadFactory
    FileUploadFactoryInterface <|.. FileUploadFactory
Loading

Class diagram for new CSV demo domain types

classDiagram
    class CsvDemo {
        +process(FileUpload csvFile, string delimiter, bool hasHeader, string encoding, bool skipEmptyRows): array
        +dump(string name, string email, int age, string role, AgeGroup ageGroup): void
        +dump2(UserInput user, int email, AgeGroup ageGroup): void
    }
    class UserInput {
        +__construct(string name, string email, int age, AgeInput ageInput, bool isActive = true, AgeGroup ageGroup = null)
        +__toString(): string
        +name: string
        +email: string
        +age: int
        +ageInput: AgeInput
        +isActive: bool
        -ageGroup: AgeGroup
    }
    class AgeInput {
        +__construct(int age)
        +age: int
    }
    class AgeGroup {
        +addAge(?int age): void
        +getGroups(): array
        +getTotalCount(): int
        -groups: array
    }
    CsvDemo o-- UserInput
    UserInput o-- AgeInput
    UserInput o-- AgeGroup
    CsvDemo o-- AgeGroup
Loading

File-Level Changes

Change Details Files
Renamed create() to newInstance() across the codebase
  • Updated interface and core method signature from create() to newInstance()
  • Refactored internal calls (recursive object resolution and array input creation) to use newInstance()
  • Replaced all create() invocations in docs, tests, demos and README
src/InputQuery.php
src/InputQueryInterface.php
README.md
docs/prompts/usage-generator.md
docs/design/file-upload-integration.md
docs/design/design.md
docs/framework_integration.md
tests/InputQueryTest.php
tests/InputFileTest.php
tests/FileUploadTest.php
demo/run.php
demo/ArrayDemo.php
Made FileUploadFactory optional with default instantiation
  • Allowed null FileUploadFactory parameter in constructor
  • Initialized default FileUploadFactory instance when none provided
src/InputQuery.php
Enhanced documentation and DI examples
  • Added TicketFactoryInterface and AddressServiceInterface examples
  • Provided EventBookingInput DI scenario with validation logic
  • Fixed markdown syntax errors and improved code samples
README.md
Introduced a CSV demo module showcasing advanced Ray.InputQuery usage
  • Added CsvDemo, AgeGroup, UserInput and AgeInput classes under demo/csv
  • Configured DI container and processing logic for CSV import
  • Included run script demonstrating end-to-end CSV handling
demo/csv/CsvDemo.php
demo/csv/AgeGroup.php
demo/csv/UserInput.php
demo/csv/AgeInput.php
demo/csv/run.php

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link

coderabbitai bot commented Jul 6, 2025

Walkthrough

This update introduces a broad renaming of the create() method to newInstance() across the core InputQuery API, documentation, demos, and tests. It also adds new CSV demo files and input classes, enhances example code with dependency injection patterns, and updates the .gitignore to exclude OS and upload-related files.

Changes

File(s) Change Summary
.gitignore Added rules to ignore upload directories and common OS-generated files.
README.md, docs/design/design.md, docs/design/file-upload-integration.md,
docs/framework_integration.md, docs/prompts/usage-generator.md
Updated all documentation and code examples to use newInstance() instead of create(). Improved and expanded examples, removed some metadata sections.
src/InputQuery.php, src/InputQueryInterface.php Renamed the create method to newInstance in both implementation and interface. Allowed nullable FileUploadFactoryInterface in constructor.
demo/run.php, tests/FileUploadTest.php, tests/InputFileTest.php, tests/InputQueryTest.php Replaced all usages of create() with newInstance() in demos and tests.
demo/ArrayDemo.php Minor comment and whitespace changes.
demo/csv/AgeGroup.php, demo/csv/AgeInput.php, demo/csv/UserInput.php, demo/csv/CsvDemo.php, demo/csv/run.php Added new demo classes and script for CSV input processing, including service injection and domain validation.
src/FileUploadFactory.php, src/FileUploadFactoryInterface.php Changed return types of factory methods from union types to abstract base class AbstractFileUpload.
src/NullUploadFactory.php Added a null implementation of FileUploadFactoryInterface that throws exceptions if file upload package is missing.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant InputQuery
    participant InputObject
    participant FileUploadFactory (optional)
    participant ServiceContainer (optional)

    User->>InputQuery: newInstance(ClassName, inputData)
    InputQuery->>FileUploadFactory: (if file upload detected)
    InputQuery->>ServiceContainer: (if DI needed)
    InputQuery->>InputObject: Construct InputObject with converted input and injected services
    InputObject-->>InputQuery: Instance returned
    InputQuery-->>User: InputObject instance
Loading

Possibly related PRs

Poem

🐇
The method once called "create"
Now "newInstance" seals your fate.
Docs and tests all join the dance,
With CSV demos to enhance.
Ignore the clutter, let uploads be,
Ray.InputQuery hops on—code set free!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 21aede2 and a36e0f6.

📒 Files selected for processing (1)
  • composer-require-checker.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • composer-require-checker.json

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @koriym - I've reviewed your changes - here's some feedback:

  • Consider adding a create() alias (or deprecation shim) that delegates to newInstance() to ease migration for existing consumers instead of removing the old method outright.
  • Add an explicit test that constructs InputQuery without passing a FileUploadFactory to verify the default factory fallback is instantiated and works as expected.
  • The CSV demo and its supporting classes are quite large—consider extracting them into a separate demo or plugin repository to keep the core library focused and maintainable.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider adding a `create()` alias (or deprecation shim) that delegates to `newInstance()` to ease migration for existing consumers instead of removing the old method outright.
- Add an explicit test that constructs `InputQuery` without passing a `FileUploadFactory` to verify the default factory fallback is instantiated and works as expected.
- The CSV demo and its supporting classes are quite large—consider extracting them into a separate demo or plugin repository to keep the core library focused and maintainable.

## Individual Comments

### Comment 1
<location> `demo/ArrayDemo.php:67` </location>
<code_context>
 $controller->listUsers(...$args);

-// ArrayObject example
+// ArrayObject examplepi
 $method = new ReflectionMethod($controller, 'listUsersAsArrayObject');
 $args = $inputQuery->getArguments($method, $query);
</code_context>

<issue_to_address>
Typo in comment: 'examplepi' should likely be 'example'.

There's an extra 'pi' at the end of the comment that should be removed to avoid confusion.

Suggested implementation:

```
// ArrayObject example

```

```
$controller->listUsersAsArrayObject(...$args);

```
</issue_to_address>

### Comment 2
<location> `demo/csv/UserInput.php:36` </location>
<code_context>
+
+    public function __toString(): string
+    {
+        $age = $this->age ? " (Age: {$this->age})" : '';
+        $dept = $this->department ? " [{$this->department}]" : '';
+
</code_context>

<issue_to_address>
Potentially misleading age display for age=0.

Since age=0 is treated as falsy, it won't be displayed. Use an explicit check (e.g., isset or $this->age !== null) to ensure zero is shown if valid.
</issue_to_address>

### Comment 3
<location> `demo/csv/CsvDemo.php:94` </location>
<code_context>
+        $method2 = new \ReflectionMethod(self::class, 'dump2');
+        
+        // Step 4: Process each CSV row with Ray.InputQuery
+        foreach ($csvData as $row) {
+           // Raw CSV data transformed to associative array
+           $query = ['name' => $row[0], 'email' => $row[1], 'age' => $row[2], 'role' => $row[3]];
+           
+           // Ray.InputQuery creates arguments with automatic type conversion
+           $args1 = $inputQuery->getArguments($method1,$query);  // Primitive types approach
+           $args2 = $inputQuery->getArguments($method2,$query);  // Input object approach
+           
+           // Invoke methods with type-safe arguments
+           $method1->invokeArgs($this, $args1);
+           $method2->invokeArgs($this, $args2);
+        }
+        
</code_context>

<issue_to_address>
No check for empty or malformed CSV rows.

This could cause undefined index errors if a row is empty or has fewer than four columns. Please add a check to skip such rows.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
        // Step 4: Process each CSV row with Ray.InputQuery
        foreach ($csvData as $row) {
           // Raw CSV data transformed to associative array
           $query = ['name' => $row[0], 'email' => $row[1], 'age' => $row[2], 'role' => $row[3]];

           // Ray.InputQuery creates arguments with automatic type conversion
           $args1 = $inputQuery->getArguments($method1,$query);  // Primitive types approach
           $args2 = $inputQuery->getArguments($method2,$query);  // Input object approach

           // Invoke methods with type-safe arguments
           $method1->invokeArgs($this, $args1);
           $method2->invokeArgs($this, $args2);
        }
=======
        // Step 4: Process each CSV row with Ray.InputQuery
        foreach ($csvData as $row) {
            // Skip empty or malformed rows (must have at least 4 columns)
            if (!is_array($row) || count($row) < 4) {
                continue;
            }
            // Raw CSV data transformed to associative array
            $query = ['name' => $row[0], 'email' => $row[1], 'age' => $row[2], 'role' => $row[3]];

            // Ray.InputQuery creates arguments with automatic type conversion
            $args1 = $inputQuery->getArguments($method1,$query);  // Primitive types approach
            $args2 = $inputQuery->getArguments($method2,$query);  // Input object approach

            // Invoke methods with type-safe arguments
            $method1->invokeArgs($this, $args1);
            $method2->invokeArgs($this, $args2);
        }
>>>>>>> REPLACE

</suggested_fix>

### Comment 4
<location> `demo/csv/CsvDemo.php:115` </location>
<code_context>
+        $ageGroup = $addGroup->getGroups();
+        $ageGroup = array_unique($ageGroup);
+        echo "Age group: " . json_encode($ageGroup) . "\n";
+        exit;
+
+    }
</code_context>

<issue_to_address>
Use of exit in library/demo code may hinder integration.

Consider returning from the function instead of calling exit, so that script termination is controlled by the caller.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
        echo "Age group: " . json_encode($ageGroup) . "\n";
        exit;

    }
=======
        echo "Age group: " . json_encode($ageGroup) . "\n";
        return;

    }
>>>>>>> REPLACE

</suggested_fix>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

- Change fileUploadFactory property type to non-nullable
- Use explicit assignment instead of null coalescing assignment
- Maintains optional constructor parameter while ensuring type safety

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🧹 Nitpick comments (9)
.gitignore (1)

15-16: Redundant pattern for .DS_Store variants
*.DS_Store? is effectively covered by the standalone .DS_Store rule because a pattern without a slash already matches in every directory. The extra line adds no benefit and marginally clutters the file.

-.DS_Store?
src/InputQueryInterface.php (1)

24-32: Method renamed correctly with minor documentation suggestion

The interface method has been properly renamed from create to newInstance while maintaining the same signature and functionality.

Consider updating the docblock to align with the new method name:

-    /**
-     * Create object from query data
-     *
-     * @param class-string<T> $class
-     * @param Query           $query HTTP request data ($_POST, $_GET, etc.)
-     *
-     * @return T
-     */
+    /**
+     * Create new instance from query data
+     *
+     * @param class-string<T> $class
+     * @param Query           $query HTTP request data ($_POST, $_GET, etc.)
+     *
+     * @return T
+     */
demo/csv/run.php (4)

11-12: Remove extra blank line.

-
-
+

16-19: Remove unused imports.

The following classes are imported but not used in this file:

  • CsvFileInput
  • CsvToInputConverter
  • CsvUsersImport
 use Ray\InputQuery\Demo\CsvDemo;
-use Ray\InputQuery\Demo\CsvFileInput;
-use Ray\InputQuery\Demo\CsvToInputConverter;
-use Ray\InputQuery\Demo\CsvUsersImport;
 use Ray\InputQuery\InputQuery;

22-24: Simplify array parameter formatting.

-$csvFile = FileUpload::fromFile(__DIR__ . '/users.csv',[
-]);
+$csvFile = FileUpload::fromFile(__DIR__ . '/users.csv', []);

39-39: Add newline at end of file.

 echo "🔹 Clean separation of concerns\n";
+
demo/csv/UserInput.php (1)

30-31: Translate Japanese comment to English for consistency.

-        // 年齢グループに自動登録
+        // Automatically register with age group
         $this->ageGroup?->addAge($this->age);
demo/csv/CsvDemo.php (2)

99-100: Fix formatting: add space after comma in method calls.

-           $args1 = $inputQuery->getArguments($method1,$query);  // Primitive types approach
-           $args2 = $inputQuery->getArguments($method2,$query);  // Input object approach
+           $args1 = $inputQuery->getArguments($method1, $query);  // Primitive types approach
+           $args2 = $inputQuery->getArguments($method2, $query);  // Input object approach

139-139: Clarify age property access pattern.

The mixed access to age properties ($user->age vs $user->ageInput->age) is confusing and suggests unclear data structure.

-        echo "dump2: Name: $user->name Email: $user->email Age: {$user->ageInput->age}:{$user->age}\n";
+        echo "dump2: Name: $user->name Email: $user->email Age: {$user->age} (validated: {$user->ageInput->age})\n";

This makes it clearer that there are two age representations - the raw age and the validated age from the AgeInput object.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 137905a and a22e995.

⛔ Files ignored due to path filters (2)
  • demo/csv/tmp/saved.csv is excluded by !**/*.csv
  • demo/csv/users.csv is excluded by !**/*.csv
📒 Files selected for processing (18)
  • .gitignore (1 hunks)
  • README.md (8 hunks)
  • demo/ArrayDemo.php (2 hunks)
  • demo/csv/AgeGroup.php (1 hunks)
  • demo/csv/AgeInput.php (1 hunks)
  • demo/csv/CsvDemo.php (1 hunks)
  • demo/csv/UserInput.php (1 hunks)
  • demo/csv/run.php (1 hunks)
  • demo/run.php (8 hunks)
  • docs/design/design.md (2 hunks)
  • docs/design/file-upload-integration.md (3 hunks)
  • docs/framework_integration.md (1 hunks)
  • docs/prompts/usage-generator.md (3 hunks)
  • src/InputQuery.php (4 hunks)
  • src/InputQueryInterface.php (1 hunks)
  • tests/FileUploadTest.php (4 hunks)
  • tests/InputFileTest.php (11 hunks)
  • tests/InputQueryTest.php (22 hunks)
🧰 Additional context used
🧠 Learnings (14)
📓 Common learnings
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQueryInterface.php : InputQueryInterface must define getArguments(ReflectionMethod $method, array $query): array and create(string $class, array $query): object.
src/InputQueryInterface.php (4)
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQueryInterface.php : InputQueryInterface must define getArguments(ReflectionMethod $method, array $query): array and create(string $class, array $query): object.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters with #[Input] and object type, extract prefixed keys from flat query and recursively create nested objects.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters without #[Input] that can't be resolved by DI: use parameter default or throw exception.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters without #[Input], resolve them from the DI container, supporting #[Named] for scalar DI values.
demo/ArrayDemo.php (1)
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQueryInterface.php : InputQueryInterface must define getArguments(ReflectionMethod $method, array $query): array and create(string $class, array $query): object.
docs/prompts/usage-generator.md (8)
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Only depend on `ray/di` for `InjectorInterface`.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters without #[Input] that can't be resolved by DI: use parameter default or throw exception.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters without #[Input], resolve them from the DI container, supporting #[Named] for scalar DI values.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQueryInterface.php : InputQueryInterface must define getArguments(ReflectionMethod $method, array $query): array and create(string $class, array $query): object.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters with #[Input] and object type, extract prefixed keys from flat query and recursively create nested objects.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters with #[Input] but missing from query: use parameter default or null if allowed.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/**/*.php : Every parameter sourced from query data must have the #[Input] attribute.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Implement a reasonable recursion depth limit (e.g., 10 levels) to prevent infinite recursion in nested input resolution.
tests/InputFileTest.php (8)
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQueryInterface.php : InputQueryInterface must define getArguments(ReflectionMethod $method, array $query): array and create(string $class, array $query): object.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/**/*.php : Every parameter sourced from query data must have the #[Input] attribute.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters without #[Input] that can't be resolved by DI: use parameter default or throw exception.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/**/*.php : The #[Input] attribute must be applied to parameters, not classes.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/Attribute/Input.php : Attribute class Input must be defined as #[Attribute(Attribute::TARGET_PARAMETER)] in src/Attribute/Input.php.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters with #[Input] but missing from query: use parameter default or null if allowed.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters without #[Input], resolve them from the DI container, supporting #[Named] for scalar DI values.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters with #[Input] and object type, extract prefixed keys from flat query and recursively create nested objects.
docs/framework_integration.md (6)
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQueryInterface.php : InputQueryInterface must define getArguments(ReflectionMethod $method, array $query): array and create(string $class, array $query): object.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters without #[Input] that can't be resolved by DI: use parameter default or throw exception.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/**/*.php : Every parameter sourced from query data must have the #[Input] attribute.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters with #[Input] and object type, extract prefixed keys from flat query and recursively create nested objects.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters without #[Input], resolve them from the DI container, supporting #[Named] for scalar DI values.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters with #[Input] but missing from query: use parameter default or null if allowed.
tests/FileUploadTest.php (1)
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQueryInterface.php : InputQueryInterface must define getArguments(ReflectionMethod $method, array $query): array and create(string $class, array $query): object.
demo/run.php (5)
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQueryInterface.php : InputQueryInterface must define getArguments(ReflectionMethod $method, array $query): array and create(string $class, array $query): object.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters without #[Input] that can't be resolved by DI: use parameter default or throw exception.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters with #[Input] and object type, extract prefixed keys from flat query and recursively create nested objects.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters without #[Input], resolve them from the DI container, supporting #[Named] for scalar DI values.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Convert all query keys to camelCase, handling snake_case, kebab-case, and PascalCase.
tests/InputQueryTest.php (9)
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQueryInterface.php : InputQueryInterface must define getArguments(ReflectionMethod $method, array $query): array and create(string $class, array $query): object.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters with #[Input] and object type, extract prefixed keys from flat query and recursively create nested objects.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters without #[Input] that can't be resolved by DI: use parameter default or throw exception.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters with #[Input] but missing from query: use parameter default or null if allowed.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Convert all query keys to camelCase, handling snake_case, kebab-case, and PascalCase.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/**/*.php : Every parameter sourced from query data must have the #[Input] attribute.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters without #[Input], resolve them from the DI container, supporting #[Named] for scalar DI values.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/Attribute/Input.php : Attribute class Input must be defined as #[Attribute(Attribute::TARGET_PARAMETER)] in src/Attribute/Input.php.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/**/*.php : The #[Input] attribute must be applied to parameters, not classes.
docs/design/design.md (5)
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQueryInterface.php : InputQueryInterface must define getArguments(ReflectionMethod $method, array $query): array and create(string $class, array $query): object.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters with #[Input] and object type, extract prefixed keys from flat query and recursively create nested objects.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/**/*.php : Every parameter sourced from query data must have the #[Input] attribute.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters without #[Input] that can't be resolved by DI: use parameter default or throw exception.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters with #[Input] but missing from query: use parameter default or null if allowed.
demo/csv/AgeInput.php (4)
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/**/*.php : The #[Input] attribute must be applied to parameters, not classes.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/**/*.php : Every parameter sourced from query data must have the #[Input] attribute.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/Attribute/Input.php : Attribute class Input must be defined as #[Attribute(Attribute::TARGET_PARAMETER)] in src/Attribute/Input.php.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters without #[Input] that can't be resolved by DI: use parameter default or throw exception.
src/InputQuery.php (5)
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQueryInterface.php : InputQueryInterface must define getArguments(ReflectionMethod $method, array $query): array and create(string $class, array $query): object.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters without #[Input] that can't be resolved by DI: use parameter default or throw exception.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters with #[Input] but missing from query: use parameter default or null if allowed.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters with #[Input] and object type, extract prefixed keys from flat query and recursively create nested objects.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters without #[Input], resolve them from the DI container, supporting #[Named] for scalar DI values.
demo/csv/UserInput.php (8)
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/**/*.php : Every parameter sourced from query data must have the #[Input] attribute.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/**/*.php : The #[Input] attribute must be applied to parameters, not classes.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/Attribute/Input.php : Attribute class Input must be defined as #[Attribute(Attribute::TARGET_PARAMETER)] in src/Attribute/Input.php.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters with #[Input] and object type, extract prefixed keys from flat query and recursively create nested objects.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters without #[Input] that can't be resolved by DI: use parameter default or throw exception.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters without #[Input], resolve them from the DI container, supporting #[Named] for scalar DI values.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters with #[Input] but missing from query: use parameter default or null if allowed.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQueryInterface.php : InputQueryInterface must define getArguments(ReflectionMethod $method, array $query): array and create(string $class, array $query): object.
README.md (11)
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/**/*.php : Every parameter sourced from query data must have the #[Input] attribute.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/**/*.php : The #[Input] attribute must be applied to parameters, not classes.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters without #[Input], resolve them from the DI container, supporting #[Named] for scalar DI values.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters without #[Input] that can't be resolved by DI: use parameter default or throw exception.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : For parameters with #[Input] and object type, extract prefixed keys from flat query and recursively create nested objects.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/Attribute/Input.php : Attribute class Input must be defined as #[Attribute(Attribute::TARGET_PARAMETER)] in src/Attribute/Input.php.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Parameters with #[Input] but missing from query: use parameter default or null if allowed.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQueryInterface.php : InputQueryInterface must define getArguments(ReflectionMethod $method, array $query): array and create(string $class, array $query): object.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Implement a reasonable recursion depth limit (e.g., 10 levels) to prevent infinite recursion in nested input resolution.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Applies to docs/src/InputQuery.php : Convert all query keys to camelCase, handling snake_case, kebab-case, and PascalCase.
Learnt from: CR
PR: ray-di/Ray.InputQuery#0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-07-03T12:18:36.698Z
Learning: Only depend on `ray/di` for `InjectorInterface`.
🧬 Code Graph Analysis (2)
tests/FileUploadTest.php (5)
src/InputQueryInterface.php (1)
  • newInstance (32-32)
tests/Fake/FileUploadInput.php (1)
  • FileUploadInput (11-18)
tests/Fake/FileUploadWithOptionsInput.php (1)
  • FileUploadWithOptionsInput (11-18)
tests/Fake/OptionalFileUploadInput.php (1)
  • OptionalFileUploadInput (12-19)
tests/Fake/FileUploadArrayInput.php (1)
  • FileUploadArrayInput (10-20)
demo/csv/AgeGroup.php (1)
src/InputQuery.php (1)
  • InputQuery (70-504)
🪛 PHPMD (2.15.0)
demo/csv/CsvDemo.php

68-68: Avoid unused parameters such as '$hasHeader'. (Unused Code Rules)

(UnusedFormalParameter)


69-69: Avoid unused parameters such as '$encoding'. (Unused Code Rules)

(UnusedFormalParameter)


70-70: Avoid unused parameters such as '$skipEmptyRows'. (Unused Code Rules)

(UnusedFormalParameter)


133-133: Avoid unused parameters such as '$email'. (Unused Code Rules)

(UnusedFormalParameter)

🔇 Additional comments (17)
.gitignore (1)

9-12: Uploaded-file directories correctly excluded
Adding demo/uploads/ and uploads/ keeps transient artefacts out of the repo—good call.

demo/csv/AgeGroup.php (1)

1-54: Excellent implementation of a stateful service.

This class demonstrates solid design principles:

  • Clear separation of concerns with business logic isolated from input handling
  • Proper null safety handling
  • Well-defined age group boundaries without gaps or overlaps
  • Comprehensive documentation explaining the singleton service pattern
  • Clean, readable implementation

The age grouping logic correctly handles all ranges: <25, 25-35, 36-50, >50.

docs/prompts/usage-generator.md (1)

41-41: LGTM: Consistent method renaming implementation.

All occurrences of create() have been properly updated to newInstance(), maintaining the same API usage patterns while aligning with the new naming convention. The changes are applied consistently across both basic usage and multi-step form examples.

Also applies to: 215-215, 218-218

docs/framework_integration.md (1)

554-554: LGTM: Documentation updated for new method name.

The change correctly updates the direct object creation pattern example to use newInstance() instead of create(), maintaining consistency with the API renaming throughout the codebase.

docs/design/file-upload-integration.md (2)

175-175: LGTM: Testing examples updated for new API.

The file upload testing examples have been correctly updated to use newInstance() instead of create(), maintaining the same functionality and testing patterns while aligning with the new method naming convention.

Also applies to: 314-314


363-363: Good practice: Added newline at EOF.

Adding a newline character at the end of the file follows standard file formatting conventions.

tests/FileUploadTest.php (1)

43-43: LGTM: Method calls updated consistently

The file upload tests have been correctly updated to use the new newInstance() method name instead of create(). All test logic and assertions remain unchanged, maintaining the same test coverage and behavior.

Also applies to: 67-67, 81-81, 110-110

tests/InputFileTest.php (1)

41-41: Comprehensive method renaming completed correctly

All test methods in the file input test suite have been consistently updated to use newInstance() instead of create(). The changes preserve all test logic and maintain comprehensive coverage of file input scenarios including validation, error handling, and edge cases.

Also applies to: 58-58, 76-76, 97-97, 117-117, 137-137, 157-157, 177-177, 196-196, 210-210, 219-219, 1048-1048, 1118-1118, 1136-1136

docs/design/design.md (1)

343-343: Documentation examples updated to reflect new API

The design documentation has been correctly updated to demonstrate usage of the new newInstance() method instead of create(). This ensures developers have accurate examples of the current API.

Also applies to: 374-374

tests/InputQueryTest.php (1)

96-96: Extensive test suite updated consistently and thoroughly

The main test suite has been comprehensively updated with all create() method calls replaced by newInstance(). This covers the full range of functionality including:

  • Simple and nested object creation
  • DI integration and mixed parameters
  • Scalar type conversions and validation
  • File upload handling
  • Error scenarios and edge cases
  • Array processing and complex types

All test logic and assertions are preserved, ensuring continued comprehensive test coverage with the new API.

Also applies to: 111-111, 128-128, 165-165, 184-184, 202-202, 230-230, 240-240, 259-259, 273-273, 289-289, 301-301, 317-317, 335-335, 372-372, 384-384, 415-415, 431-431, 448-448, 1048-1048, 1118-1118, 1136-1136

demo/csv/AgeInput.php (1)

1-29: Well-designed value object with proper domain validation.

The implementation correctly enforces the "creation = validity" principle, ensuring that invalid AgeInput instances cannot exist. The use of readonly properties and comprehensive documentation makes this a good example of input object design.

demo/run.php (1)

33-33: Changes correctly implement the API updates.

All modifications align with the PR objectives:

  • Constructor simplification reflects the optional FileUploadFactory dependency
  • Method calls properly updated from create() to newInstance()
  • Minor whitespace cleanup improves code quality

Also applies to: 47-47, 64-64, 96-96, 110-110, 126-126, 145-145, 168-168

src/InputQuery.php (1)

74-77: Excellent implementation of the API improvements.

The changes successfully achieve the PR objectives:

  • Optional FileUploadFactory with automatic default instantiation simplifies usage while preserving DI flexibility
  • Method rename to newInstance() provides clearer semantics
  • All internal calls properly updated for consistency

Also applies to: 101-101, 275-275, 481-481

README.md (4)

27-27: Good fix: Added missing code block delimiter.

This resolves the syntax error in the markdown formatting.


103-103: Excellent consistency: Method name changes properly implemented.

All instances of create() have been correctly updated to newInstance() throughout the documentation, maintaining consistency with the API changes.

Also applies to: 144-144, 356-356, 423-423, 435-435, 483-483, 492-492


126-154: Improved example: Better nested object demonstration.

The updated nested objects example using AddressInput and UserInput is more practical and easier to understand than the previous example.


303-369: Excellent addition: Comprehensive dependency injection example.

The new EventBookingInput example demonstrates advanced concepts beautifully:

  • Interface-based dependency injection
  • Named parameter binding
  • Complex object creation with validation
  • Exception handling for business logic
  • Real-world use case with tickets and addresses

This significantly improves the documentation quality and demonstrates the power of combining Ray.InputQuery with dependency injection.

koriym and others added 3 commits July 7, 2025 01:52
- Add NullUploadFactory as default when FileUploadFactory not provided
- Change return type to AbstractFileUpload for better type safety
- Update tests to use FileUploadFactory only when needed
- Update demos to explicitly use FileUploadFactory for file uploads
- Update README to document optional koriym/file-upload dependency
- Address code review feedback: fix typos, fix age=0 display, replace exit with return

BREAKING CHANGE: FileUploadFactory must be explicitly provided when using file upload features

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- InputQueryTest contains file upload test methods that require FileUploadFactory
- Changed setUp() to use FileUploadFactory instead of default NullUploadFactory
- This allows file upload tests to work while keeping core functionality separate

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
AbstractFileUpload is used in FileUploadFactoryInterface return types
but is an optional dependency. Adding it to the whitelist allows
the optional file upload functionality to work correctly.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@koriym koriym merged commit 1fccdeb into 1.x Jul 6, 2025
18 checks passed
@koriym koriym deleted the feature/newinstance-api-improvement branch July 6, 2025 17:05
@koriym koriym restored the feature/newinstance-api-improvement branch July 7, 2025 00:53
@koriym koriym deleted the feature/newinstance-api-improvement branch July 7, 2025 01:05
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.

1 participant