- 
 
- 
  Notifications
 You must be signed in to change notification settings 
- Fork 7
 Upgrade nikic/php-parser to v5+
 #63
 
 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
Changes from all commits
2392fd8
 5836d87
 846e011
 6f1542f
 c55dc7a
 63113e2
 9356c18
 a436917
 File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -112,7 +112,9 @@ public static function getPhpParserValueFromNode( | |
| && | ||
| $node->value->name | ||
| ) { | ||
| $value = implode('\\', $node->value->name->getParts()) ?: $node->value->name->name; | ||
| $value = method_exists($node->value->name,'getParts') | ||
| ? implode('\\', $node->value->name->getParts()) | ||
| : $node->value->name->name; | ||
| 
 Comment on lines
 
 +115
  to 
 +117
 
  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change correctly adapts for  
 For the v5 path, could we use  $value = method_exists($node->value->name,'getParts') ? implode('\\', $node->value->name->getParts()) // v4 path (Note: original Elvis operator was removed in this PR) : $node->value->name->toString(); // v5 path: use toString() for robust name resolution | ||
| return $value === 'null' ? null : $value; | ||
| } | ||
| } | ||
|  | @@ -468,7 +470,7 @@ public static function getCpuCores(): int | |
| } | ||
|  | ||
| /** @noinspection PhpUsageOfSilenceOperatorInspection */ | ||
| $ret = @\shell_exec('nproc'); | ||
| $ret = @\shell_exec('nproc 2>&1'); | ||
| if (\is_string($ret)) { | ||
| $ret = \trim($ret); | ||
| /** @noinspection PhpAssignmentInConditionInspection */ | ||
|  | @@ -495,6 +497,23 @@ public static function getCpuCores(): int | |
| } | ||
| } | ||
|  | ||
| /** | ||
| * macOS (FreeBSD) | ||
| */ | ||
| $ret = @\shell_exec('sysctl -n hw.ncpu'); | ||
| if (\is_string($ret)) { | ||
| $ret = \trim($ret); | ||
| /** @noinspection PhpAssignmentInConditionInspection */ | ||
| if ($ret && ($tmp = \filter_var($ret, \FILTER_VALIDATE_INT)) !== false) { | ||
| $return = (int)round($tmp / 2); | ||
| if ($return > 1) { | ||
| return $return; | ||
| } | ||
|  | ||
| return 1; | ||
| } | ||
| } | ||
|  | ||
| return 1; | ||
| } | ||
|  | ||
|  | ||