Closed ghost closed 2 years ago
@jwojtyra-aterian Thank you very much for the PR. Could give me an example of how this would break things? All tests are successful (Unless the tests missed something :) )
Sure, an example from this repo, I run phpstan with current configuration but for some tests ./vendor/bin/phpstan analyse tests/Base
here is part of the output. For the same reason I cannot upgrade yasumi
in my project
------ --------------------------------------------------------------------------
Line YasumiTest.php
------ --------------------------------------------------------------------------
138 Call to an undefined method Yasumi\ProviderInterface::count().
139 Call to an undefined method Yasumi\ProviderInterface::count().
140 Call to an undefined method Yasumi\ProviderInterface::count().
183 Call to an undefined method Yasumi\ProviderInterface::next().
199 Call to an undefined method Yasumi\ProviderInterface::next().
220 Call to an undefined method Yasumi\ProviderInterface::previous().
237 Call to an undefined method Yasumi\ProviderInterface::previous().
248 Call to an undefined method Yasumi\ProviderInterface::getHolidayNames().
264 Call to an undefined method Yasumi\ProviderInterface::whenIs().
280 Call to an undefined method Yasumi\ProviderInterface::whenIs().
305 Call to an undefined method Yasumi\ProviderInterface::whatWeekDayIs().
321 Call to an undefined method Yasumi\ProviderInterface::whatWeekDayIs().
380 Call to an undefined method Yasumi\ProviderInterface::isHoliday().
385 Call to an undefined method Yasumi\ProviderInterface::isHoliday().
410 Call to an undefined method Yasumi\ProviderInterface::isHoliday().
415 Call to an undefined method Yasumi\ProviderInterface::isHoliday().
490 Call to an undefined method Yasumi\ProviderInterface::getHolidays().
508 Call to an undefined method Yasumi\ProviderInterface::removeHoliday().
509 Call to an undefined method Yasumi\ProviderInterface::removeHoliday().
510 Call to an undefined method Yasumi\ProviderInterface::removeHoliday().
512 Call to an undefined method Yasumi\ProviderInterface::getHolidays().
578 Call to an undefined method Yasumi\ProviderInterface::getHolidayNames().
581 Call to an undefined method Yasumi\ProviderInterface::addHoliday().
582 Call to an undefined method Yasumi\ProviderInterface::getHolidayNames().
583 Call to an undefined method Yasumi\ProviderInterface::getHolidayNames().
588 Call to an undefined method Yasumi\ProviderInterface::addHoliday().
589 Call to an undefined method Yasumi\ProviderInterface::getHolidayNames().
590 Call to an undefined method Yasumi\ProviderInterface::getHolidayNames().
591 Call to an undefined method Yasumi\ProviderInterface::getHolidayNames().
592 Call to an undefined method Yasumi\ProviderInterface::getHolidayNames().
593 Call to an undefined method Yasumi\ProviderInterface::getHolidayNames().
------ --------------------------------------------------------------------------
@jwojtyra-aterian Indeed, the test classes are not yet following the checks as the base code (src
) does. You should run phpstan with the provided phpstan config (phpstan.neon.dist
) or use the included composer script composer phpstan
.
Not sure I understand why you can't upgrade Yasumi in your project. PHPStan does not look at vendor packages when you use Yasumi as a composer package.
Yes but just like wrote at the beginning, I use method getHolidays
and previously Yasumi::create
returns AbstractProvider
that have this method, now it returns ProviderInterface
without this method. And PHPStan finds those errors in the codebase.
Ah, you mean when using PHPStan for your own project?
yes
I see, Sorry it wasn't immediately clear to me from your description. I'll make a fix for this.
In the previous version
Yasumi\Yasumi::create
was returningYasumi\Provider\AbstractProvider
now its returnYasumi\ProviderInterface
without methodgetHolidays
. Even tests expects thatProviderInterface::getHolidays
exists for exampleYasumi\tests\Base\YasumiTest::testRemoveHoliday