apidoc
[ class tree: apidoc ] [ index: apidoc ] [ all elements ]

Class: AssignmentInConditionSniff

Source Location: /PHP_CodeSniffer-3.1.1/src/Standards/Generic/Sniffs/CodeAnalysis/AssignmentInConditionSniff.php

Class Overview


Detects variable assignments being made within conditions.


Author(s):

Copyright:

  • 2017 Juliette Reinders Folmer. All rights reserved.

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 20]
Detects variable assignments being made within conditions.

This is a typical code smell and more often than not a comparison was intended.

Note: this sniff does not detect variable assignments in the conditional part of ternaries!



[ Top ]


Class Variables

$assignmentTokens = array()

[line 31]

Assignment tokens to trigger on.

Set in the register() method.

  • Access: protected

Type:   array


[ Top ]

$conditionStartTokens = array()

[line 38]

The tokens that indicate the start of a condition.
  • Access: protected

Type:   array


[ Top ]



Method Detail

process   [line 78]

void process( File $phpcsFile, int $stackPtr)

Processes this test, when one of its tokens is encountered.
  • Access: public

Parameters:

\PHP_CodeSniffer\Files\File   $phpcsFile   —  The file being scanned.
int   $stackPtr   —  The position of the current token in the stack passed in $tokens.

[ Top ]

register   [line 46]

int[] register( )

Registers the tokens that this sniff wants to listen for.
  • Access: public

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:27:15 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.