Skip to content

Commit

Permalink
add cspell.json
Browse files Browse the repository at this point in the history
  • Loading branch information
bkdotcom committed May 21, 2024
1 parent c0e6592 commit fa18efa
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 35 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.json]
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
/.github export-ignore
/.gitignore export-ignore
/.stylelintrc.json export-ignore
/cspell.json export-ignore
/dev export-ignore
/phpcs.slevomat.xml export-ignore
/phpcs.xml.dist export-ignore
Expand Down
39 changes: 39 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"version": "0.2",
"language": "en-US",
"ignorePaths": [
"./cspell.json",
"./src/Debug/js/**",
"*.min.*",
"**/charData.php",
"**/prism.js",
"**/tests/**"
],
"useGitignore": true,
"words": [
"autoloader",
"bitmask",
"callables",
"classname",
"hostnames",
"invokable",
"regexs",
"uncollapse",
"ungroup",
"unserialized",
"unsets",
"webroot"
],
"ignoreWords": [
"chromelogger",
"firephp",
"jdorn",
"mrkdwn",
"mysqli",
"phpcs",
"phpmd",
"slevomat",
"symfony",
"wamp"
]
}
8 changes: 4 additions & 4 deletions src/Backtrace/Normalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ public static function normalize($backtrace)
* Normalize file value
*
* @param array $frame current frame
* @param array $frameNext next frrame
* @param array $frameNext next frame
*
* @return array
*/
private static function normalizeFrameFile(array $frame, array &$frameNext)
{
$regexEvaldCode = '/^(.+)\((\d+)\) : eval\(\)\'d code$/';
$regexEvalCode = '/^(.+)\((\d+)\) : eval\(\)\'d code$/';
$matches = array();
if ($frame['file'] === null) {
// use file/line from next frame
Expand All @@ -87,14 +87,14 @@ private static function normalizeFrameFile(array $frame, array &$frameNext)
\array_intersect_key($frameNext, \array_flip(array('file', 'line')))
);
}
if (\preg_match($regexEvaldCode, (string) $frame['file'], $matches)) {
if (\preg_match($regexEvalCode, (string) $frame['file'], $matches)) {
// reported line = line within eval
// line inside paren is the line `eval` is on
$frame['evalLine'] = $frame['line'];
$frame['file'] = $matches[1];
$frame['line'] = (int) $matches[2];
if (isset($frameNext['include_filename'])) {
// xdebug_get_function_stack puts the evaled code in include_filename
// xdebug_get_function_stack puts the eval'd code in include_filename
$frameNext['params'] = array($frameNext['include_filename']);
$frameNext['class'] = null;
$frameNext['function'] = 'eval';
Expand Down
2 changes: 1 addition & 1 deletion src/CurlHttpMessage/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function __call($method, $args)
}

/**
* Build CuurlReqRes instance
* Build CurlReqRes instance
*
* @param RequestInterface $request Request instance
* @param array $options options
Expand Down
4 changes: 2 additions & 2 deletions src/CurlHttpMessage/Handler/CurlMulti.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ protected function tick()
? $this->getDelay()
: 0;
if ($delay) {
$microsec = $delay * 1000;
\usleep((int) $microsec);
$microSec = $delay * 1000;
\usleep((int) $microSec);
}

// Step through the task queue which may add additional requests.
Expand Down
6 changes: 3 additions & 3 deletions src/Debug/Collector/Pdo/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ protected function __construct(DebugCollectorPdo $pdo)
* @param mixed $column Number of the column (1-indexed) or name of the column in the result set
* @param mixed $param Name of the PHP variable to which the column will be bound.
* @param int $type [optional] Data type of the parameter, specified by the PDO::PARAM_* constants.
* @param int $maxlen [optional] A hint for pre-allocation.
* @param mixed $driverdata [optional] Optional parameter(s) for the driver.
* @param int $maxLen [optional] A hint for pre-allocation.
* @param mixed $driverData [optional] Optional parameter(s) for the driver.
*
* @return bool
* @link http://php.net/manual/en/pdostatement.bindcolumn.php
*/
#[\ReturnTypeWillChange]
public function bindColumn($column, &$param, $type = null, $maxlen = null, $driverdata = null)
public function bindColumn($column, &$param, $type = null, $maxLen = null, $driverData = null)
{
$this->boundParameters[$column] = $param;
$this->boundParameterTypes[$column] = $type;
Expand Down
8 changes: 4 additions & 4 deletions src/Debug/Collector/SwiftMailerLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function beforeSendPerformed(Swift_Events_SendEvent $event)
$msg = $event->getMessage();
$this->debug->groupCollapsed(
'sending email',
$this->formatEmailAddrs($msg->getTo()),
$this->formatEmailAddresses($msg->getTo()),
$msg->getSubject(),
$this->iconMeta
);
Expand Down Expand Up @@ -293,14 +293,14 @@ public function exceptionThrown(Swift_Events_TransportExceptionEvent $evt)
/**
* Convert array of email addresses/names to string
*
* @param array $addrs emailAddr->name pairs
* @param array $addresses emailAddr->name pairs
*
* @return string
*/
protected function formatEmailAddrs($addrs)
protected function formatEmailAddresses($addresses)
{
$return = array();
foreach ($addrs as $addr => $name) {
foreach ($addresses as $addr => $name) {
$return[] = ($name ? $name . ' ' : '') . '<' . $addr . '>';
}
return \implode(', ', $return);
Expand Down
2 changes: 1 addition & 1 deletion src/Debug/Route/Script.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct(Debug $debug)
*
* @return string|void
*/
public function processlogEntries(Event $event)
public function processLogEntries(Event $event)
{
$this->dumper->crateRaw = false;
$this->data = $this->debug->data->get();
Expand Down
52 changes: 33 additions & 19 deletions src/Debug/Utility/ArrayUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public static function pathGet(&$array, $path, $default = null)
public static function pathSet(array &$array, $path, $val)
{
$path = \array_reverse(self::pathToArray($path));
while ($path && \is_array($array)) {
while ($path) {
$key = \array_pop($path);
if (self::specialKey($key, $path, $array)) {
continue;
Expand All @@ -222,31 +222,22 @@ public static function pathSet(array &$array, $path, $val)
/**
* Searches array structure for value and returns the path to the first match
*
* @param mixed $value value to search for (needle)
* @param array $array array structure to search (haystack)
* @param bool $inclKeys (false) whether to also match keys
* @param mixed $search Needle / value or key to search for
* @param array $array Haystack / array structure to search
* @param bool $byKey (false) whether to search for key vs value
*
* @return array|false Returns empty array if value not found
* @return array|false
*/
public static function searchRecursive($value, array $array, $inclKeys = false)
public static function searchRecursive($search, array $array, $byKey = false)
{
$key = \array_search($value, $array, true);
$key = \array_search($search, $array, true);
if ($key !== false) {
return array($key);
}
if ($inclKeys && self::isValidKey($value) && \array_key_exists($value, $array)) {
return array($value);
if ($byKey && self::isValidKey($search) && \array_key_exists($search, $array)) {
return array($search);
}
foreach ($array as $key => $val) {
if (\is_array($val) === false) {
continue;
}
$pathTest = self::searchRecursive($value, $val, $inclKeys);
if ($pathTest) {
return \array_merge(array($key), $pathTest);
}
}
return false;
return self::searchRecursiveWalk($search, $array, $byKey);
}

/**
Expand Down Expand Up @@ -318,4 +309,27 @@ public static function spliceAssoc(array &$array, $key, $length = null, $replace
);
return $ret;
}

/**
* Iterate over haystack to find needle
*
* @param mixed $search Needle / value or key to search for
* @param array $array Haystack / array structure to search
* @param bool $byKey (false) whether to search for key vs value
*
* @return array|false
*/
private static function searchRecursiveWalk($search, array $array, $byKey)
{
foreach ($array as $key => $val) {
if (\is_array($val) === false) {
continue;
}
$pathTest = self::searchRecursive($search, $val, $byKey);
if ($pathTest) {
return \array_merge(array($key), $pathTest);
}
}
return false;
}
}
2 changes: 1 addition & 1 deletion src/Debug/Utility/HtmlParse.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class HtmlParse
* Parse attribute value
*
* @param string $name attribute name
* @param string $val value (assumed to be htmlspecialchar'd)
* @param string $val value (assumed to be html encoded)
* @param int $options bitmask of Html::PARSE_ATTRIB_x FLAGS
*
* @return mixed
Expand Down

0 comments on commit fa18efa

Please sign in to comment.