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

Error: Phone numbers in ar_EG #932

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

Error: Phone numbers in ar_EG #932

AhmedAlaa4611 opened this issue Jan 4, 2025 · 3 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########',
    ];
}
Copy link

stale bot commented Jan 31, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 1 week if no further activity occurs. Thank you for your contributions.

@AhmedAlaa4611
Copy link
Author

“This is still an issue” can help.

@stale stale bot removed the lifecycle/stale label Feb 1, 2025
@AhmedAlaa4611 AhmedAlaa4611 changed the title Phone numbers in ar_EG Error: Phone numbers in ar_EG Feb 1, 2025
@pimjansen
Copy link

“This is still an issue” can help.

Feel free to raise a PR and a proper source of the phonemumber spec

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

2 participants