Tags: sirbrillig/phpcs-variable-analysis
Tags
GH Actions: fail "setup-php" if requested tooling could not be instal… …led (#376) Setup-PHP will normally "gracefully" show a warning and not fail the build when an extension or tool failed to install. In most cases, this is not particularly useful as that means that either there will be a failure later on in the build due to the extension or tool missing, or the build will not be representative of what is supposed to be tested. This commit changes this behaviour to fail select builds at the `setup-php` step, which also makes debugging these type of build failures much more straight-forward. Ref: https://github.com/shivammathur/setup-php?tab=readme-ov-file#fail-fast-optional Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
Restore version and dependabot updates from 2.x branch
Simplify getUseIndexForUseImport using findContainingOpeningBracket() Replaces the manual findPrevious call with an exclusion list with the existing findContainingOpeningBracket() abstraction, and simplifies the second findPrevious to skip only empty tokens.
Accept namespaces in sitePassByRefFunctions (#351) * Add test for using a namespace in sitePassByRefFunctions * Add namespace to function names when looking for pass-by-reference * Make sure cache is not used before it is ready * Make sure we don't try to use null in getPassByReferenceFunction * Init passByRefFunctionsCache to null explicitly
Allow finding arrow function variables when arrow function is in file… … scope (#347) * Add test for arrow function in global scope * Still look for arrow func when var scope is 0 `findVariableScopeExceptArrowFunctions()` can return null if it finds no scope, but it can also return 0 which is the file level scope. The additional code to look for arrow function scope needs to operate even on 0. * Remove duplicate call to findVariableScopeExceptArrowFunctions * Remove phpcs-import-detection depdendency since it is unused * Remove ImportDetection on phpcs config
Handle compact inside arrow functions (#339) * Add test for compact used within arrow function * Process every variable in compact separately * Also track position of compact variables * Guard against missing compact variable position * Fix linting errors * Also add test for outside var
fix: Process variable before the end of scope (#324) * test: add test for variable use in short open echo When a variable is used in a short php open echo tag, it should be marked as used. * fix: process variable before the end of scope fixes #323 When the last php code is a short php open echo tag using a variable, process the variable before processing the end of scope.
PreviousNext