1
0
mirror of https://github.com/danog/tgseclib.git synced 2024-11-27 04:34:45 +01:00

CodeSniffer: Fix Generic.PHP.LowerCaseConstant.Found sniff.

This commit is contained in:
Andreas Fischer 2013-12-03 18:54:43 +01:00
parent ecd58b6a03
commit ca9c8b107b
7 changed files with 73 additions and 74 deletions

View File

@ -432,7 +432,7 @@ class Crypt_RSA {
/**
* OpenSSL configuration file name.
*
* Set to NULL to use system configuration file.
* Set to null to use system configuration file.
* @see Crypt_RSA::createKey()
* @var Mixed
* @Access public
@ -554,7 +554,7 @@ class Crypt_RSA {
$config['config'] = $this->configFile;
}
$rsa = openssl_pkey_new(array('private_key_bits' => $bits) + $config);
openssl_pkey_export($rsa, $privatekey, NULL, $config);
openssl_pkey_export($rsa, $privatekey, null, $config);
$publickey = openssl_pkey_get_details($rsa);
$publickey = $publickey['key'];

View File

@ -544,13 +544,13 @@ class File_ASN1 {
return array($key => $value);
}
}
return NULL;
return null;
case isset($mapping['implicit']):
case isset($mapping['explicit']):
case $decoded['type'] == $mapping['type']:
break;
default:
return NULL;
return null;
}
if (isset($mapping['implicit'])) {
@ -565,8 +565,8 @@ class File_ASN1 {
if (isset($mapping['min']) && isset($mapping['max'])) {
$child = $mapping['children'];
foreach ($decoded['content'] as $content) {
if (($map[] = $this->asn1map($content, $child, $special)) === NULL) {
return NULL;
if (($map[] = $this->asn1map($content, $child, $special)) === null) {
return null;
}
}
@ -584,7 +584,7 @@ class File_ASN1 {
if ($child['type'] != FILE_ASN1_TYPE_CHOICE) {
// Get the mapping and input class & constant.
$childClass = $tempClass = FILE_ASN1_CLASS_UNIVERSAL;
$constant = NULL;
$constant = null;
if (isset($temp['constant'])) {
$tempClass = isset($temp['class']) ? $temp['class'] : FILE_ASN1_CLASS_CONTEXT_SPECIFIC;
}
@ -610,7 +610,7 @@ class File_ASN1 {
if ($maymatch) {
// Attempt submapping.
$candidate = $this->asn1map($temp, $child, $special);
$maymatch = $candidate !== NULL;
$maymatch = $candidate !== null;
}
if ($maymatch) {
@ -623,12 +623,12 @@ class File_ASN1 {
} elseif (isset($child['default'])) {
$map[$key] = $child['default']; // Use default.
} elseif (!isset($child['optional'])) {
return NULL; // Syntax error.
return null; // Syntax error.
}
}
// Fail mapping if all input items have not been consumed.
return $i < $n? NULL: $map;
return $i < $n? null: $map;
// the main diff between sets and sequences is the encapsulation of the foreach in another for loop
case FILE_ASN1_TYPE_SET:
@ -638,8 +638,8 @@ class File_ASN1 {
if (isset($mapping['min']) && isset($mapping['max'])) {
$child = $mapping['children'];
foreach ($decoded['content'] as $content) {
if (($map[] = $this->asn1map($content, $child, $special)) === NULL) {
return NULL;
if (($map[] = $this->asn1map($content, $child, $special)) === null) {
return null;
}
}
@ -660,7 +660,7 @@ class File_ASN1 {
$maymatch = true;
if ($child['type'] != FILE_ASN1_TYPE_CHOICE) {
$childClass = FILE_ASN1_CLASS_UNIVERSAL;
$constant = NULL;
$constant = null;
if (isset($child['class'])) {
$childClass = $child['class'];
$constant = $child['cast'];
@ -682,7 +682,7 @@ class File_ASN1 {
if ($maymatch) {
// Attempt submapping.
$candidate = $this->asn1map($temp, $child, $special);
$maymatch = $candidate !== NULL;
$maymatch = $candidate !== null;
}
if (!$maymatch) {
@ -703,7 +703,7 @@ class File_ASN1 {
if (isset($child['default'])) {
$map[$key] = $child['default'];
} elseif (!isset($child['optional'])) {
return NULL;
return null;
}
}
}
@ -796,7 +796,7 @@ class File_ASN1 {
function encodeDER($source, $mapping, $special = array())
{
$this->location = array();
return $this->_encode_der($source, $mapping, NULL, $special);
return $this->_encode_der($source, $mapping, null, $special);
}
/**
@ -818,7 +818,7 @@ class File_ASN1 {
* @return String
* @access private
*/
function _encode_der($source, $mapping, $idx = NULL, $special = array())
function _encode_der($source, $mapping, $idx = null, $special = array())
{
if (is_object($source) && strtolower(get_class($source)) == 'file_asn1_element') {
return $source->element;
@ -849,7 +849,7 @@ class File_ASN1 {
$child = $mapping['children'];
foreach ($source as $content) {
$temp = $this->_encode_der($content, $child, NULL, $special);
$temp = $this->_encode_der($content, $child, null, $special);
if ($temp === false) {
return false;
}
@ -1029,19 +1029,19 @@ class File_ASN1 {
switch (true) {
case !isset($source):
return $this->_encode_der(NULL, array('type' => FILE_ASN1_TYPE_NULL) + $mapping, NULL, $special);
return $this->_encode_der(null, array('type' => FILE_ASN1_TYPE_NULL) + $mapping, null, $special);
case is_int($source):
case is_object($source) && strtolower(get_class($source)) == 'math_biginteger':
return $this->_encode_der($source, array('type' => FILE_ASN1_TYPE_INTEGER) + $mapping, NULL, $special);
return $this->_encode_der($source, array('type' => FILE_ASN1_TYPE_INTEGER) + $mapping, null, $special);
case is_float($source):
return $this->_encode_der($source, array('type' => FILE_ASN1_TYPE_REAL) + $mapping, NULL, $special);
return $this->_encode_der($source, array('type' => FILE_ASN1_TYPE_REAL) + $mapping, null, $special);
case is_bool($source):
return $this->_encode_der($source, array('type' => FILE_ASN1_TYPE_BOOLEAN) + $mapping, NULL, $special);
return $this->_encode_der($source, array('type' => FILE_ASN1_TYPE_BOOLEAN) + $mapping, null, $special);
case is_array($source) && count($source) == 1:
$typename = implode('', array_keys($source));
$outtype = array_search($typename, $this->ANYmap, true);
if ($outtype !== false) {
return $this->_encode_der($source[$typename], array('type' => $outtype) + $mapping, NULL, $special);
return $this->_encode_der($source[$typename], array('type' => $outtype) + $mapping, null, $special);
}
}
@ -1057,7 +1057,7 @@ class File_ASN1 {
user_error('No filters defined for ' . implode('/', $loc));
return false;
}
return $this->_encode_der($source, $filters + $mapping, NULL, $special);
return $this->_encode_der($source, $filters + $mapping, null, $special);
case FILE_ASN1_TYPE_NULL:
$value = '';
break;

View File

@ -1430,7 +1430,7 @@ class File_X509 {
$this->currentCert = $cert;
$currentKeyIdentifier = $this->getExtension('id-ce-subjectKeyIdentifier');
$this->currentKeyIdentifier = is_string($currentKeyIdentifier) ? $currentKeyIdentifier : NULL;
$this->currentKeyIdentifier = is_string($currentKeyIdentifier) ? $currentKeyIdentifier : null;
unset($this->signatureSubject);
@ -1468,7 +1468,7 @@ class File_X509 {
$this->dn = $x509['tbsCertificate']['subject'];
$currentKeyIdentifier = $this->getExtension('id-ce-subjectKeyIdentifier');
$this->currentKeyIdentifier = is_string($currentKeyIdentifier) ? $currentKeyIdentifier : NULL;
$this->currentKeyIdentifier = is_string($currentKeyIdentifier) ? $currentKeyIdentifier : null;
return $x509;
}
@ -1962,7 +1962,7 @@ class File_X509 {
* @param Integer $date optional
* @access public
*/
function validateDate($date = NULL)
function validateDate($date = null)
{
if (!is_array($this->currentCert) || !isset($this->currentCert['tbsCertificate'])) {
return false;
@ -1991,7 +1991,7 @@ class File_X509 {
* Validate a signature
*
* Works on X.509 certs, CSR's and CRL's.
* Returns true if the signature is verified, false if it is not correct or NULL on error
* Returns true if the signature is verified, false if it is not correct or null on error
*
* By default returns false for self-signed certs. Call validateSignature(false) to make this support
* self-signed.
@ -2005,7 +2005,7 @@ class File_X509 {
function validateSignature($caonly = true)
{
if (!is_array($this->currentCert) || !isset($this->signatureSubject)) {
return NULL;
return null;
}
/* TODO:
@ -2106,7 +2106,7 @@ class File_X509 {
/**
* Validates a signature
*
* Returns true if the signature is verified, false if it is not correct or NULL on error
* Returns true if the signature is verified, false if it is not correct or null on error
*
* @param String $publicKeyAlgorithm
* @param String $publicKey
@ -2141,11 +2141,11 @@ class File_X509 {
}
break;
default:
return NULL;
return null;
}
break;
default:
return NULL;
return null;
}
return true;
@ -2366,7 +2366,7 @@ class File_X509 {
* @return Mixed
* @access public
*/
function getDNProp($propName, $dn = NULL, $withType = false)
function getDNProp($propName, $dn = null, $withType = false)
{
if (!isset($dn)) {
$dn = $this->dn;
@ -2420,7 +2420,7 @@ class File_X509 {
function setDN($dn, $merge = false, $type = 'utf8String')
{
if (!$merge) {
$this->dn = NULL;
$this->dn = null;
}
if (is_array($dn)) {
@ -2459,7 +2459,7 @@ class File_X509 {
* @access public
* @return Boolean
*/
function getDN($format = FILE_X509_DN_ARRAY, $dn = NULL)
function getDN($format = FILE_X509_DN_ARRAY, $dn = null)
{
if (!isset($dn)) {
$dn = isset($this->currentCert['tbsCertList']) ? $this->currentCert['tbsCertList']['issuer'] : $this->dn;
@ -2675,7 +2675,7 @@ class File_X509 {
{
switch (true) {
case !empty($this->dn):
return $this->getDNProp($propName, NULL, $withType);
return $this->getDNProp($propName, null, $withType);
case !isset($this->currentCert) || !is_array($this->currentCert):
break;
case isset($this->currentCert['tbsCertificate']):
@ -2871,10 +2871,10 @@ class File_X509 {
$this->publicKey->setPublicKey();
break;
default:
$this->publicKey = NULL;
$this->publicKey = null;
}
$this->currentKeyIdentifier = NULL;
$this->currentKeyIdentifier = null;
$this->currentCert = $csr;
return $csr;
@ -2996,10 +2996,10 @@ class File_X509 {
$this->publicKey->setPublicKey();
break;
default:
$this->publicKey = NULL;
$this->publicKey = null;
}
$this->currentKeyIdentifier = NULL;
$this->currentKeyIdentifier = null;
$this->currentCert = $spkac;
return $spkac;
@ -3054,7 +3054,7 @@ class File_X509 {
}
}
$this->currentKeyIdentifier = NULL;
$this->currentKeyIdentifier = null;
$this->currentCert = $crl;
return $crl;
@ -3138,8 +3138,8 @@ class File_X509 {
return false;
}
$currentCert = isset($this->currentCert) ? $this->currentCert : NULL;
$signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject: NULL;
$currentCert = isset($this->currentCert) ? $this->currentCert : null;
$signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject: null;
if (isset($subject->currentCert) && is_array($subject->currentCert) && isset($subject->currentCert['tbsCertificate'])) {
$this->currentCert = $subject->currentCert;
@ -3311,8 +3311,8 @@ class File_X509 {
}
$this->publicKey = $origPublicKey;
$currentCert = isset($this->currentCert) ? $this->currentCert : NULL;
$signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject: NULL;
$currentCert = isset($this->currentCert) ? $this->currentCert : null;
$signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject: null;
if (isset($this->currentCert) && is_array($this->currentCert) && isset($this->currentCert['certificationRequestInfo'])) {
$this->currentCert['signatureAlgorithm']['algorithm'] =
@ -3365,8 +3365,8 @@ class File_X509 {
return false;
}
$currentCert = isset($this->currentCert) ? $this->currentCert : NULL;
$signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject : NULL;
$currentCert = isset($this->currentCert) ? $this->currentCert : null;
$signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject : null;
$thisUpdate = !empty($this->startDate) ? $this->startDate : @date('D, d M y H:i:s O');
if (isset($crl->currentCert) && is_array($crl->currentCert) && isset($crl->currentCert['tbsCertList'])) {
@ -3402,7 +3402,7 @@ class File_X509 {
}
else {
$crlNumber = $this->getExtension('id-ce-cRLNumber');
$crlNumber = $crlNumber !== false ? $crlNumber->add(new Math_BigInteger(1)) : NULL;
$crlNumber = $crlNumber !== false ? $crlNumber->add(new Math_BigInteger(1)) : null;
}
$this->removeExtension('id-ce-authorityKeyIdentifier');
@ -3612,7 +3612,7 @@ class File_X509 {
* @access private
* @return array ref or false
*/
function &_extensions(&$root, $path = NULL, $create = false)
function &_extensions(&$root, $path = null, $create = false)
{
if (!isset($root)) {
$root = $this->currentCert;
@ -3666,7 +3666,7 @@ class File_X509 {
* @access private
* @return Boolean
*/
function _removeExtension($id, $path = NULL)
function _removeExtension($id, $path = null)
{
$extensions = &$this->_extensions($this->currentCert, $path);
@ -3697,7 +3697,7 @@ class File_X509 {
* @access private
* @return Mixed
*/
function _getExtension($id, $cert = NULL, $path = NULL)
function _getExtension($id, $cert = null, $path = null)
{
$extensions = $this->_extensions($cert, $path);
@ -3722,7 +3722,7 @@ class File_X509 {
* @access private
* @return Array
*/
function _getExtensions($cert = NULL, $path = NULL)
function _getExtensions($cert = null, $path = null)
{
$exts = $this->_extensions($cert, $path);
$extensions = array();
@ -3747,7 +3747,7 @@ class File_X509 {
* @access private
* @return Boolean
*/
function _setExtension($id, $value, $critical = false, $replace = true, $path = NULL)
function _setExtension($id, $value, $critical = false, $replace = true, $path = null)
{
$extensions = &$this->_extensions($this->currentCert, $path, true);
@ -3794,7 +3794,7 @@ class File_X509 {
* @access public
* @return Mixed
*/
function getExtension($id, $cert = NULL)
function getExtension($id, $cert = null)
{
return $this->_getExtension($id, $cert);
}
@ -3806,7 +3806,7 @@ class File_X509 {
* @access public
* @return Array
*/
function getExtensions($cert = NULL)
function getExtensions($cert = null)
{
return $this->_getExtensions($cert);
}
@ -3885,7 +3885,7 @@ class File_X509 {
* @access public
* @return Mixed
*/
function getAttribute($id, $disposition = FILE_X509_ATTR_ALL, $csr = NULL)
function getAttribute($id, $disposition = FILE_X509_ATTR_ALL, $csr = null)
{
if (empty($csr)) {
$csr = $this->currentCert;
@ -3925,7 +3925,7 @@ class File_X509 {
* @access public
* @return Array
*/
function getAttributes($csr = NULL)
function getAttributes($csr = null)
{
if (empty($csr)) {
$csr = $this->currentCert;
@ -4034,7 +4034,7 @@ class File_X509 {
* @access public
* @return String binary key identifier
*/
function computeKeyIdentifier($key = NULL, $method = 1)
function computeKeyIdentifier($key = null, $method = 1)
{
if (is_null($key)) {
$key = $this;
@ -4227,7 +4227,7 @@ class File_X509 {
* @access public
* @return Boolean
*/
function revoke($serial, $date = NULL)
function revoke($serial, $date = null)
{
if (isset($this->currentCert['tbsCertList'])) {
if (is_array($rclist = &$this->_subArray($this->currentCert, 'tbsCertList/revokedCertificates', true))) {
@ -4292,7 +4292,7 @@ class File_X509 {
* @access public
* @return array
*/
function listRevoked($crl = NULL)
function listRevoked($crl = null)
{
if (!isset($crl)) {
$crl = $this->currentCert;
@ -4343,7 +4343,7 @@ class File_X509 {
* @access public
* @return Mixed
*/
function getRevokedCertificateExtension($serial, $id, $crl = NULL)
function getRevokedCertificateExtension($serial, $id, $crl = null)
{
if (!isset($crl)) {
$crl = $this->currentCert;
@ -4366,7 +4366,7 @@ class File_X509 {
* @access public
* @return Array
*/
function getRevokedCertificateExtensions($serial, $crl = NULL)
function getRevokedCertificateExtensions($serial, $crl = null)
{
if (!isset($crl)) {
$crl = $this->currentCert;

View File

@ -1057,7 +1057,7 @@ class Net_SFTP extends Net_SSH2 {
* @return Boolean
* @access public
*/
function touch($filename, $time = NULL, $atime = NULL)
function touch($filename, $time = null, $atime = null)
{
if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) {
return false;
@ -1100,7 +1100,7 @@ class Net_SFTP extends Net_SSH2 {
/**
* Changes file or directory owner
*
* Returns TRUE on success or FALSE on error.
* Returns true on success or false on error.
*
* @param String $filename
* @param Integer $uid
@ -1120,7 +1120,7 @@ class Net_SFTP extends Net_SSH2 {
/**
* Changes file or directory group
*
* Returns TRUE on success or FALSE on error.
* Returns true on success or false on error.
*
* @param String $filename
* @param Integer $gid
@ -1138,8 +1138,8 @@ class Net_SFTP extends Net_SSH2 {
/**
* Set permissions on a file.
*
* Returns the new file permissions on success or FALSE on error.
* If $recursive is true than this just returns TRUE or FALSE.
* Returns the new file permissions on success or false on error.
* If $recursive is true than this just returns true or false.
*
* @param Integer $mode
* @param String $filename

View File

@ -1016,7 +1016,7 @@ class Net_SSH1 {
if ($this->curTimeout) {
$read = array($this->fsock);
$write = $except = NULL;
$write = $except = null;
$start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838
$sec = floor($this->curTimeout);

View File

@ -860,7 +860,7 @@ class Net_SSH2 {
}
$read = array($this->fsock);
$write = $except = NULL;
$write = $except = null;
$sec = floor($timeout);
$usec = 1000000 * ($timeout - $sec);
@ -1756,7 +1756,7 @@ class Net_SSH2 {
// remove the username and password from the logged packet
if (!defined('NET_SSH2_LOGGING')) {
$logged = NULL;
$logged = null;
} else {
$logged = pack('CNa*Na*Na*CNa*',
NET_SSH2_MSG_USERAUTH_REQUEST, strlen('username'), 'username', strlen('ssh-connection'), 'ssh-connection',
@ -2074,7 +2074,7 @@ class Net_SSH2 {
* @return String
* @access public
*/
function exec($command, $callback = NULL)
function exec($command, $callback = null)
{
$this->curTimeout = $this->timeout;
$this->is_timeout = false;
@ -2721,7 +2721,7 @@ class Net_SSH2 {
}
$read = array($this->fsock);
$write = $except = NULL;
$write = $except = null;
$start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838
$sec = floor($this->curTimeout);
@ -2904,7 +2904,7 @@ class Net_SSH2 {
* @return Boolean
* @access private
*/
function _send_binary_packet($data, $logged = NULL)
function _send_binary_packet($data, $logged = null)
{
if (!is_resource($this->fsock) || feof($this->fsock)) {
user_error('Connection closed prematurely');

View File

@ -11,7 +11,6 @@
<rule ref="Generic.ControlStructures.InlineControlStructure.Discouraged"><severity>0</severity></rule>
<rule ref="Generic.Files.LineLength.TooLong"><severity>0</severity></rule>
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma"><severity>0</severity></rule>
<rule ref="Generic.PHP.LowerCaseConstant.Found"><severity>0</severity></rule>
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNoCapital"><severity>0</severity></rule>
<rule ref="PEAR.NamingConventions.ValidFunctionName.NotCamelCaps"><severity>0</severity></rule>
<rule ref="PEAR.Classes.ClassDeclaration.OpenBraceNewLine"><severity>0</severity></rule>