-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
596a6c6
commit 4fdf926
Showing
7 changed files
with
89 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,52 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* Taken from symfony-docs: contributing/code/standards.rst | ||
* | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Acme; | ||
|
||
const BAM = 1; | ||
|
||
/** | ||
* Coding standards demonstration. | ||
*/ | ||
// phpcs:ignore Brianvarskonst.Namespace.Psr4.InvalidPSR4, Squiz.Classes.ClassFileName.NoMatch | ||
class FooBar | ||
{ | ||
public const SOME_CONST = 42; | ||
public const STR_CONST = '43'; | ||
protected const PROTECT = 0; | ||
public const LALA = 'lala'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $fooBar; | ||
private string $fooBar; | ||
|
||
/** | ||
* @param string $dummy Some argument description | ||
*/ | ||
/** @param string $dummy Some argument description */ | ||
public function __construct(string $dummy) | ||
{ | ||
$this->fooBar = $this->transformText($dummy); | ||
} | ||
|
||
/** | ||
* @return string | ||
* | ||
* @deprecated | ||
*/ | ||
/** @deprecated */ | ||
public function someDeprecatedMethod(): string | ||
{ | ||
@\trigger_error(\sprintf('The %s() method is deprecated since version 2.8 and will be removed in 3.0. Use Acme\Baz::someMethod() instead.', __METHOD__), E_USER_DEPRECATED); | ||
@\trigger_error( | ||
\sprintf( | ||
'The %s() method is deprecated since version 2.8 and will be removed in 3.0. Use %s instead.', | ||
__METHOD__, | ||
'Acme\Baz::someMethod()', | ||
), | ||
E_USER_DEPRECATED, | ||
); | ||
|
||
return Baz::someMethod(); | ||
} | ||
|
@@ -49,7 +61,7 @@ public function someDeprecatedMethod(): string | |
* | ||
* @throws \RuntimeException When an invalid option is provided | ||
*/ | ||
private function transformText($dummy, array $options = []): ?string | ||
private function transformText(bool| string $dummy, array $options = []): ?string | ||
{ | ||
/** @var array<string, string> $defaultOptions */ | ||
$defaultOptions = [ | ||
|
@@ -67,15 +79,15 @@ private function transformText($dummy, array $options = []): ?string | |
|
||
$mergedOptions = \array_merge( | ||
$defaultOptions, | ||
$options | ||
$options, | ||
); | ||
|
||
if (true === $dummy) { | ||
if ($dummy === true) { | ||
return null; | ||
} | ||
|
||
if ('string' === $dummy) { | ||
if ('values' === $mergedOptions['some_default']) { | ||
if ($dummy === 'string') { | ||
if ($mergedOptions['some_default'] === 'values') { | ||
return \substr($dummy, 0, 5); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters