package and depencies

This commit is contained in:
RafficMohammed
2023-01-08 02:57:24 +05:30
parent d5332eb421
commit 1d54b8bc7f
4309 changed files with 193331 additions and 172289 deletions

View File

@@ -2,6 +2,11 @@
## [Unreleased](https://github.com/FakerPHP/Faker/compare/v1.20.0...main)
## [2022-12-13, v1.21.0](https://github.com/FakerPHP/Faker/compare/v1.20.0..v1.21.0)
- Dropped support for PHP 7.1, 7.2, and 7.3 (#543)
- Added support for PHP 8.2 (#528)
## [2022-07-20, v1.20.0](https://github.com/FakerPHP/Faker/compare/v1.19.0..v1.20.0)
- Fixed typo in French phone number (#452)

View File

@@ -15,7 +15,7 @@ It's heavily inspired by Perl's [Data::Faker](https://metacpan.org/pod/Data::Fak
### Installation
Faker requires PHP >= 7.1.
Faker requires PHP >= 7.4.
```shell
composer require fakerphp/faker
@@ -57,6 +57,37 @@ for ($i = 0; $i < 3; $i++) {
// 'Orlo Bergstrom'
```
## Automated refactoring
If you already used this library with its properties, they are now deprecated and needs to be replaced by their equivalent methods.
You can use the provided [Rector](https://github.com/rectorphp/rector) config file to automate the work.
Run
```bash
composer require --dev rector/rector
```
to install `rector/rector`.
Run
```bash
vendor/bin/rector process src/ --config vendor/fakerphp/faker/rector-migrate.php
```
to run `rector/rector`.
*Note:* do not forget to replace `src/` with the path to your source directory.
Another way is to use it in your `rector.php` file:
```php
$rectorConfig->import('vendor/fakerphp/faker/rector-migrate.php');
$faker($rectorConfig);
```
## License
Faker is released under the MIT License. See [`LICENSE`](LICENSE) for details.

View File

@@ -14,7 +14,7 @@
}
],
"require": {
"php": "^7.1 || ^8.0",
"php": "^7.4 || ^8.0",
"psr/container": "^1.0 || ^2.0",
"symfony/deprecation-contracts": "^2.2 || ^3.0"
},
@@ -22,7 +22,8 @@
"ext-intl": "*",
"bamarni/composer-bin-plugin": "^1.4.1",
"doctrine/persistence": "^1.3 || ^2.0",
"symfony/phpunit-bridge": "^4.4 || ^5.2"
"phpunit/phpunit": "^9.5.26",
"symfony/phpunit-bridge": "^5.4.16"
},
"autoload": {
"psr-4": {
@@ -54,7 +55,7 @@
},
"extra": {
"branch-alias": {
"dev-main": "v1.20-dev"
"dev-main": "v1.21-dev"
}
}
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.17.0@6f4707aa41c9174353a6434bba3fc8840f981d9c">
<files psalm-version="5.1.0@4defa177c89397c5e14737a80fe4896584130674">
<file src="src/Faker/Calculator/Luhn.php">
<InvalidReturnStatement occurrences="1">
<code>0</code>
@@ -139,6 +139,12 @@
</UndefinedDocblockClass>
</file>
<file src="src/Faker/Provider/Base.php">
<InvalidArgument occurrences="1">
<code>[static::class, 'randomDigit']</code>
</InvalidArgument>
<NoValue occurrences="1">
<code>$array</code>
</NoValue>
<UndefinedDocblockClass occurrences="1">
<code>Closure</code>
</UndefinedDocblockClass>
@@ -148,6 +154,22 @@
<code>false</code>
</FalsableReturnStatement>
</file>
<file src="src/Faker/Provider/HtmlLorem.php">
<UndefinedPropertyFetch occurrences="12">
<code>$element-&gt;ownerDocument</code>
<code>$element-&gt;ownerDocument</code>
<code>$element-&gt;ownerDocument</code>
<code>$element-&gt;ownerDocument</code>
<code>$element-&gt;ownerDocument</code>
<code>$element-&gt;ownerDocument</code>
<code>$element-&gt;ownerDocument</code>
<code>$element-&gt;ownerDocument</code>
<code>$element-&gt;ownerDocument</code>
<code>$element-&gt;ownerDocument</code>
<code>$element-&gt;ownerDocument</code>
<code>$root-&gt;ownerDocument</code>
</UndefinedPropertyFetch>
</file>
<file src="src/Faker/Provider/PhoneNumber.php">
<InvalidReturnStatement occurrences="1">
<code>$imei</code>
@@ -169,7 +191,7 @@
</file>
<file src="src/Faker/Provider/en_SG/Person.php">
<InvalidArrayOffset occurrences="1">
<code>$checksumArr[$checksum % 11]</code>
<code>$weights[$i]</code>
</InvalidArrayOffset>
</file>
<file src="src/Faker/Provider/is_IS/Person.php">
@@ -182,11 +204,40 @@
<code>static::split($text)</code>
</UndefinedMethod>
</file>
<file src="src/Faker/Provider/lt_LT/Person.php">
<InvalidArrayOffset occurrences="1">
<code>$multipliers[$i - 1]</code>
</InvalidArrayOffset>
</file>
<file src="src/Faker/Provider/pl_PL/Company.php">
<InvalidArrayOffset occurrences="2">
<code>$weights[$i]</code>
<code>$weights[$i]</code>
</InvalidArrayOffset>
</file>
<file src="src/Faker/Provider/pl_PL/Payment.php">
<InvalidArrayOffset occurrences="1">
<code>$weights[$i]</code>
</InvalidArrayOffset>
</file>
<file src="src/Faker/Provider/pl_PL/Person.php">
<InvalidArrayOffset occurrences="6">
<code>$high[$i]</code>
<code>$low[$i]</code>
<code>$result[$i]</code>
<code>$weights[$i + 3]</code>
<code>$weights[$i]</code>
<code>$weights[$i]</code>
</InvalidArrayOffset>
<UndefinedDocblockClass occurrences="1">
<code>DateTime</code>
</UndefinedDocblockClass>
</file>
<file src="src/Faker/Provider/ru_RU/Company.php">
<InvalidArrayOffset occurrences="1">
<code>$multipliers[$i]</code>
</InvalidArrayOffset>
</file>
<file src="src/Faker/Provider/sl_SI/Person.php">
<NonStaticSelfCall occurrences="2">
<code>static::lastName()</code>

161
vendor/fakerphp/faker/rector-migrate.php vendored Normal file
View File

@@ -0,0 +1,161 @@
<?php
declare(strict_types=1);
use Faker\Generator;
use Rector\Config;
use Rector\Transform;
// This file configures rector/rector to replace all deprecated property usages with their equivalent functions.
return static function (Config\RectorConfig $rectorConfig): void {
$properties = [
'address',
'amPm',
'asciify',
'biasedNumberBetween',
'boolean',
'bothify',
'buildingNumber',
'century',
'chrome',
'city',
'citySuffix',
'colorName',
'company',
'companyEmail',
'companySuffix',
'country',
'countryCode',
'countryISOAlpha3',
'creditCardDetails',
'creditCardExpirationDate',
'creditCardExpirationDateString',
'creditCardNumber',
'creditCardType',
'currencyCode',
'date',
'dateTime',
'dateTimeAD',
'dateTimeBetween',
'dateTimeInInterval',
'dateTimeThisCentury',
'dateTimeThisDecade',
'dateTimeThisMonth',
'dateTimeThisYear',
'dayOfMonth',
'dayOfWeek',
'domainName',
'domainWord',
'e164PhoneNumber',
'email',
'emoji',
'file',
'firefox',
'firstName',
'firstNameFemale',
'firstNameMale',
'freeEmail',
'freeEmailDomain',
'getDefaultTimezone',
'hexColor',
'hslColor',
'hslColorAsArray',
'iban',
'image',
'imageUrl',
'imei',
'internetExplorer',
'iosMobileToken',
'ipv4',
'ipv6',
'iso8601',
'jobTitle',
'languageCode',
'lastName',
'latitude',
'lexify',
'linuxPlatformToken',
'linuxProcessor',
'localCoordinates',
'localIpv4',
'locale',
'longitude',
'macAddress',
'macPlatformToken',
'macProcessor',
'md5',
'month',
'monthName',
'msedge',
'name',
'numerify',
'opera',
'paragraph',
'paragraphs',
'passthrough',
'password',
'phoneNumber',
'postcode',
'randomAscii',
'randomDigitNotNull',
'randomElement',
'randomElements',
'randomHtml',
'randomKey',
'randomLetter',
'realText',
'realTextBetween',
'regexify',
'rgbColor',
'rgbColorAsArray',
'rgbCssColor',
'rgbaCssColor',
'safari',
'safeColorName',
'safeEmail',
'safeEmailDomain',
'safeHexColor',
'sentence',
'sentences',
'setDefaultTimezone',
'sha1',
'sha256',
'shuffle',
'shuffleArray',
'shuffleString',
'slug',
'streetAddress',
'streetName',
'streetSuffix',
'swiftBicNumber',
'text',
'time',
'timezone',
'title',
'titleFemale',
'titleMale',
'tld',
'toLower',
'toUpper',
'unixTime',
'url',
'userAgent',
'userName',
'uuid',
'windowsPlatformToken',
'word',
'words',
'year',
];
$rectorConfig->ruleWithConfiguration(
Transform\Rector\Assign\PropertyFetchToMethodCallRector::class,
array_map(static function (string $property): Transform\ValueObject\PropertyFetchToMethodCall {
return new Transform\ValueObject\PropertyFetchToMethodCall(
Generator::class,
$property,
$property,
);
}, $properties),
);
};

View File

@@ -17,7 +17,13 @@ class Iban
$checkString = substr($iban, 4) . substr($iban, 0, 2) . '00';
// Replace all letters with their number equivalents
$checkString = preg_replace_callback('/[A-Z]/', ['self', 'alphaToNumberCallback'], $checkString);
$checkString = preg_replace_callback(
'/[A-Z]/',
static function (array $matches): string {
return (string) self::alphaToNumber($matches[0]);
},
$checkString,
);
// Perform mod 97 and subtract from 98
$checksum = 98 - self::mod97($checkString);
@@ -25,16 +31,6 @@ class Iban
return str_pad($checksum, 2, '0', STR_PAD_LEFT);
}
/**
* @param string $match
*
* @return int
*/
private static function alphaToNumberCallback($match)
{
return self::alphaToNumber($match[0]);
}
/**
* Converts letter to number
*

View File

@@ -34,9 +34,9 @@ class Isbn
$digits = str_split($input);
array_walk(
$digits,
static function (&$digit, $position) {
static function (&$digit, $position): void {
$digit = (10 - $position) * $digit;
}
},
);
$result = (11 - array_sum($digits) % 11) % 11;

View File

@@ -46,7 +46,7 @@ final class Container implements ContainerInterface
if (!is_string($id)) {
throw new \InvalidArgumentException(sprintf(
'First argument of %s::get() must be string',
self::class
self::class,
));
}
@@ -57,7 +57,7 @@ final class Container implements ContainerInterface
if (!$this->has($id)) {
throw new NotInContainerException(sprintf(
'There is not service with id "%s" in the container.',
$id
$id,
));
}
@@ -69,7 +69,7 @@ final class Container implements ContainerInterface
throw new \RuntimeException(sprintf(
'Service resolved for identifier "%s" does not implement the %s" interface.',
$id,
Extension::class
Extension::class,
));
}
@@ -90,7 +90,7 @@ final class Container implements ContainerInterface
throw new ContainerException(
sprintf('Error while invoking callable for "%s"', $id),
0,
$e
$e,
);
}
} elseif (is_object($definition)) {
@@ -106,12 +106,12 @@ final class Container implements ContainerInterface
throw new ContainerException(sprintf(
'Could not instantiate class "%s". Class was not found.',
$id
$id,
));
} else {
throw new ContainerException(sprintf(
'Invalid type for definition with id "%s"',
$id
$id,
));
}
}
@@ -128,7 +128,7 @@ final class Container implements ContainerInterface
if (!is_string($id)) {
throw new \InvalidArgumentException(sprintf(
'First argument of %s::get() must be string',
self::class
self::class,
));
}

View File

@@ -34,7 +34,7 @@ final class ContainerBuilder
if (!is_string($value) && !is_callable($value) && !is_object($value)) {
throw new \InvalidArgumentException(sprintf(
'First argument to "%s::add()" must be a string, callable or object.',
self::class
self::class,
));
}
@@ -46,7 +46,7 @@ final class ContainerBuilder
} else {
throw new \InvalidArgumentException(sprintf(
'Second argument to "%s::add()" is required not passing a string or object as first argument',
self::class
self::class,
));
}
}

View File

@@ -36,7 +36,7 @@ final class Blood implements Extension\BloodExtension
return sprintf(
'%s%s',
$this->bloodType(),
$this->bloodRh()
$this->bloodRh(),
);
}
}

View File

@@ -78,7 +78,7 @@ final class Color implements Extension\ColorExtension
$color[1],
$color[1],
$color[2],
$color[2]
$color[2],
);
}
@@ -113,7 +113,7 @@ final class Color implements Extension\ColorExtension
{
return sprintf(
'rgb(%s)',
$this->rgbColor()
$this->rgbColor(),
);
}
@@ -127,7 +127,7 @@ final class Color implements Extension\ColorExtension
return sprintf(
'rgba(%s,%s)',
$this->rgbColor(),
$number->randomFloat(1, 0, 1)
$number->randomFloat(1, 0, 1),
);
}
@@ -158,7 +158,7 @@ final class Color implements Extension\ColorExtension
'%s,%s,%s',
$number->numberBetween(0, 360),
$number->numberBetween(0, 100),
$number->numberBetween(0, 100)
$number->numberBetween(0, 100),
);
}

View File

@@ -89,7 +89,7 @@ final class DateTime implements DateTimeExtension, GeneratorAwareExtension
{
return $this->setTimezone(
$this->getTimestampDateTime($this->unixTime($until)),
$timezone
$timezone,
);
}
@@ -99,7 +99,7 @@ final class DateTime implements DateTimeExtension, GeneratorAwareExtension
return $this->setTimezone(
$this->getTimestampDateTime($this->generator->numberBetween($min, $this->getTimestamp($until))),
$timezone
$timezone,
);
}
@@ -116,7 +116,7 @@ final class DateTime implements DateTimeExtension, GeneratorAwareExtension
return $this->setTimezone(
$this->getTimestampDateTime($timestamp),
$timezone
$timezone,
);
}

View File

@@ -50,7 +50,7 @@ final class Uuid implements UuidExtension
$byte[12],
$byte[13],
$byte[14],
$byte[15]
$byte[15],
);
}
}

View File

@@ -26,7 +26,7 @@ final class Version implements VersionExtension
mt_rand(0, 99),
mt_rand(0, 99),
$preRelease && mt_rand(0, 1) ? '-' . $this->semverPreReleaseIdentifier() : '',
$build && mt_rand(0, 1) ? '+' . $this->semverBuildIdentifier() : ''
$build && mt_rand(0, 1) ? '+' . $this->semverBuildIdentifier() : '',
);
}

View File

@@ -57,11 +57,9 @@ final class Helper
}
}
$string = self::replaceWildcard($string, '%', static function () {
return self::replaceWildcard($string, '%', static function () {
return mt_rand(1, 9);
});
return $string;
}
/**

View File

@@ -584,7 +584,7 @@ class Generator
if (!$this->container->has($id)) {
throw new Extension\ExtensionNotFound(sprintf(
'No Faker extension with id "%s" was loaded.',
$id
$id,
));
}
@@ -893,7 +893,7 @@ class Generator
return $this->ext(Extension\NumberExtension::class)->randomFloat(
$nbMaxDecimals !== null ? (int) $nbMaxDecimals : null,
(float) $min,
$max !== null ? (float) $max : null
$max !== null ? (float) $max : null,
);
}
@@ -911,7 +911,7 @@ class Generator
{
return $this->ext(Extension\NumberExtension::class)->randomNumber(
$nbDigits !== null ? (int) $nbDigits : null,
(bool) $strict
(bool) $strict,
);
}

View File

@@ -193,7 +193,7 @@ class EntityPopulator
return $obj;
}
private function fillColumns($obj, $insertedEntities)
private function fillColumns($obj, $insertedEntities): void
{
foreach ($this->columnFormatters as $field => $format) {
if (null !== $format) {
@@ -205,7 +205,7 @@ class EntityPopulator
'Failed to generate a value for %s::%s: %s',
get_class($obj),
$field,
$ex->getMessage()
$ex->getMessage(),
));
}
// Try a standard setter if it's available, otherwise fall back on reflection
@@ -220,7 +220,7 @@ class EntityPopulator
}
}
private function callMethods($obj, $insertedEntities)
private function callMethods($obj, $insertedEntities): void
{
foreach ($this->getModifiers() as $modifier) {
$modifier($obj, $insertedEntities);

View File

@@ -111,7 +111,7 @@ class Populator
$insertedEntities[$class][] = $this->entities[$class]->execute(
$entityManager,
$insertedEntities,
$generateId
$generateId,
);
if (count($insertedEntities) % $this->batchSize === 0) {

View File

@@ -69,9 +69,9 @@ class ColumnTypeGuesser
case \PropelColumnTypes::FLOAT:
case \PropelColumnTypes::DOUBLE:
case \PropelColumnTypes::REAL:
return static function () use ($generator) {
return $generator->randomFloat();
};
return static function () use ($generator) {
return $generator->randomFloat();
};
case \PropelColumnTypes::CHAR:
case \PropelColumnTypes::VARCHAR:
@@ -102,7 +102,7 @@ class ColumnTypeGuesser
case \PropelColumnTypes::OBJECT:
case \PropelColumnTypes::PHP_ARRAY:
default:
// no smart way to guess what the user expects here
// no smart way to guess what the user expects here
return null;
}
}

View File

@@ -157,7 +157,7 @@ class EntityPopulator
foreach ($tableMap->getBehaviors() as $name => $params) {
switch ($name) {
case 'nested_set':
$modifiers['nested_set'] = static function ($obj, $inserted) use ($class, $generator) {
$modifiers['nested_set'] = static function ($obj, $inserted) use ($class, $generator): void {
if (isset($inserted[$class])) {
$queryClass = $class . 'Query';
$parent = $queryClass::create()->findPk($generator->randomElement($inserted[$class]));
@@ -170,7 +170,7 @@ class EntityPopulator
break;
case 'sortable':
$modifiers['sortable'] = static function ($obj, $inserted) use ($class, $generator) {
$modifiers['sortable'] = static function ($obj, $inserted) use ($class, $generator): void {
$obj->insertAtRank($generator->numberBetween(1, count($inserted[$class] ?? []) + 1));
};

View File

@@ -105,7 +105,7 @@ class ColumnTypeGuesser
case PropelTypes::OBJECT:
case PropelTypes::PHP_ARRAY:
default:
// no smart way to guess what the user expects here
// no smart way to guess what the user expects here
return null;
}
}

View File

@@ -160,7 +160,7 @@ class EntityPopulator
foreach ($tableMap->getBehaviors() as $name => $params) {
switch ($name) {
case 'nested_set':
$modifiers['nested_set'] = static function ($obj, $inserted) use ($class, $generator) {
$modifiers['nested_set'] = static function ($obj, $inserted) use ($class, $generator): void {
if (isset($inserted[$class])) {
$queryClass = $class . 'Query';
$parent = $queryClass::create()->findPk($generator->randomElement($inserted[$class]));
@@ -173,7 +173,7 @@ class EntityPopulator
break;
case 'sortable':
$modifiers['sortable'] = static function ($obj, $inserted) use ($class, $generator) {
$modifiers['sortable'] = static function ($obj, $inserted) use ($class, $generator): void {
$obj->insertAtRank($generator->numberBetween(1, count($inserted[$class] ?? []) + 1));
};

View File

@@ -180,7 +180,7 @@ class EntityPopulator
return $obj;
}
private function fillColumns($obj, $insertedEntities)
private function fillColumns($obj, $insertedEntities): void
{
foreach ($this->columnFormatters as $field => $format) {
if (null !== $format) {
@@ -190,7 +190,7 @@ class EntityPopulator
}
}
private function callMethods($obj, $insertedEntities)
private function callMethods($obj, $insertedEntities): void
{
foreach ($this->getModifiers() as $modifier) {
$modifier($obj, $insertedEntities);

View File

@@ -79,7 +79,7 @@ class Populator
foreach ($this->quantities as $entityName => $number) {
for ($i = 0; $i < $number; ++$i) {
$insertedEntities[$entityName][] = $this->entities[$entityName]->execute(
$insertedEntities
$insertedEntities,
);
}
}

View File

@@ -363,7 +363,7 @@ class Base
return implode('', static::shuffleArray($array));
}
private static function replaceWildcard($string, $wildcard = '#', $callback = 'static::randomDigit')
private static function replaceWildcard($string, $wildcard, $callback)
{
if (($pos = strpos($string, $wildcard)) === false) {
return $string;
@@ -415,7 +415,7 @@ class Base
$string[$toReplace[$i]] = $numbers[$i];
}
}
$string = self::replaceWildcard($string, '%', 'static::randomDigitNotNull');
$string = self::replaceWildcard($string, '%', [static::class, 'randomDigitNotNull']);
return $string;
}
@@ -429,7 +429,7 @@ class Base
*/
public static function lexify($string = '????')
{
return self::replaceWildcard($string, '?', 'static::randomLetter');
return self::replaceWildcard($string, '?', [static::class, 'randomLetter']);
}
/**
@@ -460,7 +460,7 @@ class Base
*/
public static function asciify($string = '****')
{
return preg_replace_callback('/\*/u', 'static::randomAscii', $string);
return preg_replace_callback('/\*/u', [static::class, 'randomAscii'], $string);
}
/**
@@ -532,8 +532,8 @@ class Base
return str_replace('.', '\.', $randomElement);
}, $regex);
// replace \d with number and \w with letter and . with ascii
$regex = preg_replace_callback('/\\\w/', 'static::randomLetter', $regex);
$regex = preg_replace_callback('/\\\d/', 'static::randomDigit', $regex);
$regex = preg_replace_callback('/\\\w/', [static::class, 'randomLetter'], $regex);
$regex = preg_replace_callback('/\\\d/', [static::class, 'randomDigit'], $regex);
//replace . with ascii except backslash
$regex = preg_replace_callback('/(?<!\\\)\./', static function () {
$chr = static::asciify('*');

View File

@@ -138,7 +138,7 @@ class Color extends Base
'%s,%s,%s',
self::numberBetween(0, 360),
self::numberBetween(0, 100),
self::numberBetween(0, 100)
self::numberBetween(0, 100),
);
}

View File

@@ -57,7 +57,7 @@ class DateTime extends Base
{
return static::setTimezone(
new \DateTime('@' . static::unixTime($max)),
$timezone
$timezone,
);
}
@@ -80,7 +80,7 @@ class DateTime extends Base
return static::setTimezone(
new \DateTime('@' . self::numberBetween($min, static::getMaxTimestamp($max))),
$timezone
$timezone,
);
}
@@ -156,7 +156,7 @@ class DateTime extends Base
return static::setTimezone(
new \DateTime('@' . $timestamp),
$timezone
$timezone,
);
}
@@ -189,7 +189,7 @@ class DateTime extends Base
return static::dateTimeBetween(
$begin,
$end,
$timezone
$timezone,
);
}

View File

@@ -94,7 +94,7 @@ class HtmlLorem extends Base
return $root;
}
private function addRandomLeaf(\DOMElement $node)
private function addRandomLeaf(\DOMElement $node): void
{
$rand = self::numberBetween(1, 10);
@@ -146,7 +146,7 @@ class HtmlLorem extends Base
}
}
private function addRandomAttribute(\DOMElement $node)
private function addRandomAttribute(\DOMElement $node): void
{
$rand = self::numberBetween(1, 2);
@@ -163,20 +163,20 @@ class HtmlLorem extends Base
}
}
private function addRandomP(\DOMElement $element, $maxLength = 10)
private function addRandomP(\DOMElement $element, $maxLength = 10): void
{
$node = $element->ownerDocument->createElement(static::P_TAG);
$node->textContent = $this->generator->sentence(self::numberBetween(1, $maxLength));
$element->appendChild($node);
}
private function addRandomText(\DOMElement $element, $maxLength = 10)
private function addRandomText(\DOMElement $element, $maxLength = 10): void
{
$text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength)));
$element->appendChild($text);
}
private function addRandomA(\DOMElement $element, $maxLength = 10)
private function addRandomA(\DOMElement $element, $maxLength = 10): void
{
$text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength)));
$node = $element->ownerDocument->createElement(static::A_TAG);
@@ -185,7 +185,7 @@ class HtmlLorem extends Base
$element->appendChild($node);
}
private function addRandomTitle(\DOMElement $element, $maxLength = 10)
private function addRandomTitle(\DOMElement $element, $maxLength = 10): void
{
$text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength)));
$node = $element->ownerDocument->createElement(static::TITLE_TAG);
@@ -193,7 +193,7 @@ class HtmlLorem extends Base
$element->appendChild($node);
}
private function addRandomH(\DOMElement $element, $maxLength = 10)
private function addRandomH(\DOMElement $element, $maxLength = 10): void
{
$h = static::H_TAG . (string) self::numberBetween(1, 3);
$text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength)));
@@ -202,7 +202,7 @@ class HtmlLorem extends Base
$element->appendChild($node);
}
private function addRandomB(\DOMElement $element, $maxLength = 10)
private function addRandomB(\DOMElement $element, $maxLength = 10): void
{
$text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength)));
$node = $element->ownerDocument->createElement(static::B_TAG);
@@ -210,7 +210,7 @@ class HtmlLorem extends Base
$element->appendChild($node);
}
private function addRandomI(\DOMElement $element, $maxLength = 10)
private function addRandomI(\DOMElement $element, $maxLength = 10): void
{
$text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength)));
$node = $element->ownerDocument->createElement(static::I_TAG);
@@ -218,7 +218,7 @@ class HtmlLorem extends Base
$element->appendChild($node);
}
private function addRandomSpan(\DOMElement $element, $maxLength = 10)
private function addRandomSpan(\DOMElement $element, $maxLength = 10): void
{
$text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength)));
$node = $element->ownerDocument->createElement(static::SPAN_TAG);
@@ -226,7 +226,7 @@ class HtmlLorem extends Base
$element->appendChild($node);
}
private function addLoginForm(\DOMElement $element)
private function addLoginForm(\DOMElement $element): void
{
$textInput = $element->ownerDocument->createElement(static::INPUT_TAG);
$textInput->setAttribute('type', 'text');
@@ -258,7 +258,7 @@ class HtmlLorem extends Base
$element->appendChild($submit);
}
private function addRandomTable(\DOMElement $element, $maxRows = 10, $maxCols = 6, $maxTitle = 4, $maxLength = 10)
private function addRandomTable(\DOMElement $element, $maxRows = 10, $maxCols = 6, $maxTitle = 4, $maxLength = 10): void
{
$rows = self::numberBetween(1, $maxRows);
$cols = self::numberBetween(1, $maxCols);
@@ -292,7 +292,7 @@ class HtmlLorem extends Base
$element->appendChild($table);
}
private function addRandomUL(\DOMElement $element, $maxItems = 11, $maxLength = 4)
private function addRandomUL(\DOMElement $element, $maxItems = 11, $maxLength = 4): void
{
$num = self::numberBetween(1, $maxItems);
$ul = $element->ownerDocument->createElement(static::UL_TAG);

View File

@@ -55,7 +55,7 @@ class Image extends Base
trigger_deprecation(
'fakerphp/faker',
'1.20',
'Provider is deprecated and will no longer be available in Faker 2. Please use a custom provider instead'
'Provider is deprecated and will no longer be available in Faker 2. Please use a custom provider instead',
);
// Validate image format
@@ -65,7 +65,7 @@ class Image extends Base
throw new \InvalidArgumentException(sprintf(
'Invalid image format "%s". Allowable formats are: %s',
$format,
implode(', ', $imageFormats)
implode(', ', $imageFormats),
));
}
@@ -92,7 +92,7 @@ class Image extends Base
self::BASE_URL,
$size,
$backgroundColor,
count($imageParts) > 0 ? '?text=' . urlencode(implode(' ', $imageParts)) : ''
count($imageParts) > 0 ? '?text=' . urlencode(implode(' ', $imageParts)) : '',
);
}
@@ -119,7 +119,7 @@ class Image extends Base
trigger_deprecation(
'fakerphp/faker',
'1.20',
'Provider is deprecated and will no longer be available in Faker 2. Please use a custom provider instead'
'Provider is deprecated and will no longer be available in Faker 2. Please use a custom provider instead',
);
$dir = null === $dir ? sys_get_temp_dir() : $dir; // GNU/Linux / OS X / Windows compatible
@@ -172,7 +172,7 @@ class Image extends Base
trigger_deprecation(
'fakerphp/faker',
'1.20',
'Provider is deprecated and will no longer be available in Faker 2. Please use a custom provider instead'
'Provider is deprecated and will no longer be available in Faker 2. Please use a custom provider instead',
);
return array_keys(static::getFormatConstants());
@@ -183,7 +183,7 @@ class Image extends Base
trigger_deprecation(
'fakerphp/faker',
'1.20',
'Provider is deprecated and will no longer be available in Faker 2. Please use a custom provider instead'
'Provider is deprecated and will no longer be available in Faker 2. Please use a custom provider instead',
);
return [

View File

@@ -53,7 +53,7 @@ class Uuid extends Base
$byte[12],
$byte[13],
$byte[14],
$byte[15]
$byte[15],
);
}
}

View File

@@ -93,7 +93,7 @@ class Person extends \Faker\Provider\Person
public static function idNumber()
{
$partialValue = static::numerify(
static::randomElement([1, 2]) . str_repeat('#', 8)
static::randomElement([1, 2]) . str_repeat('#', 8),
);
return Luhn::generateLuhnNumber($partialValue);

View File

@@ -40,7 +40,7 @@ class Payment extends \Faker\Provider\Payment
'%s%d%d',
$prefix,
self::randomNumber(5, true), // workaround for mt_getrandmax() limitation
self::randomNumber(self::randomElement([4, 5]), true)
self::randomNumber(self::randomElement([4, 5]), true),
);
}
}

View File

@@ -4,21 +4,124 @@ namespace Faker\Provider\de_DE;
class PhoneNumber extends \Faker\Provider\PhoneNumber
{
/**
* @var array<int, string>
*/
protected static $areaCodeRegexes = [
2 => '(0[0-389]|0[4-6][1-68]|1[124]|1[0-9][0-9]|2[18]|2[0-9][1-9]|3[14]|3[0-35-9][0-9]|4[1]|4[02-8][0-9]|5[1]|5[02-9][0-9]|6[1]|6[02-9][0-9]|7[1]|7[2-7][0-9]|8[1]|8[02-7][0-9]|9[1]|9[02-9][0-9])',
3 => '(0|3[15]|3[02-46-9][1-9]|3[02-46-9][02-9][0-9]|4[015]|4[2-4679][1-8]|4[2-4679][02-9][0-9]|5[15]|5[02-46-9][1-9]|5[02-46-9][02-9][0-9]|6[15]|6[02-46-9][1-9]|6[02-46-9][02-9][0-9]|7[15]|7[2-467][1-7]|7[2-467][02-689][0-9]|8[15]|8[2-46-8][013-9]|8[2-46-8][02-9][0-9]|9[15]|9[02-46-9][1-9]|9[02-46-9][02-9][0-9])',
4 => '(0|1[02-9][0-9]|2[1]|2[02-9][0-9]|3[1]|3[02-9][0-9]|4[1]|4[0-9][0-9]|5[1]|5[02-6][0-9]|6[1]|6[02-8][0-9]|7[1]|7[02-79][0-9]|8[1]|8[02-9][0-9]|9[1]|9[02-7][0-9])',
5 => '(0[2-8][0-9]|1[1]|1[02-9][0-9]|2[1]|2[02-9][1-9]|3[1]|3[02-8][0-9]|4[1]|4[02-9][1-9]|5[1]|5[02-9][0-9]|6[1]|6[02-9][0-9]|7[1]|7[02-7][1-9]|8[1]|8[02-8][0-9]|9[1]|9[0-7][1-9])',
6 => '(0[02-9][0-9]|1[1]|1[02-9][0-9]|2[1]|2[02-9][0-9]|3[1]|3[02-9][0-9]|4[1]|4[0-8][0-9]|5[1]|5[02-9][0-9]|6[1]|6[2-9][0-9]|7[1]|7[02-8][1-9]|8[1]|8[02-9][1-9]|9)',
7 => '(0[2-8][1-6]|1[1]|1[2-9][0-9]|2[1]|2[0-7][0-9]|3[1]|3[02-9][0-9]|4[1]|4[0-8][0-9]|5[1]|5[02-8][0-9]|6[1]|6[02-8][0-9]|7[1]|7[02-7][0-9]|8[1]|8[02-5][1-9]|9[1]|9[03-7][0-9])',
8 => '(0[2-9][0-9]|1[1]|1[02-79][0-9]|2[1]|2[02-9][0-9]|3[1]|3[02-9][0-9]|4[1]|4[02-6][0-9]|5[1]|5[02-9][0-9]|6[1]|6[2-8][0-9]|7[1]|7[02-8][1-9]|8[1]|8[02-6][0-9]|9)',
9 => '(0[6]|0[07-9][0-9]|1[1]|1[02-9][0-9]|2[1]|2[02-9][0-9]|3[1]|3[02-9][0-9]|4[1]|4[02-9][0-9]|5[1]|5[02-7][0-9]|6[1]|6[02-8][1-9]|7[1]|7[02-467][0-9]|8[1]|8[02-7][0-9]|9[1]|9[02-7][0-9])',
];
/**
* @see https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers#Germany
* @see https://www.itu.int/oth/T0202000051/en
* @see https://en.wikipedia.org/wiki/Telephone_numbers_in_Germany
*/
protected static $formats = [
'+49(0)##########',
'+49(0)#### ######',
'+49 (0) #### ######',
'+49(0) #########',
'+49(0)#### #####',
'0##########',
'0#########',
'0#### ######',
'0#### #####',
'(0####) ######',
'(0####) #####',
// International format
'+49 {{areaCode}} #######',
'+49 {{areaCode}} ### ####',
'+49 (0{{areaCode}}) #######',
'+49 (0{{areaCode}}) ### ####',
'+49{{areaCode}}#######',
'+49{{areaCode}}### ####',
// Standard formats
'0{{areaCode}} ### ####',
'0{{areaCode}} #######',
'(0{{areaCode}}) ### ####',
'(0{{areaCode}}) #######',
];
protected static $e164Formats = [
'+49##########',
'+49{{areaCode}}#######',
];
/**
* @see https://en.wikipedia.org/wiki/Toll-free_telephone_number
*/
protected static $tollFreeAreaCodes = [
800,
];
protected static $tollFreeFormats = [
// Standard formats
'0{{tollFreeAreaCode}} ### ####',
'(0{{tollFreeAreaCode}}) ### ####',
'+49{{tollFreeAreaCode}} ### ####',
];
public function tollFreeAreaCode()
{
return self::randomElement(static::$tollFreeAreaCodes);
}
public function tollFreePhoneNumber()
{
$format = self::randomElement(static::$tollFreeFormats);
return self::numerify($this->generator->parse($format));
}
protected static $mobileCodes = [
1511, 1512, 1514, 1515, 1516, 1517,
1520, 1521, 1522, 1523, 1525, 1526, 1529,
1570, 1573, 1575, 1577, 1578, 1579,
1590,
];
protected static $mobileFormats = [
'+49{{mobileCode}}#######',
'+49 {{mobileCode}} ### ####',
'0{{mobileCode}}#######',
'0{{mobileCode}} ### ####',
'0 {{mobileCode}} ### ####',
];
/**
* @see https://en.wikipedia.org/wiki/List_of_dialling_codes_in_Germany
*
* @return string
*/
public static function areaCode()
{
$firstDigit = self::numberBetween(2, 9);
return $firstDigit . self::regexify(self::$areaCodeRegexes[$firstDigit]);
}
/**
* Generate a code for a mobile number.
*
* @internal Used to generate mobile numbers.
*
* @return string
*/
public static function mobileCode()
{
return static::randomElement(static::$mobileCodes);
}
/**
* Generate a mobile number.
*
* @example A mobile number: '015111234567'
* @example A mobile number with spaces: '01511 123 4567'
* @example A mobile number with international code prefix: '+4915111234567'
* @example A mobile number with international code prefix and spaces: '+49 1511 123 4567'
*
* @return string
*/
public function mobileNumber()
{
return ltrim(static::numerify($this->generator->parse(
static::randomElement(static::$mobileFormats),
)));
}
}

View File

@@ -158,7 +158,7 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
public static function areaCode()
{
return static::numerify(
str_pad(static::randomElement(static::$areaCodes), 4, '#')
str_pad(static::randomElement(static::$areaCodes), 4, '#'),
);
}
@@ -182,7 +182,7 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
public function fixedLineNumber()
{
return ltrim(static::numerify($this->generator->parse(
static::randomElement(static::$fixedLineFormats)
static::randomElement(static::$fixedLineFormats),
)));
}
@@ -211,7 +211,7 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
public function mobileNumber()
{
return ltrim(static::numerify($this->generator->parse(
static::randomElement(static::$mobileFormats)
static::randomElement(static::$mobileFormats),
)));
}
@@ -224,7 +224,7 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
strtr(static::randomElement(static::$mobileFormats), [
'{{internationalCodePrefix}}' => static::internationalCodePrefix(),
'{{mobileCode}}' => static::mobileCode(),
])
]),
);
}
@@ -241,7 +241,7 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
public function personalNumber()
{
return ltrim(static::numerify($this->generator->parse(
static::randomElement(static::$personalFormats)
static::randomElement(static::$personalFormats),
)));
}
@@ -260,7 +260,7 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
return ltrim(static::numerify(
strtr(static::randomElement(static::$tollFreeFormats), [
'{{internationalCodePrefix}}' => static::internationalCodePrefix(),
])
]),
));
}
@@ -289,7 +289,7 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
public function sharedCostNumber()
{
return ltrim(static::numerify($this->generator->parse(
static::randomElement(static::$sharedCostFormats)
static::randomElement(static::$sharedCostFormats),
)));
}
@@ -318,7 +318,7 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
public function premiumRateNumber()
{
return ltrim(static::numerify($this->generator->parse(
static::randomElement(static::$premiumRateFormats)
static::randomElement(static::$premiumRateFormats),
)));
}
}

View File

@@ -64,8 +64,8 @@ class Address extends \Faker\Provider\en_US\Address
{
$string = static::randomElement(static::$postcode);
$string = preg_replace_callback('/\#/u', 'static::randomDigit', $string);
$string = preg_replace_callback('/\?/u', 'static::randomPostcodeLetter', $string);
$string = preg_replace_callback('/\#/u', [static::class, 'randomDigit'], $string);
$string = preg_replace_callback('/\?/u', [static::class, 'randomPostcodeLetter'], $string);
return static::toUpper($string);
}

View File

@@ -21,7 +21,6 @@ class Company extends \Faker\Provider\Company
public static function vat(string $type = null): string
{
switch ($type) {
case static::VAT_TYPE_BRANCH:
return static::generateBranchTraderVatNumber();
@@ -33,7 +32,6 @@ class Company extends \Faker\Provider\Company
default:
return static::generateStandardVatNumber();
}
}
@@ -55,7 +53,7 @@ class Company extends \Faker\Provider\Company
static::VAT_PREFIX,
$firstBlock,
$secondBlock,
static::calculateModulus97($firstBlock . $secondBlock)
static::calculateModulus97($firstBlock . $secondBlock),
);
}
@@ -68,7 +66,7 @@ class Company extends \Faker\Provider\Company
return sprintf(
'%sHA%d',
static::VAT_PREFIX,
static::numberBetween(500, 999)
static::numberBetween(500, 999),
);
}
@@ -81,7 +79,7 @@ class Company extends \Faker\Provider\Company
return sprintf(
'%s %d',
static::generateStandardVatNumber(),
static::randomNumber(3, true)
static::randomNumber(3, true),
);
}
@@ -94,7 +92,7 @@ class Company extends \Faker\Provider\Company
return sprintf(
'%sGD%s',
static::VAT_PREFIX,
str_pad((string) static::numberBetween(0, 499), 3, '0', STR_PAD_LEFT)
str_pad((string) static::numberBetween(0, 499), 3, '0', STR_PAD_LEFT),
);
}

View File

@@ -20,7 +20,7 @@ class Company extends \Faker\Provider\Company
'%s/%s/%s',
\Faker\Provider\DateTime::dateTimeBetween('-50 years', 'now')->format('Y'),
static::randomNumber(6, true),
static::randomElement(static::$legalEntities)
static::randomElement(static::$legalEntities),
);
}
}

View File

@@ -43,13 +43,13 @@ class Address extends \Faker\Provider\Address
'Territoire britannique de l\'océan Indien', 'Territoires français du sud', 'Thailande', 'Timor', 'Togo', 'Tokelau', 'Tonga', 'Trinité et Tobago', 'Tunisie', 'Turkménistan', 'Turks et Caïques (Îles)', 'Turquie', 'Tuvalu', 'Ukraine', 'Uruguay', 'Vanuatu', 'Vatican (Etat du)', 'Venezuela', 'Vierges (Îles)', 'Vierges britanniques (Îles)', 'Vietnam', 'Wallis et Futuna (Îles)', 'Yemen', 'Yougoslavie', 'Zambie', 'Zaïre', 'Zimbabwe',
];
/**
* @see https://en.wikipedia.org/wiki/Regions_of_France
*/
private static $regions = [
'Alsace', 'Aquitaine', 'Auvergne', 'Bourgogne', 'Bretagne', 'Centre', 'Champagne-Ardenne',
'Corse', 'Franche-Comté', 'Île-de-France', 'Languedoc-Roussillon', 'Limousin',
'Lorraine', 'Midi-Pyrénées', 'Nord-Pas-de-Calais', 'Basse-Normandie', 'Haute-Normandie',
'Pays-de-Loire', 'Picardie', 'Poitou-Charentes', "Provence-Alpes-Côte d'Azur", 'Rhone-Alpes',
'Guadeloupe', 'Martinique', 'Guyane', 'Réunion', 'Saint-Pierre-et-Miquelon', 'Mayotte',
'Saint-Barthélémy', 'Saint-Martin', 'Wallis-et-Futuna', 'Polynésie française', 'Nouvelle-Calédonie',
'Auvergne-Rhône-Alpes', 'Bourgogne-Franche-Comté', 'Bretagne', 'Centre-Val de Loire', 'Corse', 'Grand Est', 'Hauts-de-France',
'Île-de-France', 'Normandie', 'Nouvelle-Aquitaine', 'Occitanie', 'Pays de la Loire', "Provence-Alpes-Côte d'Azur",
'Guadeloupe', 'Martinique', 'Guyane', 'La Réunion', 'Mayotte',
];
private static $departments = [

View File

@@ -173,6 +173,7 @@ class Company extends \Faker\Provider\Company
/**
* @see http://www.pole-emploi.fr/candidat/le-code-rome-et-les-fiches-metiers-@/article.jspz?id=60702
*
* @note Randomly took 300 from this list
*/
protected static $jobTitleFormat = [

View File

@@ -21,7 +21,7 @@ class Person extends \Faker\Provider\Person
'{{title}} {{lastName}} {{firstNameFemale}}',
'{{lastName}} {{firstNameFemale}} {{suffix}}',
'{{title}} {{lastName}} {{firstNameFemale}} {{suffix}}',
'{{lastNameFemaleMarried}} {{$lastName}} {{firstNameFemale}}',
'{{lastNameFemaleMarried}} {{lastName}} {{firstNameFemale}}',
'{{title}} {{lastNameFemaleMarried}} {{firstNameFemale}}',
'{{lastName}} {{firstNameMaleNe}}',
'{{title}} {{lastName}} {{firstNameMaleNe}}',
@@ -93,4 +93,9 @@ class Person extends \Faker\Provider\Person
{
return static::randomElement(static::$suffix);
}
public static function lastNameFemaleMarried()
{
return static::randomElement(static::$lastNameFemaleMarried);
}
}

View File

@@ -6,6 +6,7 @@ class Address extends \Faker\Provider\Address
{
/**
* @see http://bandung.go.id/images/download/daftarruasjalan.htm
* @see https://id.wikipedia.org/wiki/Kategori:Jalan_di_Jakarta
*/
protected static $street = [
'Abang', 'Abdul', 'Abdul Muis', 'Abdul Rahmat', 'Abdul. Muis', 'Abdullah',
@@ -17,7 +18,7 @@ class Address extends \Faker\Provider\Address
'Bagonwoto ', 'Bah Jaya', 'Baha', 'Bahagia', 'Bahagia ',
'Baiduri', 'Baik', 'Baing', 'Baja', 'Baja Raya',
'Bak Air', 'Bak Mandi', 'Bakaru', 'Bakau', 'Bakau Griya Utama',
'Bakhita', 'Bakin', 'Bakit ', 'Bakti', 'Baladewa',
'Bakhita', 'Bakin', 'Bakit ', 'Bakti', 'Baladewa', 'Balikpapan',
'Bambon', 'Bambu', 'Banal', 'Banceng Pondok', 'Banda',
'Bank Dagang Negara', 'Bappenas', 'Bara', 'Bara Tambar', 'Baranang',
'Baranang Siang', 'Baranang Siang Indah', 'Baranangsiang', 'Barasak', 'Barat',
@@ -32,7 +33,7 @@ class Address extends \Faker\Provider\Address
'Flora', 'Flores', 'Gading', 'Gajah', 'Gajah Mada',
'Gambang', 'Gardujati', 'Gatot Subroto', 'Gedebage Selatan', 'Gegerkalong Hilir',
'Gotong Royong', 'Gremet', 'HOS. Cjokroaminoto (Pasirkaliki)', 'Haji', 'Halim',
'Hang', 'Hasanuddin', 'Honggowongso', 'Ikan', 'Imam',
'Hang', 'Hasanuddin', 'Hayam Wuruk', 'Honggowongso', 'Ikan', 'Imam',
'Imam Bonjol', 'Industri', 'Ir. H. Juanda', 'Jagakarsa', 'Jakarta',
'Jaksa', 'Jambu', 'Jamika', 'Jayawijaya', 'Jend. A. Yani',
'Jend. Sudirman', 'Juanda', 'K.H. Maskur', 'K.H. Wahid Hasyim (Kopo)', 'Kali',
@@ -45,7 +46,7 @@ class Address extends \Faker\Provider\Address
'Muwardi', 'Nakula', 'Nanas', 'Nangka', 'Orang',
'Otista', 'Otto', 'PHH. Mustofa', 'Pacuan Kuda', 'Padang',
'Padma', 'Pahlawan', 'Panjaitan', 'Pasir Koja', 'Pasirkoja',
'Pasteur', 'Pattimura', 'Pelajar Pejuang 45', 'Perintis Kemerdekaan', 'Peta',
'Pasteur', 'Pattimura', 'Pelajar Pejuang 45', 'Perintis Kemerdekaan', 'Peta', 'Pintu Besar Selatan',
'Qrisdoren', 'R.E. Martadinata', 'R.M. Said', 'Raden', 'Raden Saleh',
'Radio', 'Rajawali', 'Rajawali Barat', 'Rajawali Timur', 'Rajiman',
'Raya Setiabudhi', 'Raya Ujungberung', 'Reksoninten', 'Ronggowarsito',

View File

@@ -14,7 +14,7 @@ class Company extends \Faker\Provider\Company
/**
* @see http://id.wikipedia.org/wiki/Jenis_badan_usaha
*/
protected static $companyPrefix = ['PT', 'CV', 'UD', 'PD', 'Perum'];
protected static $companyPrefix = ['PT', 'Fa', 'CV', 'UD', 'PJ', 'PD', 'Perum', 'Yayasan'];
/**
* @see https://www.amesbostonhotel.com/macam-macam-profesi-pekerjaan/

File diff suppressed because it is too large Load Diff

View File

@@ -238,7 +238,7 @@ class Person extends \Faker\Provider\Person
* @see http://www.horoskopai.lt/gaires/populiariausios-pavardes-lietuvoje/
*/
protected static $lastNameMale = [
'Kazlaukas', 'Jankauskas', 'Petrauskas', 'Stankevičius', 'Vasiliauskas', 'Žukauskas', 'Butkus',
'Kazlauskas', 'Jankauskas', 'Petrauskas', 'Stankevičius', 'Vasiliauskas', 'Žukauskas', 'Butkus',
'Kateiva', 'Paulauskas', 'Urbonas', 'Kavaliauskas', 'Baranauskas', 'Pocius', 'Sakalauskas',
];

View File

@@ -163,12 +163,12 @@ class Person extends \Faker\Provider\Person
switch (count($dateOfBirthParts)) {
case 1:
$dateOfBirthParts[] = $baseDate->format('m');
//don't break, we need the day also
// no break
//don't break, we need the day also
// no break
case 2:
$dateOfBirthParts[] = $baseDate->format('d');
//don't break, next line will
// no break
//don't break, next line will
// no break
case 3:
break;

View File

@@ -44,6 +44,7 @@ class Company extends \Faker\Provider\Company
/**
* @see https://ru.wikipedia.org/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%8F:%D0%9F%D1%80%D0%BE%D1%84%D0%B5%D1%81%D1%81%D0%B8%D0%B8
*
* @note Randomly took from this list - some jobs titles for each letter
*/
protected static $jobTitleFormat = [

View File

@@ -2,6 +2,9 @@
namespace Faker\Provider\sv_SE;
/**
* @see https://www.pts.se/sv/bransch/telefoni/nummer-och-adressering/telefoninummerplanen/telefonnummers-struktur/
*/
class PhoneNumber extends \Faker\Provider\PhoneNumber
{
/**
@@ -34,4 +37,28 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
'+46(0)%######',
'+46%######',
];
/**
* @var array<int, string> Swedish mobile number formats
*/
protected static array $mobileFormats = [
'+467########',
'+46(0)7########',
'+46 (0)7## ## ## ##',
'+46 (0)7## ### ###',
'07## ## ## ##',
'07## ### ###',
'07##-## ## ##',
'07##-### ###',
'07# ### ## ##',
'07#-### ## ##',
'07#-#######',
];
public function mobileNumber(): string
{
$format = static::randomElement(static::$mobileFormats);
return self::numerify($this->generator->parse($format));
}
}

View File

@@ -31,6 +31,7 @@ class Company extends \Faker\Provider\Company
/**
* @see https://tr.wikipedia.org/wiki/Meslekler_listesi
*
* @note Randomly took 300 from this list
*/
protected static $jobTitleFormat = [