Skip to content

Conversation

@tijsverkoyen
Copy link
Member

@tijsverkoyen tijsverkoyen commented Jul 14, 2025

https://next-app.activecollab.com/108877/my-work?modal=Task-224038-533

Summary by Sourcery

Scaffold Symfony Mailer configuration in .env files, update development dependencies, and standardize CI scripts to invoke PHP-prefixed vendor binaries

New Features:

  • Add scaffolding for Symfony Mailer environment variables in the project template

Build:

  • Add dama/doctrine-test-bundle and phpunit/phpunit; remove symfony/phpunit-bridge from dev dependencies

CI:

  • Prefix CI commands with php for consistency across phpcs, phpstan, twig-cs-fixer, deploy, and phpunit

@sourcery-ai
Copy link

sourcery-ai bot commented Jul 14, 2025

Reviewer's Guide

This pull request enhances the project skeleton by conditionally injecting Symfony Mailer configuration into environment files, standardizing CI scripts to invoke vendor binaries through the PHP executable, and updating development dependencies in composer.json.

File-Level Changes

Change Details Files
Added conditional insertion of Symfony Mailer settings into .env and .env.local
  • Insert mailer default sender and recipient variables in .env
  • Detect existing mailer block via regex and adjust insertion accordingly
  • Add MAILER_DSN block to .env.local setup
src/Skeleton/PostCreateProject.php
Unified CI job scripts to call vendor tools using ‘php’ prefix
  • Prefixed all vendor/bin tool invocations with “php”
  • Replaced simple-phpunit with phpunit command
.gitlab-ci.yml
Revised composer.json dev dependencies
  • Added dama/doctrine-test-bundle and phpunit/phpunit
  • Removed symfony/phpunit-bridge
composer.json

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

Copy link

@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 @tijsverkoyen - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `src/Skeleton/PostCreateProject.php:286` </location>
<code_context>
+        preg_match('|###< symfony/mailer ###|mU', $content, $matches, PREG_OFFSET_CAPTURE);
+        if(!empty($matches)) {
+            $offset = $matches[0][1];
+            unset($insert[0]);
+            unset($insert[4]);
+        }
+        $content = self::insertStringAtPosition(
</code_context>

<issue_to_address>
Unsetting array elements by index may be fragile if the insert array changes.

Using hardcoded indices (0 and 4) makes the code brittle if the structure of $insert changes. Prefer array_shift, array_pop, or referencing elements by value for better maintainability.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
        if(!empty($matches)) {
            $offset = $matches[0][1];
            unset($insert[0]);
            unset($insert[4]);
        }
=======
        if(!empty($matches)) {
            $offset = $matches[0][1];
            array_shift($insert); // Remove the first element
            array_pop($insert);   // Remove the last element
        }
>>>>>>> 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.

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 enhances mailer configuration in the project skeleton, upgrades PHPUnit settings to v12 standards, and adjusts CI and dev dependencies accordingly.

  • Add symfony/mailer markers to .env and .env.local in PostCreateProject.php
  • Migrate phpunit.xml.dist to the PHPUnit 12 XSD, enable stricter output/deprecation settings, and remove legacy listeners
  • Update dev dependencies and CI commands: add DoctrineTestBundle & PHPUnit 12, remove symfony/phpunit-bridge, prefix vendor/bin calls with php; set MAILER_DSN in .env.test

Reviewed Changes

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

Show a summary per file
File Description
src/Skeleton/PostCreateProject.php add logic to insert mailer environment markers
phpunit.xml.dist update PHPUnit schema, add strict settings & extensions
composer.json bump dev deps (dama/doctrine-test-bundle, phpunit/phpunit), remove bridge
.gitlab-ci.yml change CI scripts to call php vendor/bin/...
.env.test set default MAILER_DSN for tests
Comments suppressed due to low confidence (2)

.gitlab-ci.yml:217

  • Vendor binaries often include a shebang and are meant to be executed directly; prefixing the deploy script with php can fail if it's a shell script. Consider calling vendor/bin/dep directly.
    - php vendor/bin/dep deploy stage=staging

phpunit.xml.dist:12

  • Within the section, the element should be (not ) when registering a PHPUnit extension class according to the phpunit.xsd.
        <bootstrap class="DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension" />

@tijsverkoyen tijsverkoyen merged commit 78ba65d into master Jul 15, 2025
1 check passed
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.

3 participants