Skip to content

TasksProvider::create() passes mismatched args to TaskService::createTask (latent TypeError) #1539

Open

Description

@rubenvdlinde

Bug

lib/Service/Integration/BuiltinProviders/TasksProvider.php:174 calls:

```php
$task = $this->taskService->createTask($calendarId, $summary, $description, $due, $priority, $objectId);
```

But TaskService::createTask:331 actually expects:

```php
public function createTask(
int $registerId,
int $schemaId,
string $objectUuid,
string $objectTitle,
array $data
): ?array
```

The caller passes 6 args, the callee expects 5; types are wrong (string $calendarId → int $registerId, etc.); the array shape isn't built. Any UI flow that POSTs to the Tasks provider create endpoint will crash with TypeError: argument #1 ($registerId) must be of type int, string given.

Why we noticed

Surfaced while doing a phpcs cleanup pass. The Custom.NamedParameters sniff flagged the positional call. Naming the args would either hit an unknown named parameter PHP fatal or hide the bug, so the call was suppressed with @phpcs:ignore and this issue filed for the underlying fix.

Fix sketch

```php
$task = $this->taskService->createTask(
registerId: (int) $register,
schemaId: (int) $schema,
objectUuid: $objectId,
objectTitle: $this->lookupObjectTitle($register, $schema, $objectId),
data: [
'summary' => $summary,
'description' => $description,
'priority' => $priority,
'due' => $due,
'status' => 'NEEDS-ACTION',
],
);
```

Needs:

  • A helper to look up the OR object's title (probably via ObjectService::find)
  • Casting $register/$schema from string to int safely (they're typed string in the provider's interface, may be slugs)
  • A behavior test against a real calendar to verify the new call shape

Acceptance criteria

  • TasksProvider::create() call to TaskService::createTask matches the receiver signature
  • Remove the @phpcs:ignore at TasksProvider.php:173
  • Add a unit test covering the create path
  • Optional: figure out whether the \$payload['calendarId'] from the UI is still needed (TaskService auto-finds the calendar via findUserCalendar() — looks unused)

Refs

  • TasksProvider.php:165-181
  • TaskService.php:331-337

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions