Skip to content

Commit b3a095b

Browse files
refactor: move isMinVersion to utils, update needsParen fn signature
needsParens() is already being called with 2 params, but the fn signature didn't reflect that
1 parent c186697 commit b3a095b

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/needs-parens.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getPrecedence, shouldFlatten, isBitwiseOperator } from "./util.mjs";
22

3-
function needsParens(path) {
3+
function needsParens(path, options) {
44
const { parent } = path;
55

66
if (!parent) {

src/printer.mjs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
isReferenceLikeNode,
3838
normalizeMagicMethodName,
3939
isSimpleCallArgument,
40+
isMinVersion,
4041
} from "./util.mjs";
4142

4243
const {
@@ -65,10 +66,6 @@ const {
6566
isPreviousLineEmpty,
6667
} = prettierUtil;
6768

68-
function isMinVersion(actualVersion, requiredVersion) {
69-
return parseFloat(actualVersion) >= parseFloat(requiredVersion);
70-
}
71-
7269
function shouldPrintComma(options, requiredVersion) {
7370
if (!options.trailingCommaPHP) {
7471
return false;

src/util.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,10 @@ function memoize(fn) {
709709
};
710710
}
711711

712+
function isMinVersion(actualVersion, requiredVersion) {
713+
return parseFloat(actualVersion) >= parseFloat(requiredVersion);
714+
}
715+
712716
export {
713717
printNumber,
714718
getPrecedence,
@@ -740,4 +744,5 @@ export {
740744
normalizeMagicMethodName,
741745
isSimpleCallArgument,
742746
memoize,
747+
isMinVersion,
743748
};

0 commit comments

Comments
 (0)