mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Merge pull request #20132 from Homebrew/dev-cmd
dev-cmd: set `typed: strict`
This commit is contained in:
commit
77321d6f8b
@ -1,4 +1,4 @@
|
|||||||
# typed: true # rubocop:disable Sorbet/StrictSigil
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "abstract_command"
|
require "abstract_command"
|
||||||
@ -172,7 +172,8 @@ module Homebrew
|
|||||||
with_monkey_patch { Formulary.from_contents(name, file, contents, ignore_errors: true) }
|
with_monkey_patch { Formulary.from_contents(name, file, contents, ignore_errors: true) }
|
||||||
end
|
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:
|
# Since `method_defined?` is not a supported type guard, the use of `alias_method` below is not typesafe:
|
||||||
BottleSpecification.class_eval do
|
BottleSpecification.class_eval do
|
||||||
T.unsafe(self).alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
|
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
|
BottleSpecification.class_eval do
|
||||||
if method_defined?(:old_method_missing)
|
if method_defined?(:old_method_missing)
|
||||||
T.unsafe(self).alias_method :method_missing, :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
|
||||||
end
|
end
|
||||||
|
|
||||||
Module.class_eval do
|
Module.class_eval do
|
||||||
if method_defined?(:old_method_missing)
|
if method_defined?(:old_method_missing)
|
||||||
T.unsafe(self).alias_method :method_missing, :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
|
||||||
end
|
end
|
||||||
|
|
||||||
Resource.class_eval do
|
Resource.class_eval do
|
||||||
if method_defined?(:old_method_missing)
|
if method_defined?(:old_method_missing)
|
||||||
T.unsafe(self).alias_method :method_missing, :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
|
||||||
end
|
end
|
||||||
|
|
||||||
DependencyCollector.class_eval do
|
DependencyCollector.class_eval do
|
||||||
if method_defined?(:old_parse_symbol_spec)
|
if method_defined?(:old_parse_symbol_spec)
|
||||||
T.unsafe(self).alias_method :parse_symbol_spec, :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
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user