Skip to content

Conversation

@homersimpsons
Copy link
Contributor

  1. Used rector with the following configuration:
    <?php
    declare(strict_types=1);
    
    use Rector\Config\RectorConfig;
    use Rector\PHPUnit\Set\PHPUnitSetList;
    
    return RectorConfig::configure()
       ->withPaths([__DIR__ . '/exercises'])
       ->withSets([PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES, PHPUnitSetList::PHPUNIT_110])
    ->withImportNames(importShortClasses: false, removeUnusedImports: true);
  2. Manually fix testdox that contains :::
    -#[TestDox(specify a string type for Address::$street)]
    +#[TestDox('specify a string type for Address::$street')]
  3. Updated TestGenerator.php to use attribute
  4. Updated bootstrap.sh to use attribute

@github-actions
Copy link

github-actions bot commented Jul 8, 2025

This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested.

If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos.

[no important files changed]

For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping @exercism/maintainers-admin in a comment. Thank you!

@mk-mxp
Copy link
Contributor

mk-mxp commented Jul 9, 2025

@homersimpsons So quick and so many changes :) I hope to get to it on the weekend.

@homersimpsons
Copy link
Contributor Author

@homersimpsons So quick and so many changes :) I hope to get to it on the weekend.

Yes, it took me 30 minutes to 1 hour to check the whole diff. Most of the files had the same changes, also the diff count per file also gives confidence at a quick glance.

@tomasnorre
Copy link
Contributor

Currently on vacation, so would need some time to review this, can do it somewhen next week.

Copy link
Contributor

@mk-mxp mk-mxp left a comment

Choose a reason for hiding this comment

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

Only a few problems, automation is great!

One thing I am unsure about: Why do we have \ on students stubs exceptions, but not on those in the tests? Technically \ is not required, as there are no namespaces set. Should we remove them?

1. Used rector with the following configuration:
    ```php
    <?php

    declare(strict_types=1);

    use Rector\Config\RectorConfig;
    use Rector\PHPUnit\Set\PHPUnitSetList;

    return RectorConfig::configure()
        ->withPaths([__DIR__ . '/exercises'])
        ->withSets([PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES, PHPUnitSetList::PHPUNIT_110])
	->withImportNames(importShortClasses: false, removeUnusedImports: true);
    ```
2. Manually fix testdox that contains `::`:
    ```diff
    -#[TestDox(specify a string type for Address::$street)]
    +#[TestDox('specify a string type for Address::$street')]
    ```
3. Updated `TestGenerator.php` to use attribute
4. Updated `bootstrap.sh` to use attribute
@homersimpsons homersimpsons force-pushed the chore/phpunit-attributes branch from 33ebb3b to 5ef73ab Compare July 13, 2025 10:08
Copy link
Contributor

@mk-mxp mk-mxp left a comment

Choose a reason for hiding this comment

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

Thanks a lot for contributing this!

@mk-mxp mk-mxp merged commit ac56d09 into exercism:main Jul 13, 2025
12 checks 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