isPossibleShortNumberForRegion() public method

Check whether a short number is a possible number when dialled from a region, given the number in the form of a string, and the region where the number is dialled from. This provides a more lenient check than {@link #isValidShortNumber}.
public isPossibleShortNumberForRegion ( PhoneNumber | string $shortNumber, string $regionDialingFrom ) : boolean
$shortNumber PhoneNumber | string The short number to check
$regionDialingFrom string Region dialing From
return boolean whether the number is a possible short number
 public function testIsPossibleShortNumber()
 {
     $possibleNumber = new PhoneNumber();
     $possibleNumber->setCountryCode(33)->setNationalNumber(123456);
     $this->assertTrue($this->shortInfo->isPossibleShortNumber($possibleNumber));
     $this->assertTrue($this->shortInfo->isPossibleShortNumberForRegion($this->parse(123456, RegionCode::FR), RegionCode::FR));
     $impossibleNumber = new PhoneNumber();
     $impossibleNumber->setCountryCode(33)->setNationalNumber(9);
     $this->assertFalse($this->shortInfo->isPossibleShortNumber($impossibleNumber));
     // Note that GB and GG share the country calling code 44, and that this number is possible but
     // not valid.
     $gbNumber = new PhoneNumber();
     $gbNumber->setCountryCode(44)->setNationalNumber(11001);
     $this->assertTrue($this->shortInfo->isPossibleShortNumber($gbNumber));
 }
 public function testCountryCallingCodeIsNotIgnored()
 {
     // +46 is the country calling code for Sweden (SE), and 40404 is a valid short number in the US.
     $this->assertFalse($this->shortInfo->isPossibleShortNumberForRegion($this->parse('+4640404', RegionCode::SE), RegionCode::US));
     $this->assertFalse($this->shortInfo->isValidShortNumberForRegion($this->parse('+4640404', RegionCode::SE), RegionCode::US));
     $this->assertEquals(ShortNumberCost::UNKNOWN_COST, $this->shortInfo->getExpectedCostForRegion($this->parse('+4640404', RegionCode::SE), RegionCode::US));
 }
 /**
  * @dataProvider shortNumberRegionList
  */
 public function testCarrierSpecificShortNumbers($regionCode)
 {
     // Test the carrier-specific tag.
     $desc = $this->shortNumberInfo->getMetadataForRegion($regionCode)->getCarrierSpecific();
     if ($desc->hasExampleNumber()) {
         $exampleNumber = $desc->getExampleNumber();
         $carrierSpecificNumber = $this->phoneNumberUtil->parse($exampleNumber, $regionCode);
         if (!$this->shortNumberInfo->isPossibleShortNumberForRegion($carrierSpecificNumber, $regionCode) || !$this->shortNumberInfo->isCarrierSpecific($carrierSpecificNumber)) {
             $this->fail("Carrier-specific test failed for " . $regionCode);
         }
     }
 }