diff --git a/.travis.yml b/.travis.yml index 7ee27c04c54..738e235bb18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,9 @@ before_script: - echo Home dir is `echo ~` - echo Update composer # - ~/.phpenv/versions/$(phpenv version-name)/bin/composer.phar self-update + - echo Install phpcs + - pyrus install pear/PHP_CodeSniffer + - phpenv rehash - echo Create dir $(pwd)/htdocs/documents - sudo mkdir -p $(pwd)/htdocs/documents/admin/temp; - sudo touch $(pwd)/htdocs/documents/dolibarr.log; @@ -72,7 +75,9 @@ before_script: # use the $DB env variable to determine the phpunit.xml to use #script: phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/AllTests.php #script: phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/BuildDocTest.php -script: phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php +script: + - phpcs --report=xml --standard=dev/codesniffer --tab-width=4 scripts + - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php #script: phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/WebservicesOtherTest.php after_script: diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index d475060e9e5..849b6bb0370 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -131,8 +131,20 @@ class HookManager // Define type of hook ('output', 'returnvalue' or 'addreplace'). 'addreplace' should be type for all hooks. 'output' and 'returnvalue' are deprecated. $hooktype='output'; if (preg_match('/^pdf_/',$method)) $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are returnvalue hooks. When there is 2 hooks of this type, only last one win. - if (in_array($method,array('addStatisticLine','doActions','formObjectOptions','formattachOptions','formBuilddocLineOptions','moveUploadedFile','pdf_writelinedesc','paymentsupplierinvoices', - 'printSearchForm'))) $hooktype='addreplace'; + if (in_array( + $method, + array( + 'addStatisticLine', + 'doActions', + 'formObjectOptions', + 'formattachOptions', + 'formBuilddocLineOptions', + 'moveUploadedFile', + 'pdf_writelinedesc', + 'paymentsupplierinvoices', + 'printSearchForm' + ) + )) $hooktype='addreplace'; // Loop on each hook to qualify modules that declared context $modulealreadyexecuted=array();