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

MNT Resolve CI problems #3

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?xml version="1.0"?>
<ruleset name="PSR12">
<rule ref="PSR12"/>
<rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
<exclude-pattern>tests/bootstrap\.php</exclude-pattern>
</rule>
<rule ref="PSR12"/>
<rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
<exclude-pattern>tests/bootstrap\.php</exclude-pattern>
</rule>

<file>./src</file>
<file>./tests</file>
</ruleset>
12 changes: 12 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php

// php_codesniffer autoloader

use PHP_CodeSniffer\Util\Tokens;

$autoloadCandidates = [
// running from package itself as root
__DIR__ . '/../vendor/squizlabs/php_codesniffer/autoload.php',
Expand All @@ -17,6 +20,15 @@
}
}

if (!$autoloaded) {
throw new RuntimeException("Couldn't find autoloader");
}

// Required to correctly run constant definitions in CI, though not needed locally for some reason.
// Referencing a static property on the Tokens class forces the file containing it to be autoloaded,
// which results in the constants (defined in the same file) being defined ahead of time.
Tokens::$operators;
emteknetnz marked this conversation as resolved.
Show resolved Hide resolved

if (!defined('PHP_CODESNIFFER_VERBOSITY')) {
define('PHP_CODESNIFFER_VERBOSITY', 0);
}
Expand Down