Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phone numbers in ar_EG #932

Open
AhmedAlaa4611 opened this issue Jan 4, 2025 · 0 comments
Open

Phone numbers in ar_EG #932

AhmedAlaa4611 opened this issue Jan 4, 2025 · 0 comments

Comments

@AhmedAlaa4611
Copy link

Summary

Phone numbers in ar_EG is not working as expected, it produces other phone number which is not Egyptian ones.

Versions

Version
PHP 8.2.4
fakerphp/faker 1.24.1

Self-enclosed code snippet for reproduction

$faker = Faker\Factory::create('ar_EG');

echo $faker->phoneNumber();

Expected output

Expected a number starts with 010 or 011 or 012 or 015 followed by 8 digits, like:

01024587967

or

01140009150

or

01270773901

or

 01589713732

Actual output

Output that does not start with the expected prefix and sometimes include characters that does not exist in the Egyptian phones such as ., ( and )

+1-508-876-5010

or

+1 (762) 759-1405

or

954.275.5771

Suggested code to fix the issue

We can create a new file called PhoneNumber in src\Provider\ar_EG that contains the following code

<?php

namespace Faker\Provider\ar_EG;

class PhoneNumber extends \Faker\Provider\PhoneNumber
{
    protected static $formats = [
        '010########',
        '011########',
        '012########',
        '015########',
    ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant