You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have not been able to create a working example for this on the PHPStan playground as this bug involves PHPUnit and the phpstan-phpunit package.
We have a class with a generator function that looks like this:
/** * Creates an instance of a class taking into account the class-extensions * API of TYPO3. USE THIS method instead of the PHP "new" keyword. * Eg. "$obj = new myclass;" should be "$obj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance("myclass")" instead! * * You can also pass arguments for a constructor: * \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\myClass::class, $arg1, $arg2, ..., $argN) * * @template T of object * @param class-string<T> $className name of the class to instantiate, must not be empty and not start with a backslash * @param array<int, mixed> $constructorArguments Arguments for the constructor * @return T the created instance */publicstaticfunctionmakeInstance($className, ...$constructorArguments)
{…}
PHPStan (or phpstan-phpunit) now seems to mix up two different representations of a class string for a intersection types (which both look plausible to me, but they're not the same to PHPStan):
The text was updated successfully, but these errors were encountered:
oliverklee
changed the title
Inconsistent behavior with class_string of mocks for union types
Inconsistent behavior with class_string of mocks for intersection types
May 7, 2022
I have not been able to create a working example for this on the PHPStan playground as this bug involves PHPUnit and the phpstan-phpunit package.
We have a class with a generator function that looks like this:
One of the tests for this method looks like this:
PHPStan (or phpstan-phpunit) now seems to mix up two different representations of a class string for a intersection types (which both look plausible to me, but they're not the same to PHPStan):
The text was updated successfully, but these errors were encountered: