Skip to content

Commit

Permalink
Merge pull request #3 from 123inkt/PHP7.4-compatability-without-polyfill
Browse files Browse the repository at this point in the history
Add PHP7.4 compatability without symfony8.0 polyfill
  • Loading branch information
frankdekker authored Apr 25, 2022
2 parents 9d5cd18 + d2e0a71 commit 9433165
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
"require": {
"php": ">=7.4",
"composer-plugin-api": "^1.0 || ^2.0",
"squizlabs/php_codesniffer": "^3.6",
"symfony/polyfill-php80": "^1.15"
"squizlabs/php_codesniffer": "^3.6"
},
"require-dev": {
"composer/composer": "^2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/BaselineHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function getInstance(Config $config): self
if (self::$instance === null) {
$baseline = null;
// only read baseline if phpcs is not writing one.
if ($config->reportFile === null || str_contains($config->reportFile, 'phpcs.baseline.xml') === false) {
if ($config->reportFile === null || strpos($config->reportFile, 'phpcs.baseline.xml') === false) {
$baseline = BaselineSetFactory::fromFile(DirectoryUtil::getProjectRoot() . 'phpcs.baseline.xml');
}

Expand Down
4 changes: 2 additions & 2 deletions src/Plugin/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ public function onPostInstall(): void
// @codeCoverageIgnoreEnd
$this->stream->info('php-codesniffer-baseline: read: ' . $this->codeSnifferFilePath);

if (str_contains($source, BaselineHandler::class)) {
if (strpos($source, BaselineHandler::class) !== false) {
$this->stream->info('php-codesniffer-baseline: ignored. src/Files/File.php is already modified');

return;
}

$search = '$messageCount++;';
if (str_contains($source, $search) === false) {
if (strpos($source, $search) === false) {
$this->stream->error('php-codesniffer-baseline: unable to find `' . $search . '` in `squizlabs/php_codesniffer/src/Files/File.php`');

return;
Expand Down

0 comments on commit 9433165

Please sign in to comment.