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

fix: Don't change REGEXP heredoc marker to default one #31

Merged
merged 3 commits into from
May 14, 2024
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
3 changes: 2 additions & 1 deletion .github/template-sync.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"branch": "sync",
"after": {
"plugins": [
".github/template-sync/replace-bootstrap-in-cs-fixer.js"
".github/template-sync/replace-bootstrap-in-cs-fixer.js",
".github/template-sync/remove-php-cs-fixer-from-require-dev.js"
]
}
}
Expand Down
21 changes: 21 additions & 0 deletions .github/template-sync/remove-php-cs-fixer-from-require-dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const { readFile, writeFile } = require('fs/promises');

module.exports = () => async (template, source) => {
const sourceComposerJson = JSON.parse(
(await readFile(source.path('composer.json'))).toString(),
);
const { 'php-cs-fixer/shim': _, ...requireDevWithoutPackage } =
sourceComposerJson['require-dev'];

await writeFile(
source.path('composer.json'),
JSON.stringify({
...sourceComposerJson,
'require-dev': requireDevWithoutPackage,
}),
);

return {
reserved: [],
};
};
2 changes: 1 addition & 1 deletion .github/template-sync/replace-bootstrap-in-cs-fixer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = () => async (template, source) => {
.toString()
.replace(
'vendor/tenantcloud/php-cs-fixer-rule-sets/bootstrap.php',
'bootstrap.php'
'bootstrap.php',
);

await writeFile(source.path('.php-cs-fixer.dist.php'), sourceCsFixerConfig);
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/template-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Reformat using Prettier
uses: actionsx/prettier@v2
uses: actionsx/prettier@v3
with:
args: --write .

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
uses: actions/checkout@v3

- name: Run prettier
uses: actionsx/prettier@v2
uses: actionsx/prettier@v3
with:
args: --check .

Expand Down
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
"license": "MIT",
"require": {
"php": ">=8.2",
"php-cs-fixer/shim": "^3.54",
"friendsofphp/php-cs-fixer": "^3.54",
"kubawerlos/php-cs-fixer-custom-fixers": "^3.21"
},
"require-dev": {
"pestphp/pest": "^2.8",
"phpstan/phpstan": "~1.10.21",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-webmozart-assert": "^1.2",
"phpstan/phpstan-mockery": "^1.1",
"php-cs-fixer/shim": "^3.54"
"phpstan/phpstan-mockery": "^1.1"
},
"autoload": {
"psr-4": {
Expand Down
5 changes: 0 additions & 5 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,3 @@ parameters:
paths:
- src
- tests

ignoreErrors:
-
message: '#.*#'
path: 'src/Config.php'
3 changes: 2 additions & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
namespace TenantCloud\PhpCsFixer;

use PhpCsFixer\Config as PhpCsFixerConfig;
use PhpCsFixer\ConfigInterface;
use PhpCsFixerCustomFixers\Fixers;
use TenantCloud\PhpCsFixer\RuleSet\TenantCloudSet;

final class Config
{
private function __construct() {}

public static function make(): PhpCsFixerConfig
public static function make(): ConfigInterface
{
return (new PhpCsFixerConfig())
->registerCustomFixers(new Fixers())
Expand Down
3 changes: 2 additions & 1 deletion src/RuleSet/TenantCloudSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ private function enabled(): iterable
'global_namespace_import' => true,
'heredoc_closing_marker' => [
'reserved_closing_markers' => [
'CSS', 'DIFF', 'HTML', 'JS', 'JSON', 'LUA', 'MD', 'PHP', 'PYTHON', 'RST', 'TS', 'SQL', 'XML', 'YAML',
'CSS', 'DIFF', 'HTML', 'JS', 'JSON', 'LUA', 'MD', 'PHP',
'PYTHON', 'REGEXP', 'RST', 'TS', 'SQL', 'XML', 'YAML',
],
],
// Forces proper indentation on Heredoc/Nowdoc
Expand Down
Loading