cpliakas / git-wrapper

A PHP wrapper around the Git command line utility.
MIT License
505 stars 68 forks source link

Crossplatform GitWorkingCopy::getRemotes() #191

Closed rugabarbo closed 4 years ago

rugabarbo commented 4 years ago

In some configurations, there is no guarantee that the system uses PHP_EOL delimiter for console output. See issue https://github.com/yiisoft/yii-dev-tool/issues/42 for details.

rugabarbo commented 4 years ago

For some strange reason, Nette Utils uses flag PREG_SPLIT_DELIM_CAPTURE by default when splitting lines: https://github.com/nette/utils/blob/f1dc08536b040d5b569ee63354343145cbe6c591/src/Utils/Strings.php#L435

Because of this, Strings::split() also returns delimiters in the result set. Therefore, the Rector’s recommendation is incorrect.

TomasVotruba commented 4 years ago

Because of this, Strings::split() also returns delimiters in the result set. Therefore, the Rector’s recommendation is incorrect.

Could you create issue in Rector?

TomasVotruba commented 4 years ago

Could you use it anyway? It should be possible

rugabarbo commented 4 years ago

Could you create issue in Rector?

https://github.com/rectorphp/rector/issues/2348

Could you use it anyway? It should be possible

I used regex without subpatterns. Now all tests are green.

rugabarbo commented 4 years ago

@TomasVotruba is everything okay now? :) Could you please merge it? I really need this fix to remove the temporary hack from yii-dev-tool package:

https://github.com/yiisoft/yii-dev-tool/blob/7babde07d8b946a8a32162347e080cd62ce45085/src/Command/InstallCommand.php#L197

TomasVotruba commented 4 years ago

Looks good