Skip to content

Commit

Permalink
Add PSR12 code styling
Browse files Browse the repository at this point in the history
  • Loading branch information
convenient committed Nov 5, 2022
1 parent 2566f47 commit 9389284
Show file tree
Hide file tree
Showing 15 changed files with 312 additions and 124 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ dev/instances/magento*
.php_cs.cache
dev/vendor/
dev/phpunit/functional/.phpunit.result.cache
dev/phpunit/unit/.phpunit.result.cache
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ install:
- composer validate
- composer install
# Run static analysis tests before trying to install the modules in magento
- vendor/bin/php-cs-fixer fix --diff --dry-run
- test:static
# Run unit tests before trying to install magento
- vendor/bin/phpunit -c dev/phpunit/unit/phpunit.xml --verbose;
- composer test:unit
- if [[ $TEST_GROUP = m22 ]]; then rm -rf composer.lock ./vendor/ ; fi # todo ensure all 22 test cases are covered in 24
- cd dev
- docker --version
Expand Down
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
"license": "LGPL-3.0-only",
"require-dev": {
"phpunit/phpunit": "^8.5|^9.5",
"friendsofphp/php-cs-fixer": "^3.0"
"friendsofphp/php-cs-fixer": "^3.0",
"squizlabs/php_codesniffer": "^3.7"
},
"scripts": {
"test:static:fix": " vendor/bin/phpcbf --standard=dev/phpcs.xml && vendor/bin/php-cs-fixer fix --diff",
"test:static": "vendor/bin/phpcs --standard=dev/phpcs.xml -s && vendor/bin/php-cs-fixer fix --diff --dry-run",
"test:unit": "vendor/bin/phpunit -c dev/phpunit/unit/phpunit.xml --verbose"
}
}
58 changes: 57 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions dev/phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<ruleset name="PHP_CodeSniffer">
<description>PHPCS configuration file.</description>
<file>../src</file>
<file>./phpunit</file>
<rule ref="PSR12"/>
<!-- Dev files for testing against-->
<exclude-pattern>*/phpunit/*/resources/*</exclude-pattern>
<!-- allow polyfill and some function checks -->
<exclude-pattern>src/functions.php</exclude-pattern>

<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
<exclude-pattern>*/phpunit/*</exclude-pattern>
</rule>

<rule ref="Generic.Files.LineLength.TooLong">
<exclude-pattern>*/phpunit/*</exclude-pattern>
</rule>

</ruleset>
1 change: 1 addition & 0 deletions dev/phpunit/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<?php

define('BASE_DIR', realpath(__DIR__ . '/../../'));
3 changes: 2 additions & 1 deletion dev/phpunit/functional/FunctionalTests.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

class FunctionalTests extends \PHPUnit\Framework\TestCase
{
/**
Expand All @@ -9,7 +10,7 @@ class FunctionalTests extends \PHPUnit\Framework\TestCase
private function generateAnalyseCommand($versionPath, $arguments = '')
{
if (!str_contains($arguments, '--php-strict-errors')) {
$arguments.= ' --php-strict-errors ';
$arguments .= ' --php-strict-errors ';
}

$baseDir = BASE_DIR;
Expand Down
Loading

0 comments on commit 9389284

Please sign in to comment.