Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add phpstan, add/fix types #46

Merged
merged 5 commits into from
Jul 26, 2021
Merged

Conversation

b1rdex
Copy link
Contributor

@b1rdex b1rdex commented Jul 20, 2021

The main goal was to provide better param/return types using class-string and templates, but I decided to also run PHPStan over the codebase and fix some errors reported. I think this will help to write a better code in the future.

I also had to add symfony/cache as a dev dependency, because the test suite was failing:

1) Doctrine2Test: Plain entity
 Test  tests/unit/Codeception/Module/Doctrine2Test.php:testPlainEntity

  [RuntimeException] Setup tool cannot configure caches without doctrine/cache 1.11 or symfony/cache. Please add an explicit dependency to either library.

#1  /Users/anatoly/PhpstormProjects/module-doctrine2/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Setup.php:184
#2  /Users/anatoly/PhpstormProjects/module-doctrine2/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Setup.php:160
#3  /Users/anatoly/PhpstormProjects/module-doctrine2/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Setup.php:139
#4  /Users/anatoly/PhpstormProjects/module-doctrine2/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Setup.php:87
#5  /Users/anatoly/PhpstormProjects/module-doctrine2/tests/unit/Codeception/Module/Doctrine2Test.php:73

The main goal was to provide better param/return types using `class-string` and templates, but I decided to also run PHPStan over the codebase and fix some errors reported. I think this will help to write a better code in the future.

I also had to add symfony/cache as a dev dependency, because the test suite was failing:
```
1) Doctrine2Test: Plain entity
 Test  tests/unit/Codeception/Module/Doctrine2Test.php:testPlainEntity

  [RuntimeException] Setup tool cannot configure caches without doctrine/cache 1.11 or symfony/cache. Please add an explicit dependency to either library.

Codeception#1  /Users/anatoly/PhpstormProjects/module-doctrine2/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Setup.php:184
Codeception#2  /Users/anatoly/PhpstormProjects/module-doctrine2/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Setup.php:160
Codeception#3  /Users/anatoly/PhpstormProjects/module-doctrine2/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Setup.php:139
Codeception#4  /Users/anatoly/PhpstormProjects/module-doctrine2/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Setup.php:87
Codeception#5  /Users/anatoly/PhpstormProjects/module-doctrine2/tests/unit/Codeception/Module/Doctrine2Test.php:73
```
.github/workflows/main.yml Outdated Show resolved Hide resolved
composer.json Outdated Show resolved Hide resolved
src/Codeception/Module/Doctrine2.php Outdated Show resolved Hide resolved
src/Codeception/Module/Doctrine2.php Show resolved Hide resolved
tests/data/doctrine2_fixtures/TestFixture1.php Outdated Show resolved Hide resolved
@TavoNiievez TavoNiievez merged commit e3bedac into Codeception:master Jul 26, 2021
@TavoNiievez
Copy link
Member

@b1rdex thanks.

@b1rdex b1rdex deleted the phpstan branch July 26, 2021 05:16
@TavoNiievez TavoNiievez added this to the 2.0.0 milestone Dec 2, 2021
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.

None yet

3 participants