Skip to content

Commit

Permalink
Use latest coding standard
Browse files Browse the repository at this point in the history
  • Loading branch information
chadicus committed Apr 22, 2017
1 parent 3bf4e86 commit 35d7aca
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 21 deletions.
6 changes: 2 additions & 4 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
filter:
excluded_paths:
- 'vendor/*'
- 'tests/*'
before_commands:
- 'composer install --prefer-source'
build:
tests:
override:
- phpcs-run --standard=./vendor/chadicus/coding-standard/Chadicus/ruleset.xml
- phpcs-run --standard=./vendor/chadicus/coding-standard/Chadicus/ruleset.xml -n src tests
tools:
php_analyzer: true
php_mess_detector: true
sensiolabs_security_checker: true
php_loc:
excluded_dirs:
- vendor
- tests
php_pdepend: true
php_sim: true
build_failure_conditions:
- 'elements.rating(<= B).new.exists'
- 'elements.rating(< B).new.exists'
- 'issues.label("coding-style").new.exists'
- 'issues.severity(>= MAJOR).new.exists'
- 'project.metric("scrutinizer.quality", < 6)'
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"require-dev": {
"phpunit/phpunit": "^5.5",
"satooshi/php-coveralls": "^1.0",
"chadicus/coding-standard": "^1.1"
"chadicus/coding-standard": "^1.3"
},
"autoload": {
"psr-4": { "DominionEnterprises\\Cronus\\": "src" }
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

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

7 changes: 7 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<ruleset name="PHP_CodeSniffer">
<file>./src</file>
<file>./tests</file>
<arg value="p" />
<rule ref="./vendor/chadicus/coding-standard/Chadicus"/>
</ruleset>
8 changes: 4 additions & 4 deletions src/ProcessRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function add(
int $maxGlobalProcesses = 1,
int $maxHostProcesses = 1
) : bool {
$thisHostName = self::_getEncodedHostname();
$thisHostName = self::getEncodedHostname();
$thisPid = getmypid();

//loop in case the update fails its optimistic concurrency check
Expand Down Expand Up @@ -143,7 +143,7 @@ public function add(
*/
public function remove(string $id)
{
$thisHostName = self::_getEncodedHostname();
$thisHostName = self::getEncodedHostname();
$thisPid = getmypid();

$this->collection->updateOne(
Expand All @@ -166,7 +166,7 @@ public function reset(string $id, int $minsBeforeExpire)
//ensure expireSecs is between 0 and self::MONGO_INT32_MAX
$expireSecs = max(0, min($expireSecs, self::MONGO_INT32_MAX));

$thisHostName = self::_getEncodedHostname();
$thisHostName = self::getEncodedHostname();
$thisPid = getmypid();

$this->collection->updateOne(
Expand All @@ -185,7 +185,7 @@ public function reset(string $id, int $minsBeforeExpire)
*
* @return string the encoded hostname from gethostname().
*/
private static function _getEncodedHostname() : string
private static function getEncodedHostname() : string
{
return str_replace(['.', '$'], ['_DOT_', '_DOLLAR_'], gethostname());
}
Expand Down
10 changes: 5 additions & 5 deletions tests/ProcessRegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function addOverMaxGlobalProcessesOnDifferentHost()
public function addOverMaxGlobalProcessesOnSameHost()
{
$pipes = [];
$process = proc_open('sleep 10 &', self::_getDevNullProcOpenDescriptors(), $pipes);
$process = proc_open('sleep 10 &', self::getDevNullProcOpenDescriptors(), $pipes);
$status = proc_get_status($process);
if (!$status['running']) {
$this->markTestSkipped('Unable to start sleep process.');
Expand All @@ -158,7 +158,7 @@ public function addOverMaxGlobalProcessesOnSameHost()
public function addOverMaxHostProcesses()
{
$pipes = [];
$process = proc_open('sleep 10 &', self::_getDevNullProcOpenDescriptors(), $pipes);
$process = proc_open('sleep 10 &', self::getDevNullProcOpenDescriptors(), $pipes);
$status = proc_get_status($process);
if (!$status['running']) {
$this->markTestSkipped('Unable to start sleep process.');
Expand Down Expand Up @@ -217,7 +217,7 @@ public function addCleaningNotRunningProcessWithoutExtra()
public function addCleaningNotRunningProcessWithExtra()
{
$pipes = [];
$process = proc_open('sleep 3 &', self::_getDevNullProcOpenDescriptors(), $pipes);
$process = proc_open('sleep 3 &', self::getDevNullProcOpenDescriptors(), $pipes);
$status = proc_get_status($process);
if (!$status['running']) {
$this->markTestSkipped('Unable to start sleep process.');
Expand Down Expand Up @@ -370,7 +370,7 @@ public function addCleaningRecycledProcessWithoutExtra()
public function addCleaningRecycledProcessWithExtra()
{
$pipes = [];
$process = proc_open('sleep 3 &', self::_getDevNullProcOpenDescriptors(), $pipes);
$process = proc_open('sleep 3 &', self::getDevNullProcOpenDescriptors(), $pipes);
$status = proc_get_status($process);
if (!$status['running']) {
$this->markTestSkipped('Unable to start sleep process.');
Expand Down Expand Up @@ -645,7 +645,7 @@ public function addTooMuchConcurrency()
*
* @return array
*/
private static function _getDevNullProcOpenDescriptors() : array
private static function getDevNullProcOpenDescriptors() : array
{
return [0 => ['file', '/dev/null', 'r'], 1 => ['file', '/dev/null', 'w'], 2 => ['file', '/dev/null', 'w']];
}
Expand Down

0 comments on commit 35d7aca

Please sign in to comment.