Skip to content

Conversation

@tyrsson
Copy link
Owner

@tyrsson tyrsson commented Aug 18, 2025

No description provided.

Signed-off-by: Joey Smith <jsmith@webinertia.net>

Signed-off-by: Joey Smith <jsmith@webinertia.net>
@tyrsson tyrsson added this to the 0.1.0 milestone Aug 18, 2025
@tyrsson tyrsson self-assigned this Aug 18, 2025
Copilot AI review requested due to automatic review settings August 18, 2025 19:08
@tyrsson tyrsson added the enhancement New feature or request label Aug 18, 2025
@tyrsson tyrsson merged commit e7976cb into tyrsson:0.1.x Aug 18, 2025
9 checks passed
@tyrsson tyrsson deleted the improve-instruction-files branch August 18, 2025 19:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR replaces the technical project documentation with user-focused documentation to improve developer onboarding and usage instructions. The change removes detailed internal architecture documentation and replaces it with practical getting-started guidance.

  • Removes comprehensive internal project documentation (project-overview.md)
  • Adds new user-focused documentation (copilot-project-overview.md) with installation and usage examples
  • Shifts focus from internal development to external usage patterns

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
.github/instructions/project-overview.md Complete removal of internal project documentation containing architecture details, development standards, and contributor guidelines
.github/instructions/copilot-project-overview.md New comprehensive user guide with installation steps, configuration examples, and practical usage patterns

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

```php
// config/autoload/cmd-bus.global.php
return [
PhpCmd\CmdBus\ConfigProvider::class => [
Copy link

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

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

The configuration structure is inconsistent with typical Laminas/Mezzio patterns. Configuration should be nested under a specific key like 'cmd-bus' rather than using the ConfigProvider class name as the key.

Suggested change
PhpCmd\CmdBus\ConfigProvider::class => [
'cmd-bus' => [

Copilot uses AI. Check for mistakes.

public function setRequest(ServerRequestInterface $request): void
{
$this->request = $request;
Copy link

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

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

The import of UserRepositoryInterface in a Command class suggests tight coupling. Commands should be data containers and shouldn't directly import repository interfaces.

Suggested change
$this->request = $request;
use PhpCmd\CmdBus\CommandInterface;
final class CreateUserCommand implements CommandInterface
{
private array $userData;
public function __construct(array $userData)
{
$this->userData = $userData;
}
public function getUserData(): array
{
return $this->userData;

Copilot uses AI. Check for mistakes.

public function setRequest(ServerRequestInterface $request): void
{
$this->request = $request;
Copy link

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

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

Commands should not receive repositories in their constructor. This violates separation of concerns - commands should be simple data containers, and business logic should be handled in the command handlers.

Suggested change
$this->request = $request;
public function __construct(ServerRequestInterface $request)
{
$this->request = $request;
}
public function getRequest(): ServerRequestInterface
{
return $this->request;

Copilot uses AI. Check for mistakes.
{
$data = $this->request->getParsedBody();
return $this->userRepository->save($data);
}
Copy link

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

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

Commands having an 'execute' method contradicts the Command pattern. Commands should be passive data containers, and execution should be handled by command handlers through the 'handle' method.

Suggested change
}
// Command classes should not contain business logic or an execute method.
// Execution should be handled by a separate handler class.

Copilot uses AI. Check for mistakes.

public function handle(CommandInterface $command): User
{
return $command->execute();
Copy link

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

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

The handler is delegating execution back to the command, which defeats the purpose of the Command pattern. The handler should contain the business logic, not just proxy to the command.

Suggested change
return $command->execute();
if (!$command instanceof CreateUserCommand) {
throw new \InvalidArgumentException('Invalid command type');
}
$userData = $command->getUserData();
return $this->userRepository->save($userData);

Copilot uses AI. Check for mistakes.

$command = new CreateUserCommand();
$command->setRequest($request);

Copy link

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

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

The PreExecuteCommandEvent is dispatched but the command variable is then reassigned to a new CreateUserCommand instance, making the event dispatch ineffective as it operates on a different command instance.

Suggested change
$command = new CreateUserCommand();
$command->setRequest($request);
$this->eventDispatcher->dispatch(new PreExecuteCommandEvent($command));

Copilot uses AI. Check for mistakes.
{
$this->eventDispatcher->dispatch(new PreExecuteCommandEvent($command));

$command = new CreateUserCommand();
Copy link

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

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

The command parameter is being reassigned to a new instance, which discards the original command that was passed to the handler and makes the previous event dispatch meaningless.

Suggested change
$command = new CreateUserCommand();

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant