livecheck: finish expanding typed: strict

I previously expanded use of `typed: strict` in livecheck files but
the exception was `livecheck/strategy.rb`. This addresses the
`@strategies` type errors in that file and upgrades it to
`typed: strict`.

Co-authored-by: apainintheneck <apainintheneck@gmail.com>
This commit is contained in:
Sam Ford 2024-07-06 10:00:47 -04:00
parent 2e2dc59e8d
commit 17d15615d8
No known key found for this signature in database
GPG Key ID: 7AF5CBEE1DD6F76D

View File

@ -1,4 +1,4 @@
# typed: true # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
module Homebrew module Homebrew
@ -97,17 +97,13 @@ module Homebrew
# @return [Hash] # @return [Hash]
sig { returns(T::Hash[Symbol, T.untyped]) } sig { returns(T::Hash[Symbol, T.untyped]) }
def strategies def strategies
return @strategies if defined? @strategies @strategies ||= T.let(Strategy.constants.sort.each_with_object({}) do |const_symbol, hash|
@strategies = {}
Strategy.constants.sort.each do |const_symbol|
constant = Strategy.const_get(const_symbol) constant = Strategy.const_get(const_symbol)
next unless constant.is_a?(Class) next unless constant.is_a?(Class)
key = Utils.underscore(const_symbol).to_sym key = Utils.underscore(const_symbol).to_sym
@strategies[key] = constant hash[key] = constant
end end, T.nilable(T::Hash[Symbol, T.untyped]))
@strategies
end end
private_class_method :strategies private_class_method :strategies