From 11a9086b894d1d2744500b2c5b2e02a16954fbe6 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Fri, 21 Jul 2023 19:48:28 -0700 Subject: [PATCH] Fix inreplace sig Implicit Pathname strings strike again --- Library/Homebrew/formula.rb | 8 ++++++++ Library/Homebrew/utils/inreplace.rb | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index fa4e578d2d..f944db7e3a 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -2472,6 +2472,14 @@ class Formula # # @see Utils::Inreplace.inreplace # @api public + sig { + params( + paths: T.any(T::Array[T.untyped], String, Pathname), + before: T.nilable(T.any(Regexp, String)), + after: T.nilable(T.any(Pathname, String, Symbol)), + audit_result: T::Boolean, + ).void + } def inreplace(paths, before = nil, after = nil, audit_result = true) # rubocop:disable Style/OptionalBooleanParameter super(paths, before, after, audit_result) rescue Utils::Inreplace::Error => e diff --git a/Library/Homebrew/utils/inreplace.rb b/Library/Homebrew/utils/inreplace.rb index 9e3118a430..c2f627ebea 100644 --- a/Library/Homebrew/utils/inreplace.rb +++ b/Library/Homebrew/utils/inreplace.rb @@ -41,12 +41,12 @@ module Utils params( paths: T.any(T::Array[T.untyped], String, Pathname), before: T.nilable(T.any(Regexp, String)), - after: T.nilable(T.any(String, Symbol)), + after: T.nilable(T.any(Pathname, String, Symbol)), audit_result: T::Boolean, ).void } def inreplace(paths, before = nil, after = nil, audit_result = true) # rubocop:disable Style/OptionalBooleanParameter - after = after.to_s if after.is_a? Symbol + after &&= after.to_s errors = {}