Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0bc15ff

Browse files
derrabusnicolas-grekas
authored andcommitted
[PhpUnitBridge] Lint files with PHP 5.5
1 parent 52a0233 commit 0bc15ff

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

.github/workflows/phpunit-bridge.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: PhpUnitBridge
2+
3+
on:
4+
push:
5+
paths:
6+
- 'src/Symfony/Bridge/PhpUnit/**'
7+
pull_request:
8+
paths:
9+
- 'src/Symfony/Bridge/PhpUnit/**'
10+
11+
jobs:
12+
13+
lint:
14+
name: Lint
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
21+
- name: Setup PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
coverage: "none"
25+
php-version: "5.5"
26+
27+
- name: Lint
28+
run: find ./src/Symfony/Bridge/PhpUnit -name '*.php' | grep -v -e /Tests/ -e ForV6 -e ForV7 -e ForV8 -e ForV9 -e ConstraintLogicTrait | parallel -j 4 php -l {}

src/Symfony/Bridge/PhpUnit/ClassExistsMock.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,23 @@ public static function withMockedClasses(array $classes)
3030

3131
public static function class_exists($name, $autoload = true)
3232
{
33-
return (bool) (self::$classes[ltrim($name, '\\')] ?? \class_exists($name, $autoload));
33+
$name = ltrim($name, '\\');
34+
35+
return isset(self::$classes[$name]) ? (bool) self::$classes[$name] : \class_exists($name, $autoload);
3436
}
3537

3638
public static function interface_exists($name, $autoload = true)
3739
{
38-
return (bool) (self::$classes[ltrim($name, '\\')] ?? \interface_exists($name, $autoload));
40+
$name = ltrim($name, '\\');
41+
42+
return isset(self::$classes[$name]) ? (bool) self::$classes[$name] : \interface_exists($name, $autoload);
3943
}
4044

4145
public static function trait_exists($name, $autoload = true)
4246
{
43-
return (bool) (self::$classes[ltrim($name, '\\')] ?? \trait_exists($name, $autoload));
47+
$name = ltrim($name, '\\');
48+
49+
return isset(self::$classes[$name]) ? (bool) self::$classes[$name] : \trait_exists($name, $autoload);
4450
}
4551

4652
public static function register($class)

0 commit comments

Comments
 (0)