File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 44
55use ProgrammatorDev \OpenWeatherMap \Language \Language ;
66use ProgrammatorDev \OpenWeatherMap \Validator \ChoiceValidatorTrait ;
7+ use ProgrammatorDev \YetAnotherPhpValidator \Exception \ValidationException ;
8+ use ProgrammatorDev \YetAnotherPhpValidator \Validator ;
79
810trait WithLanguageTrait
911{
1012 use ChoiceValidatorTrait;
1113
14+ /**
15+ * @throws ValidationException
16+ */
1217 public function withLanguage (string $ language ): static
1318 {
14- $ this -> validateChoice ( ' language ' , $ language , Language::getList ());
19+ Validator:: choice ( Language::getList ())-> assert ( $ language , ' language ' );
1520
1621 $ clone = clone $ this ;
1722 $ clone ->language = $ language ;
Original file line number Diff line number Diff line change 44
55use ProgrammatorDev \OpenWeatherMap \UnitSystem \UnitSystem ;
66use ProgrammatorDev \OpenWeatherMap \Validator \ChoiceValidatorTrait ;
7+ use ProgrammatorDev \YetAnotherPhpValidator \Exception \ValidationException ;
8+ use ProgrammatorDev \YetAnotherPhpValidator \Validator ;
79
810trait WithUnitSystemTrait
911{
1012 use ChoiceValidatorTrait;
1113
14+ /**
15+ * @throws ValidationException
16+ */
1217 public function withUnitSystem (string $ unitSystem ): static
1318 {
14- $ this -> validateChoice ( ' unitSystem ' , $ unitSystem , UnitSystem::getList ());
19+ Validator:: choice ( UnitSystem::getList ())-> assert ( $ unitSystem , ' unitSystem ' );
1520
1621 $ clone = clone $ this ;
1722 $ clone ->unitSystem = $ unitSystem ;
You can’t perform that action at this time.
0 commit comments