mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
dev-cmd: set typed: strict
This commit is contained in:
parent
09eaf1495a
commit
ca1e08c7a8
@ -1,4 +1,4 @@
|
||||
# typed: true # rubocop:disable Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "abstract_command"
|
||||
@ -172,7 +172,8 @@ module Homebrew
|
||||
with_monkey_patch { Formulary.from_contents(name, file, contents, ignore_errors: true) }
|
||||
end
|
||||
|
||||
def with_monkey_patch
|
||||
sig { params(_block: T.proc.void).returns(T.untyped) }
|
||||
def with_monkey_patch(&_block)
|
||||
# Since `method_defined?` is not a supported type guard, the use of `alias_method` below is not typesafe:
|
||||
BottleSpecification.class_eval do
|
||||
T.unsafe(self).alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
|
||||
@ -210,28 +211,28 @@ module Homebrew
|
||||
BottleSpecification.class_eval do
|
||||
if method_defined?(:old_method_missing)
|
||||
T.unsafe(self).alias_method :method_missing, :old_method_missing
|
||||
undef :old_method_missing
|
||||
T.unsafe(self).undef :old_method_missing
|
||||
end
|
||||
end
|
||||
|
||||
Module.class_eval do
|
||||
if method_defined?(:old_method_missing)
|
||||
T.unsafe(self).alias_method :method_missing, :old_method_missing
|
||||
undef :old_method_missing
|
||||
T.unsafe(self).undef :old_method_missing
|
||||
end
|
||||
end
|
||||
|
||||
Resource.class_eval do
|
||||
if method_defined?(:old_method_missing)
|
||||
T.unsafe(self).alias_method :method_missing, :old_method_missing
|
||||
undef :old_method_missing
|
||||
T.unsafe(self).undef :old_method_missing
|
||||
end
|
||||
end
|
||||
|
||||
DependencyCollector.class_eval do
|
||||
if method_defined?(:old_parse_symbol_spec)
|
||||
T.unsafe(self).alias_method :parse_symbol_spec, :old_parse_symbol_spec
|
||||
undef :old_parse_symbol_spec
|
||||
T.unsafe(self).undef :old_parse_symbol_spec
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user